How to Setup a Datadog Agent with an OpenStack AgentCheck
January 29, 2016 ยท View on GitHub
Install the Agent
- If we haven't already, setup our Datadog account at www.datadoghq.com
- Follow the instructions to install the agent as specified here: https://app.datadoghq.com/account/settings#agent The machine we install the agent on must be in the same cluster as the Compute nodes and networking layer you wish to monitor
- Once the agent is installed and running, run
sudo dd-agent infoto ensure it is running correctly without errors
Configure a Datadog user
We will need to create a datadog_monitoring role with your identity server, and register a datadog user with that role.
The user and role name can be whatever we like, but we will need to keep them handy for subsequent steps.
Alternatively, if your system allows it, the datadog user can be given the admin role
With the common openstack client, here's what the steps look like:
openstack role create datadog_monitoringopenstack user create datadog --password <my_password> --project <my_project_name>openstack role add datadog_monitoring --project <my_project_name> --user datadog
Update our policy.json files
Next we want to make sure that the datadog user has access to the necessary APIs and operations for monitoring.
We will need to update the policy.json files for Neutron and Nova to give role:datadog_monitoring access to the following operations:
Nova
- "compute_extension:aggregates",
- "compute_extension:hypervisors",
- "compute_extension:server_diagnostics",
- "compute_extension:v3:os-hypervisors",
- "compute_extension:v3:os-server-diagnostics",
- "compute_extension:availability_zone:detail",
- "compute_extension:v3:availability_zone:detail",
- "compute_extension:used_limits_for_admin",
- "os_compute_api:os-aggregates:index",
- "os_compute_api:os-aggregates:show",
- "os_compute_api:os-hypervisors",
- "os_compute_api:os-hypervisors:discoverable",
- "os_compute_api:os-server-diagnostics",
- "os_compute_api:os-used-limits"
Neutron
- "get_network"
Keystone
- "identity:get_project"
- "identity:list_projects"
- "identity:list_users"
See here for a sample of how the default policy.json contents would be altered to grant access to datadog_monitoring.
Make sure to restart your Nova, Neutron and Keystone services to ensure that the changes to policy.json take
Download and Configure the AgentCheck
-
Download the Openstack AgentCheck to your
checks.ddirectory: On Debian this will look something like:sudo wget -O /etc/dd-agent/checks.d/openstack.py https://raw.githubusercontent.com/DataDog/dd-agent/talwai/openstack/checks.d/openstack.py -
Download the sample openstack configuration file to your
conf.ddirectory: On Debian this will look something like:sudo wget -O /etc/dd-agent/conf.d/openstack.yaml https://raw.githubusercontent.com/DataDog/dd-agent/talwai/openstack/conf.d/openstack.yaml.example -
Fill in the above configuration file at
/etc/dd-agent/conf.d/openstack.yamlwith the necessary credentials and IDs. The comments in the configuration file should help guide you. Foruserandpassword, make sure to use the same credentials you set in the "Configuring a Datadog user" section -
IMPORTANT: Step 4 makes use of the
dd-agentCLI which was spuriously unlinked in the5.5.0release. If you are using agent version5.5.0, please run the following first:ln -sf /opt/datadog-agent/agent/agent.py /usr/bin/dd-agent. Runsudo dd-agent check openstackto run a one-off instance of the check. This should help you see that your configuration is valid and that your user can talk to necessary APIs -
Run
sudo /etc/init.d/datadog-agent restartso that the new AgentCheck is picked up
Now you should see your data streaming into Datadog. Jump into the Metrics Explorer and checkout the openstack.nova.* and openstack.neutron.* metric namespaces.
Create dashboards from the metrics, and you're up and running