Skip to content

Latest commit

 

History

History
309 lines (188 loc) · 12.6 KB

answers.md

File metadata and controls

309 lines (188 loc) · 12.6 KB

DATADOG TEST

by Morsalin Billah









Level 0 (optional) - Setup an Ubuntu VM

I followed the instructions in the link (Here are instructions for setting up a Vagrant Ubuntu 12.04 VM) and setup an Ubuntu VM.

  1. Download Virtual Box from the official link below: https://www.virtualbox.org/wiki/Downloads

  2. Download the correct Virtual Box host for your Operating System

  1. Install Virtual Box using following your Operating System standard procedure.

  2. Download and install Vagrant from the link below: https://www.vagrantup.com/downloads.html

  3. I find it difficult to find the username and password to Ubuntu system installed in Virtual Box. I searched online and found the username and password to be ‘vagrant’.

  1. I have followed the step-by-step instruction provided ‘Getting Started Page’. It is very helpful and described each steps elaborately.

  2. Vagrant Networking: I have entered the URL http://127.0.0.1:4567 and I can see a web page that is being served from the virtual machine that was automatically setup by Vagrant.

  1. While executing vagrant share I have encountered the following error:

  1. I install ‘ngrok’ from https://ngrok.com/download and execute the command in terminal.

  1. I copy over ‘ngrok’ to my test project folder ‘vagrant_getting_started’ and run ./ngrok help command.

  2. I could not run vagrant share as it was giving me the following error:

  1. I read Internet articles from different source and found that I just realized I didn't need to use vagrant share I can run ngrok and share any port with no problem. So I use the command ./ngrok http 4567

  1. I used the URL https://bab2212d.ngrok.io/ to view the page.

Level 1 - Collecting your Data

Installing Agent:

  1. At first I went to Datadog home page and signed up myself with company name as ‘Datadog Recruiting Candidate’.

  2. Then I downloaded the agent by following the instruction on the screen.

  1. Then I downloaded agent, copied the following code snippet and pasted it to MacOSX terminal. DD\_API\_KEY=0668e689f28ba3418c76ee8f62e7f5f9 bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/osx/install.sh)" While installing the agent in terminal I encountered the following error:

  1. As a workaround, I manually downloaded the ‘datadogagent.dmg’ and installed it.

  2. I have executed ‘vi /opt/datadog-agent/etc/datadog.conf’ command to read the ‘datadog.conf’ file and my API Key was already installed.

  1. After that I clicked finish button and received a welcome email from Datadog that has my username and login URL.

  2. Then I started the datadog agent and it was working fine without error.

What is an Agent?

An agent is a software installed in user’s computer that collects and delivers the metrics and events from the computer to Datadog server. User can see more information of the agent installed in computer by executing the command

$ datadog-agent info.

Add tags in the Agent config file

  1. I have searched Datadog Docs and found a help document ‘Guide to Tagging’.

  1. I have used ‘Configuration File’. I have tried to add ‘HTTP_Check’ and successfully get the information in ‘datadog-agent info’

  1. I have downloaded and installed ‘MongoDB’. I have followed the instruction from the following site: https://www.mongodb.com/download-center#community

  2. I installed Homebrew using the following command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  3. Then installed MongoDB by the instructions of the following page: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

  1. I have found the following Youtube video handy to create data/db directory for MongoDB: https://www.youtube.com/watch?v=Hh-bLCP6jVI

  2. Then I have created the following user (datadogMorsalin) in MongoDB according to the manual installation process: db.createUser({"user":"datadogMorsalin", "pwd": "YG0Z80l4bHizR3ayEoLplg0Y", "roles" : \[ {role: 'read', db: 'admin' }, {role: 'clusterMonitor', db: 'admin'}, {role: 'read', db: 'local' }\]})

  3. After creating the user successfully into MongoDB, I modified the ‘mongo.yaml’ file in conf.d directory: init\_config: instances: - server: mongodb://datadogMorsalin:YG0Z80l4bHizR3ayEoLplg0Y@localhost:27016 tags: - mytag1 - mytag2 - server: mongodb://datadogMorsalin:YG0Z80l4bHizR3ayEoLplg0Y@localhost:27017 tags: - mytag1 - mytag2

  4. Further following the instructions, I went into the Integrations tab on Datadog-web app and installed MongoDB begin configuration for the same. This is where I changed the User and followed the steps to configure the MongoDB integration with Datadog-agent.

  1. I went to Infrastructure Host Map Click on mongodb. This is where I found the tags which I have added using the Configuration File.

  1. Once I got it working and installed properly I ran ‘Datadog-agent info’ in terminal to verify Mongo was up and running. However, instance #0 was not running properly due to the local host either being incorrect or due to me not having permission rights to access the local host of 27016 (found a couple of references on Datadog—GitHub stating that one instance running would be sufficient for the time being.)

