Automate IT and infrastructure, manage complex workflows, and mitigate risk at scale.
Try the full-featured Puppet Enterprise for free on 10 nodes.
Find and prevent compliance failures
Continuous Delivery for Puppet Enterprise
Build, test, and deploy infrastructure as code faster and easier
Compliance Enforcement Modules
Remediate to stay in compliance
Content & Modules
Pre-built scripts to automate common tasks
Get Puppet Enterprise
First 10 nodes are free!
Try it now
Request a demo
Find thousands of component modules built by the community and guidance on using them in your own infrastructure.
Visit Puppet Forge >>
Open Source Puppet
Perfect for individuals and small infrastructure
Automate tasks in orchestration workflows
See all open source projects >>
Contribute to open source projects >>
This blog post will help you set up Puppet facts as tags for both metrics (sent from DataDog agents, client side) and events (Puppet-run reports, server side), and will give tips on ideal use.
Table of Contents:
Tags are pieces of metadata in DataDog that are key to correlating data from various sources.
Tags simplify extracting business information to make it easier for organizations to answer questions such as “do spikes in CPU usage correlate with deployments of applications?” or “does a certain server role contribute to a majority of our support tickets?”
Puppet users can take advantage of extensible information Puppet knows about a system to easily send specific facts (core or external) as tags (metadata) with either metrics or events. Sales engineer Elizabeth Plumb has a great video here from a previous PuppetConf about the Puppet and DataDog integration.
Note: This guide assumes you are using the official Datadog agent module for Puppet, specifically 3.5.0 or greater.
With the “datadog_agent” class classified to nodes, there is a parameter “facts_to_tags” that will take an array of strings. Once it is classified and Puppet is run on the managed nodes, the node’s DataDog config file will be updated with these facts and their values.
In this case, I used “osfamily” to separate out my Linux/Windows nodes, “trusted.extensions.pp_role” which is part of my server role provisioning (trusted facts info here), “datacenter” which is a custom external fact I wrote for my environment, and “ec2_metadata.ami-id” which is another built-in fact, to group based on ami-ids.
Adding or editing these facts will only work once the code has been deployed to your node and will cause changes on your next Puppet run. It’s easy to confirm that Tags are reporting in the DataDog metrics section:
Adding facts as tags for events assumes you have enabled the “puppet_run_reports” parameter for the “datadog_agent” class on your Puppetserver ; directions can be found here. Enabling these tags is as easy as setting a single parameter -- also an array of strings similar to above -- through hiera. In this case, I used the Data section of classification to configure this parameter on my Puppetserver:
Notice I used the same tags as above. This is intentional and important so I can correlate events -- which are run reports sent to DataDog from the server -- with metrics that are sent from the nodes themselves.
At the time of writing, in order to finish the setup, you need to commit your changes to your main (through the console or however you set your hiera today) and run Puppet. Once Puppet has updated the configuration file on the Puppetserver, you need to restart Puppetserver (systemctl restart pe-puppetserver for Puppet Enterprise or systemctl restart puppetserver on open source) to re-read the configuration file by the report processor. Report processors are typically cached and, as such, updates to them require a restart of the Puppet server for each change.
systemctl restart pe-puppetserver
systemctl restart puppetserver
Here is what the tags look like in the event stream of Datadog:
There are various tips for maximizing the above functionality, and ensuring your data is meaningful to the organization and able to help you extract value from both tools through the integration.
Get Help with DataDog and Puppet in The Forge
Mike Smith is a sales engineer at Puppet.