This guide covers installing Agent 5. Datadog recommends installing or upgrading to Agent 7 for the latest features. For information on installing the latest version of the Agent, follow the Agent 7 Installation Instructions. For information on upgrading to Agent 7 from an earlier version, see Upgrade to Datadog Agent v7.
macOS
Install the Agent
Command line
Run the following command, replacing MY_API_KEY with your Datadog API key:
To manage the Agent, use the datadog-agent command. By default, the datadog-agent binary is located in /usr/local/bin. Enable or disable integrations in /opt/datadog-agent/etc/conf.d.
Add the following line to /opt/datadog-agent/etc/datadog.conf, replacing MY_API_KEY with your Datadog API key:
api_key:MY_API_KEY
To manage the Agent, use the Datadog Agent app in the system tray. Enable or disable integrations in /opt/datadog-agent/etc/conf.d.
Agent run behavior
By default, the Agent runs at login. You can disable it using the Datadog Agent app in the system tray. If you want to run the Agent at boot, use these commands:
If you are an existing customer running a Windows Agent prior to 5.12, there may be additional steps required to upgrade your device. Specifically, the latest Agent is a “per-machine” installation. Prior versions of the Agent were “per-user” by default. There may also be additional steps required if you’re deploying with Chef. For more information, see Windows Agent Installation.
Uninstall
There are two different methods to uninstall the Agent on Windows. Both methods remove the Agent, but do not remove the C:\ProgramData\Datadog configuration folder on the host.
Note: For Agent < v5.12.0, it’s important to uninstall the Agent with the original account used to install the Agent, otherwise it may not be cleanly removed.
Add or remove programs
Press CTRL and Esc or use the Windows key to run Windows Search.
Search for add and click Add or remove programs.
Search for Datadog Agent and click Uninstall.
PowerShell
Note: Enable WinRM to use the commands below.
Use the following PowerShell command to uninstall the Agent without rebooting:
The one-step command installs the APT packages for the Datadog Agent and prompts you for your password. If the Agent is not already installed on your machine and you don’t want it to start automatically after the installation, prepend DD_INSTALL_ONLY=true to the command before running it.
Run the following command, replacing MY_API_KEY with your Datadog API key:
Run the following command to copy the example config into place. Replace MY_API_KEY with your Datadog API key:
sudo sh -c "sed 's/api_key:.*/api_key:MY_API_KEY /' /etc/dd-agent/datadog.conf.example > /etc/dd-agent/datadog.conf"
Start the Agent:
sudo /etc/init.d/datadog-agent start
One-step install
The one-step command installs the APT packages for the Datadog Agent and prompts you for your password. If the Agent is not already installed on your machine and you don’t want it to start automatically after the installation, prepend DD_INSTALL_ONLY=true to the command before running it.
Run the following command, replacing MY_API_KEY with your Datadog API key:
Run the following command to copy the example config into place. Replace MY_API_KEY with your Datadog API key:
sudo sh -c "sed 's/api_key:.*/api_key:MY_API_KEY /' /etc/dd-agent/datadog.conf.example > /etc/dd-agent/datadog.conf"
Start the Agent:
sudo /etc/init.d/datadog-agent start
Uninstall
To uninstall the Agent, run the following command:
sudo apt-get remove datadog-agent -y
This command removes the Agent, but does not remove:
The datadog.yaml configuration file
User-created files in the /etc/dd-agent configuration folder
User-created files in the /opt/datadog-agent folder
The dd-agent user
Datadog log files
If you also want to remove these elements, run this command after removing the Agent:
sudo apt-get --purge remove datadog-agent -y
One-step install
The one-step command installs the YUM packages for the Datadog Agent and prompts you for your password. If the Agent is not already installed on your machine and you don’t want it to start automatically after the installation, prepend DD_INSTALL_ONLY=true to the command before running it.
Run the following command, replacing MY_API_KEY with your Datadog API key:
The one-step command installs the YUM packages for the Datadog Agent and prompts you for your password. If the Agent is not already installed on your machine and you don’t want it to start automatically after the installation, prepend DD_INSTALL_ONLY=true to the command before running it.
Run the following command, replacing MY_API_KEY with your Datadog API key:
The one-step command installs the YUM packages for the Datadog Agent and prompts you for your password. If the Agent is not already installed on your machine and you don’t want it to start automatically after the installation, prepend DD_INSTALL_ONLY=true to the command before running it.
Run the following command, replacing MY_API_KEY with your Datadog API key:
The one-step command installs the YUM packages for the Datadog Agent and prompts you for your password. If the Agent is not already installed on your machine and you don’t want it to start automatically after the installation, prepend DD_INSTALL_ONLY=true to the command before running it.
Run the following command, replacing MY_API_KEY with your Datadog API key:
The one-step command installs the latest BFF package for the Datadog Agent and prompts you for your password if necessary. If the Agent is not already installed on your machine and you don’t want it to start automatically after the installation, prepend DD_INSTALL_ONLY=true to the command before running it.
Run the following command, replacing MY_API_KEY with your Datadog API key:
Note: Agent uninstallation logs can be found in the dd-aix-install.log file. To disable this logging, remove the -e parameter in the uninstallation command.
Cloud and containers
Install the Agent
Install with DaemonSets
If you’re running Kubernetes >= 1.1.0, you can take advantage of DaemonSets to automatically deploy the Datadog Agent on all your nodes
Create a secret that contains your API key. This secret is used in the manifest to deploy the Datadog Agent. Replace MY_API_KEY with your Datadog API key:
This manifest enables autodiscovery's auto-configuration feature. To disable auto-configuration, remove the SD_BACKEND environment variable definition. To learn how to configure autodiscovery, see Kubernetes Integrations Autodiscovery.
Run the Agent as a Docker container
If you are not running Kubernetes 1.1.0 or later, or you don’t want to use DaemonSets, run the Agent as a Docker container on each node you want to monitor. Run the following command, replacing MY_API_KEY with your Datadog API key:
Configure your client library to send UDP packets to the node’s IP. If using bridge networking, the default gateway of your application container matches the node’s IP. You can also use the downward API to expose the node’s hostname as an environment variable.
Customize your Agent configuration
To customize your Agent configuration, see the documentation in the Agent 5 docker-dd-agent repo. To tune autodiscovery configuration, see Kubernetes Integrations Autodiscovery. To disable autodiscovery, remove the SD_BACKEND environment variable from your manifest.
For information on collecting metrics, service checks, and events, see the Kubernetes integration documentation.
One-step install
The one-step install runs a Docker container which embeds the Datadog Agent to monitor your host. The Docker integration is enabled by default, as well as autodiscovery in auto config mode. To disable autodiscovery, remove the SD_BACKEND variable from the one-step install command.
Amazon Linux
Run the following command, replacing MY_API_KEY with your Datadog API key:
If the one-step install command does not work, it’s possible that your system mounts the cgroup directory in an unexpected place or does not use CGroups for memory management. CGroups are required for the Docker check to succeed. To enable CGroups, see the documentation in the docker-dd-agent repo. If the check is failing because of an unexpected cgroup directory location:
Run mount | grep "cgroup type tmpfs" to retrieve the location of the cgroup directory.
Replace the first occurence of /sys/fs/cgroup in the one-step install command with the location of the cgroup directory.
Send custom metrics
To send custom metrics using DogStatsD:
Add the -p 8125:8125/udp option to the install command. This binds the container’s StatsD port to the host’s IP address.
Configure your client library to send UDP packets to the host’s IP address.
Customize your Agent configuration
To customize your Agent configuration, see the documentation in the Agent 5 docker-dd-agent repo. To tune autodiscovery configuration, see Docker Integrations Autodiscovery. To disable autodiscovery, remove the SD_BACKEND environment variable from the one-step installation command.
Running CoreOS Container Linux is supported with the Docker runtime. For installation instructions, see Docker.
To run CoreOS Tectonic on Kubernetes, see Kubernetes.
For information on installing Datadog with OpenShift, see the datadog-openshift repo.
The Datadog Agent BOSH release only works on Ubuntu and Red Hat stemcells.
Upload the Datadog Agent release to your BOSH Director:
# BOSH CLI v1bosh upload release https://cloudfoundry.datadoghq.com/datadog-agent/datadog-agent-boshrelease-latest.tgz
# BOSH CLI v2bosh upload-release https://cloudfoundry.datadoghq.com/datadog-agent/datadog-agent-boshrelease-latest.tgz
Configure Datadog as an addon in your runtime config. Replace MY_API_KEY with your Datadog API key::
# runtime.yml---releases:- name:datadog-agentversion:$UPLOADED_VERSION# e.g. 1.0.5140addons:- name:datadogjobs:- name:dd-agentrelease:datadog-agentproperties:dd:use_dogstatsd:yesdogstatsd_port:18125# Many Cloud Foundry deployments have their own StatsD listening on port 8125api_key:MY_API_KEYtags:["my-cloud-foundry-deployment"]# optional. Add any tags you wish# Optionally, enable any Agent Checks here# integrations:# directory:# init_config: {}# instances:# directory: "."
Add the runtime to your runtime config:
# BOSH cli v1bosh update runtime-config runtime.yml
# BOSH cli v2bosh update-runtime-config runtime.yml
Redeploy any existing deployments:
# BOSH cli v1bosh deployment myDeployment.yml
bosh -n deploy
# BOSH cli v2bosh -n -d myDeployment deploy myDeployment.yml
Configuration management
The Datadog Ansible collection supports most Debian, RHEL-based and SUSE-based Linux distributions, macOS, and Windows. Requires Ansible version 2.10 or higher.
Prerequisites
Windows
Before you can use the Datadog Ansible Collection to manage Windows hosts, you must install the ansible.windows collection:
ansible-galaxy collection install ansible.windows
openSUSE and SLES
Before you can use the Datadog Ansible Collection to manage openSUSE/SLES hosts, you must install the community.general collection:
Install the Datadog Ansible collection from Ansible Galaxy on your Ansible server:
ansible-galaxy collection install datadog.dd
The Datadog Ansible collection is also available through the Red Hat Automation Hub where it is officially certified by Red Hat.
Installing the collection is recommended. If needed, you can also install Datadog using the standalone role.
To deploy the Datadog Agent on hosts, add the Datadog role and your API key to your playbook. Replace MY_API_KEY with your Datadog API key:
- hosts:serverstasks:- name:Import the Datadog Agent role from the Datadog collectionimport_role:name:datadog.dd.agentvars:datadog_api_key:"MY_API_KEY"datadog_agent_major_version:5
To ensure that the Agent can group your hosts together, only use node hostnames that the Datadog Agent is tracking. You can check what hostnames the Agent is tracking using the following command:
service datadog-agent info
Specific Agent checks
To use a specific Agent check or integration on one of your nodes, you can use the datadog_checks variable. Here is an example for the process check:
- hosts:serverstasks:- name:Import the Datadog Agent role from the Datadog collectionimport_role:name:datadog.dd.agentvars:datadog_api_key:"MY_API_KEY"datadog_agent_major_version:5datadog_checks:process:init_config:instances:- name:sshsearch_string:['ssh','sshd']- name:syslogsearch_string:['rsyslog']cpu_check_interval:0.2exact_match:trueignore_denied_access:true
You can find more examples of the Agent role usage on the Github repo for the standalone role.
Metrics and events
To get metrics and events on Datadog after Ansible runs, see the Ansible callback project’s Github page.
The datadog_agent module only supports Linux nodes. Requires Puppet Agent version 2.7 or higher.
Install the datadog_agent module from the Puppet Forge on your Puppet server:
For fresh installs, run the module install command:
puppet module install datadog-datadog_agent
If the module is already installed, upgrade it:
puppet module upgrade datadog-datadog_agent
To deploy the Datadog agent on nodes, add this parametrized class to your manifests. Replace MY_API_KEY with your Datadog API key:
To ensure that the Agent can group your hosts together, only use node hostnames that the Datadog Agent is tracking. You can check what hostnames the Agent is tracking using the following command:
service datadog-agent info
Enable reporting to Datadog on your Puppet server:
Add the following parameters to /etc/puppet/puppet.conf:
Run Puppet on your Puppet server to install all necessary dependencies.
Restart your Puppet server to begin receiving Puppet data in Datadog.
Specific Agent checks
To use a specific Agent check or integration on one of your nodes, see the relevant integration manifest for a code sample. Here is an example for the elasticsearch integration:
If you are using Berkshelf, add the cookbook to your Berksfile:
cookbook 'datadog'
If you’re not using Berkshelf, install the cookbook in to your repository using Knife:
knife cookbook site install datadog
Set the Datadog-specific attributes in either a role, environment, or another recipe. Replace MY_API_KEY with your Datadog API key:
node.default['datadog']['api_key'] = "MY_API_KEY"
# Use an existing application key or create a new one for Chef
node.default['datadog']['application_key'] = "Generate Application Key"
The Datadog Saltstack formula only supports Debian-based and RedHat-based systems.
The following instructions add the Datadog formula to the base Salt environment. To add it to another Salt environment, replace references to base with the name of your Salt environment.
Install using gitfs_remotes
Install the Datadog formula in the base environment of your Salt Master node, using the gitfs_remotes option in your Salt Master configuration file (by default /etc/salt/master):
fileserver_backend:- roots# Active by default, necessary to be able to use the local salt files we define in the next steps- gitfs# Adds gitfs as a fileserver backend to be able to use gitfs_remotesgitfs_remotes:- https://github.com/DataDog/datadog-formula.git:- saltenv:- base:- ref:3.0# Pin here the version of the formula you want to use
Refer to the formula Github repository for logs configuration, check examples, and advanced use cases.
Install from source
The Datadog Agent requires python 2.7 and sysstat on Linux.
Use the one-step source install script. Replace MY_API_KEY with your Datadog API key:
DD_API_KEY=MY_API_KEY sh -c "$(curl -L https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/datadog-agent/source/setup_agent.sh)"
The script installs the Agent in its own self-contained sandbox located at ~/.datadog-agent.
To make the installation permanent, set up your init daemon to run $sandbox_dir/bin/agent with $sandbox_dir set at the current working directory. The sandbox directory is portable and can run from any location on your file system. The sandbox directory is set to ~/.datadog-agent by default.