Write a custom Agent check that samples a random value

  1. First of all I searched Datadog site to found instruction on ‘How to a Custom Agent Check’ and I found it under the guides. https://docs.datadoghq.com/guides/agent_checks/

  2. In ‘Writing an Agent Check’ page I found the section ‘Your First Check’

  1. I have used Finder of Mac OS X to navigate to conf.d and checks.d directories.

  1. Then I have created test.support.random.py and test.support.random.yaml files in /opt/datadog-agent/agent/checks.d/ and /opt/datadog-agent/etc/conf.d/ respectively using text editor application (Sublime Text).

  2. I have added an import random line as the first line and modified the code snippet in test.support.random.py file. I have changed the class HelloCheck to TestCheck and edited hello.world to test.support.random.

  1. I have copied over the code for test.support.random.yaml file and left it untouched.

  1. I ran datadog-agent info in terminal and can see the test.support.random check has been integrated successfully.

  1. Now I can see the custom agent check in my Host Map:

Level 2 - Visualizing Data

Database Dashboard:

  1. To visualize data, I went to ‘Dashboards’ menu and selected ‘Dashboard List’. Found the ‘Integration Dashboards’ list and selected the proper integration dashboard (MongoDB here) shown below.

  1. Then I have selected MongoDB dashboard and opened it. On the top-right corner of the screen there is a setting icon where I found ‘Clone Dashboard’ option.

  1. After cloning the dashboard I went to Dashboard List again and can see ‘MongoDB(cloned)’ dashboard in the list on the left hand side of the screen. After that, I opened the ‘MongoDB(cloned)’ dashboard and add custom metric test.support.random to the dashboard.

Link to the Dashboard: https://app.datadoghq.com/screen/208410/mongodb-cloned

Difference between Timeboard and Screenboard?

Timeboard: For a timeboard, all the graphs are scoped within the same time and appear in a grid-like fashion. A timeboard has utility for correlation of data and troubleshooting.

Screenboard: Screenboard is for getting a high level look into the functioning of the system. It is much more flexible and customizable. The widgets may have different time frames.

Snapshot of test.support.random graph:

After that, I have cloned this Custom Metrics – test dashboard and turned on the notification. I have then taken snapshot and could not manage to send that snapshot to my email address. Then I used the annotation process to send the snapshot to my other email address:

Link: https://www.datadoghq.com/blog/real-time-graph-annotations/

The email I received:

Level 3 - Alerting on your Data

  1. I went to ‘Monitors’ drop down menu and selected ‘New Monitor’. After that I selected the option ‘Metric’ and continued to define the metric ‘test.support.random’ according to the requirements of test.

  2. I set the alert threshold at 0.9 and warning threshold at 0.8. I also selected Multi Alerts via hosts.

  1. Then I named monitor ‘Threshold Monitor, wrote a message body and added recipients to notify.

  1. Then I created email notifications by selecting my own name/email in the ‘Notify your team’ section.

  1. After a while I received the following warning emails followed by recovered emails from monitor I have created.

Warning Email (1):

Recovered Email (1):

Warning Email (2):

Recovered Email (2):

Recent Activity under Threshold Monitor:

  1. Setting up Downtime: I went to Monitors then selected ‘Manage Downtime’. On Manage Downtime page I clicked ‘Schedule Downtime’ button located on top-right corner of the screen. After clicking on the button a pop up window opened to setup schedule downtime. I setup schedule downtime and received an error message saying ‘Schedule downtime start cannot be in the past’

  2. Then I changed the date to start from tomorrow and it allowed me to save the Schedule Downtime.

Email from Monitor: