Skip to content

Instantly share code, notes, and snippets.

@talwai

talwai/SETUP.md Secret

Last active January 29, 2016 23:55
Show Gist options
  • Save talwai/b8698e061795cec9f263 to your computer and use it in GitHub Desktop.
Save talwai/b8698e061795cec9f263 to your computer and use it in GitHub Desktop.
How to Setup a Datadog Agent with an OpenStack AgentCheck

Install the Agent

  1. If we haven't already, setup our Datadog account at www.datadoghq.com
  2. 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
  3. Once the agent is installed and running, run sudo dd-agent info to 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:

  1. openstack role create datadog_monitoring
  2. openstack user create datadog --password <my_password> --project <my_project_name>
  3. 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

  1. Download the Openstack AgentCheck to your checks.d directory: 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

  2. Download the sample openstack configuration file to your conf.d directory: 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

  3. Fill in the above configuration file at /etc/dd-agent/conf.d/openstack.yaml with the necessary credentials and IDs. The comments in the configuration file should help guide you. For user and password, make sure to use the same credentials you set in the "Configuring a Datadog user" section

  4. IMPORTANT: Step 4 makes use of the dd-agent CLI which was spuriously unlinked in the 5.5.0 release. If you are using agent version 5.5.0, please run the following first: ln -sf /opt/datadog-agent/agent/agent.py /usr/bin/dd-agent. Run sudo dd-agent check openstack to 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

  5. Run sudo /etc/init.d/datadog-agent restart so 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment