Logging is here!

Basic Agent Usage for CentOS

Overview

This page outlines the basic functionality of the Datadog Agent. If you haven’t installed the Agent yet, instructions can be found in the Datadog Agent integration page.

The process to upgrade from the previous version of the Agent is to re-run the installation.

Commands

Datadog Agent has some commands and only the lifecycle commands (i.e. start/stop/restart/status on the Agent service) should be run with sudo service/sudo systemctl, all other commands need to be run with the datadog-agent command.

Agent v5 Agent v6 Notes
sudo service datadog-agent start sudo service datadog-agent start Start Agent as a service
sudo service datadog-agent stop sudo service datadog-agent stop Stop Agent running as a service
sudo service datadog-agent restart sudo service datadog-agent restart Restart Agent running as a service
sudo service datadog-agent status sudo service datadog-agent status Status of Agent service
sudo service datadog-agent info sudo datadog-agent status Status page of running Agent
sudo service datadog-agent flare sudo datadog-agent flare Send flare
sudo service datadog-agent sudo datadog-agent --help Display command usage
sudo -u dd-agent -- dd-agent check <check_name> sudo -u dd-agent -- datadog-agent check <check_name> Run a check

More information about the metrics, events, and service checks for an integrations can be retrieved with the check command:

sudo service datadog-agent check [integration]

Add the check_rate argument to get the most recent values for rates:

sudo service datadog-agent check [integration] check_rate

NB: If service is not available on your system, use:

  • on upstart-based systems: sudo start/stop/restart datadog-agent
  • on systemd-based systems: sudo systemctl start/stop/restart datadog-agent

Learn more about Service lifecycle commands

Configuration

The configuration files and folders for the Agent are located at:

Agent v5 Agent v6
/etc/dd-agent/datadog.conf /etc/datadog-agent/datadog.yaml

Configuration files for integrations:

Agent v5 Agent v6
/etc/dd-agent/conf.d/ /etc/datadog-agent/conf.d/

Troubleshooting

Run the info or status command to see the state of the Agent. The Agent logs are located in the /var/log/datadog/ directory:

  • For Agent v6 all logs are in the agent.log file
  • For Agent v5 logs are in:

    • datadog-supervisord.log
    • collector.log
    • dogstatsd.log
    • forwarder.log

If you’re still having trouble, our support team will be glad to provide further assistance.

Switch between Agent v5 and v6

Upgrade to Agent 6

A script is available to automatically install or upgrade the new Agent. It sets up the repos and installs the package for you; in case of upgrade, the import tool also searches for an existing datadog.conf from a prior version and converts Agent and checks configurations according to the new file format and filesystem layout.

One-step install

To Upgrade

The Agent 6.x installer can automatically convert your 5.x style Agent configuration at upgrade:

 DD_UPGRADE=true bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"

Note: the import process won’t automatically move custom Agent checks, this is by design since we cannot guarantee full backwards compatibility out of the box.

To Install Fresh

To install on a clean box (or have an existing Agent 5 install from which you do not wish to import the configuration) provide an api key:

 DD_API_KEY=YOUR_API_KEY bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"

Manual install

  1. Set up Datadog’s Yum repo on your system by creating /etc/yum.repos.d/datadog.repo with the contents:

    [datadog]
    name = Datadog, Inc.
    baseurl = https://yum.datadoghq.com/stable/6/x86_64/
    enabled=1
    gpgcheck=1
    gpgkey=https://yum.datadoghq.com/DATADOG_RPM_KEY.public
    
  2. Update your local yum repo and install the Agent:

    sudo yum makecache
    sudo yum remove datadog-agent-base
    sudo yum install datadog-agent
    
  3. Copy the example config into place and plug in your API key:

    sudo sh -c "sed 's/api_key:.*/api_key: <YOUR_API_KEY>/' /etc/datadog-agent/datadog.yaml.example > /etc/datadog-agent/datadog.yaml"
    
  4. Re-start the Agent on Centos 7 and above:

    sudo systemctl restart datadog-agent.service
    
  5. Re-start the Agent on Centos 6:

    sudo initctl start datadog-agent
    

Downgrade to Agent v5

  1. Set up apt so it can download through https

    sudo apt-get update
    sudo apt-get install apt-transport-https
  2. Remove Agent 6 Repo and Ensure the stable repo is present

    sudo rm /etc/yum.repos.d/datadog.repo [ ! -f /etc/apt/sources.list.d/datadog.list ] &&  echo 'deb https://apt.datadoghq.com/ stable main' | sudo tee /etc/apt/sources.list.d/datadog.list
    sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 382E94DE
  3. Update apt and downgrade the Agent

    sudo apt-get update
    sudo apt-get remove datadog-agent
    sudo apt-get install datadog-agent

Uninstall the Agent

To uninstall the Agent, run:

  • For CentOS 5:

    $ sudo yum remove datadog-agent-base
    
  • For CentOS 6:

    $ sudo yum remove datadog-agent
    

Further Reading