Table of Contents
  • Home
  • /
  • Blog
  • /
  • Installing DataDog Agent on Debian, Ubuntu, and Kali Linux Distributions
July 15, 2024
|
7m

Installing DataDog Agent on Debian, Ubuntu, and Kali Linux Distributions


DataDog Agent Installation Guide for Debian

Welcome to this step-by-step tutorial on installing the DataDog Agent on Debian-based Linux distributions. Whether you're new to system monitoring or looking to enhance your current setup, DataDog offers a powerful solution for tracking your infrastructure's performance. This guide will walk you through the installation process, from prerequisites to managing the agent post-installation. We'll cover everything in a clear, concise manner, ensuring you can set up DataDog efficiently on your Debian-based system. Let's dive in and get your monitoring solution up and running!

What is DataDog Agent and Why You Need It

The DataDog Agent is a lightweight, open-source software that collects and reports system metrics, logs, and traces from your hosts. It's designed to work seamlessly with the DataDog platform, providing real-time insights into your infrastructure's performance, application behavior, and overall system health.

Key functions of the DataDog Agent include:

  1. Collecting system metrics (CPU, memory, disk usage)

  2. Gathering application logs

  3. Tracing requests across services

  4. Monitoring container environments

  5. Integrating with various technologies and services

By installing the DataDog Agent, you gain comprehensive visibility into your systems, allowing for proactive management and quick issue resolution.

Prerequisites for Installing DataDog Agent

Before you begin the installation process, ensure you have the following:

  1. A Debian-based Linux distribution (e.g., Ubuntu, Debian)

  2. Root or sudo access to your system

  3. A DataDog account (You can sign up here if you don't have one)

  4. Your DataDog API key (found in your DataDog account settings)

With these prerequisites in place, you're ready to install the DataDog Agent on your system.

Step-by-Step Guide to Install DataDog Agent on Debian Linux Distributions

It is very simple, straightforward, and very quick procedure to install DataDog Agent on a Debian, Ubuntu, or Kali Linux distributions.

There are two primary methods to install the DataDog Agent on your Debian-based Linux distribution:

  1. Script Installation

  2. Manual Installation

Method 1: Script Installation (Recommended)

This method uses a script provided by DataDog for a quick and easy installation:

  1. Open a terminal on your Debian-based system.

  2. Run the following command, replacing YOUR_API_KEY with your actual DataDog API key: This command will:

DD_API_KEY=YOUR_API_KEY DD_SITE="datadoghq.eu" bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"

Download and execute the installation script

* Install the DataDog Agent using APT packages

* Configure the agent with your API key

* Set the DataDog site to the EU region (change to "datadoghq.com" if you're using the US region)

3. The script will prompt you for your password to perform sudo operations.

4. Once the installation is complete, the DataDog Agent will start automatically.

This method is straightforward and handles most of the configuration for you. If you prefer more control over the installation process or need to customize certain aspects, consider Method 2.

Method 2: Manual Installation

If you prefer a more hands-on approach or need to customize your installation, follow these steps:

  1. Update your system and install required packages:

sudo apt-get update
sudo apt-get install apt-transport-https curl gnupg

2. Set up the DataDog repository:

sudo sh -c "echo 'deb [signed-by=/usr/share/keyrings/datadog-archive-keyring.gpg] https://apt.datadoghq.com/ stable 7' > /etc/apt/sources.list.d/datadog.list"
sudo touch /usr/share/keyrings/datadog-archive-keyring.gpg
sudo chmod a+r /usr/share/keyrings/datadog-archive-keyring.gpg

3. Import DataDog's APT keys:

curl https://keys.datadoghq.com/DATADOG_APT_KEY_CURRENT.public | sudo gpg --no-default-keyring --keyring /usr/share/keyrings/datadog-archive-keyring.gpg --import --batch
curl https://keys.datadoghq.com/DATADOG_APT_KEY_C0962C7D.public | sudo gpg --no-default-keyring --keyring /usr/share/keyrings/datadog-archive-keyring.gpg --import --batch
curl https://keys.datadoghq.com/DATADOG_APT_KEY_F14F620E.public | sudo gpg --no-default-keyring --keyring /usr/share/keyrings/datadog-archive-keyring.gpg --import --batch
curl https://keys.datadoghq.com/DATADOG_APT_KEY_382E94DE.public | sudo gpg --no-default-keyring --keyring /usr/share/keyrings/datadog-archive-keyring.gpg --import --batch

4. Update your local APT repository and install the DataDog Agent:

sudo apt-get update
sudo apt-get install datadog-agent datadog-signing-keys

5. Configure your DataDog API key: Replace YOUR_API_KEY with your actual DataDog 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"

6. Set your DataDog region: If you're using the EU region, run:

sudo sh -c "sed -i 's/# site:.*/site: datadoghq.eu/' /etc/datadog-agent/datadog.yaml"

7. Set correct permissions:

sudo sh -c "chown dd-agent:dd-agent /etc/datadog-agent/datadog.yaml && chmod 640 /etc/datadog-agent/datadog.yaml"

8. Start the DataDog Agent: For Ubuntu 16.04 and higher:

sudo systemctl restart datadog-agent.service

That's it! You've successfully installed the DataDog Agent on your Debian-based Linux system.

Managing the DataDog Agent

After installation, you can manage the DataDog Agent using both the command-line interface (CLI) and the graphical user interface (GUI).

Using the Command-Line Interface (CLI)

Check Agent Status:

sudo datadog-agent status
or
sudo /opt/datadog-agent/bin/agent/agent status

Start the Agent:

sudo datadog-agent start
or
sudo /opt/datadog-agent/bin/agent/agent start
or
sudo service datadog-agent start

Stop the Agent:

sudo datadog-agent stop
or
sudo /opt/datadog-agent/bin/agent/agent stop
or
sudo service datadog-agent stop

Using the Graphical User Interface (GUI)

At the time of publishing this tutorial post, Datadog Agent does not provide a native GUI (Graphical User Interface) for its Linux version. The Datadog Agent is primarily configured and managed via command-line interface (CLI) tools and configuration files on Linux systems.

Uninstalling the DataDog Agent

If you need to remove the DataDog Agent from your Debian-based Linux system, follow these steps:

For Agent v6 & v7

  1. To remove the agent while keeping configuration files and user-created content:

sudo apt-get remove datadog-agent -y

This command removes the Agent but retains:

* The datadog.yaml configuration file

* User-created files in the /etc/datadog-agent configuration folder

* User-created files in the /opt/datadog-agent folder

* The dd-agent user

1. For a complete removal, including configuration files and user-created content:

sudo apt-get remove --purge datadog-agent -y

This command removes everything associated with the DataDog Agent.

Basic DataDog Agent Commands for Beginners on Linux

As you start using the DataDog Agent on your Linux system, it's helpful to familiarize yourself with some basic commands. These commands will allow you to interact with the Agent, check its status, and perform basic operations. Here are some essential commands to get you started:

  1. Check Agent Status To see if the Agent is running and get an overview of its status:

sudo datadog-agent status

This command provides information about the Agent's health, running checks, and any potential issues.

2. Start/Stop the Agent To start/stop/restart the Agent:

sudo systemctl start datadog-agent
sudo systemctl stop datadog-agent
sudo systemctl restart datadog-agent

3. Run a Flare If you're experiencing issues and need to send information to DataDog support:

sudo datadog-agent flare

This command collects troubleshooting information into a zip file.

4. View Agent Logs To check the Agent's logs for troubleshooting:

sudo less /var/log/datadog/agent.log

Use the arrow keys to navigate and press 'q' to exit.

5. Check Agent Version To see which version of the Agent you're running:

datadog-agent version

6. List Integrations To see which integrations are currently configured:

sudo datadog-agent integration list

7. Manually Run a Check To manually run a specific integration check:

sudo -u dd-agent datadog-agent check <integration_name>

Replace <integration_name> with the name of the integration you want to check.

8. Access the Agent's Configuration File To view or edit the main configuration file:

sudo nano /etc/datadog-agent/datadog.yaml

Remember to restart the Agent after making changes to the configuration.

9. Help Command The most fundamental command for any beginner is the help command:

datadog-agent help

This command lists all available subcommands. You can also get help on specific subcommands:

datadog-agent <subcommand> help

For example:

datadog-agent status help

This will provide detailed information about the 'status' subcommand and its options.

Remember, when you're unsure about any command or its options, the help command is your go-to resource for quick, accessible information directly from the Agent itself.

Note: On some Linux distributions, you might need to use sudo before these commands to run them with the necessary permissions.

By following this guide, you've successfully installed, managed, and learned how to uninstall the DataDog Agent on your Linux distribution. Remember to check the official DataDog documentation for the most up-to-date information and advanced configurations.

Please keep visiting thesecmaster.com for more such technical information. Visit our social media page on FacebookInstagram,  LinkedInTwitterTelegramTumblr, & Medium and subscribe to receive information like this. 

You may also like these articles:

Arun KL

Arun KL is a cybersecurity professional with 15+ years of experience in IT infrastructure, cloud security, vulnerability management, Penetration Testing, security operations, and incident response. He is adept at designing and implementing robust security solutions to safeguard systems and data. Arun holds multiple industry certifications including CCNA, CCNA Security, RHCE, CEH, and AWS Security.

Recently added

Tutorials

View All

Learn More About Cyber Security Security & Technology

“Knowledge Arsenal: Empowering Your Security Journey through Continuous Learning”

Cybersecurity All-in-One For Dummies - 1st Edition

"Cybersecurity All-in-One For Dummies" offers a comprehensive guide to securing personal and business digital assets from cyber threats, with actionable insights from industry experts.

Tools

Featured

View All

Learn Something New with Free Email subscription

Subscribe

Subscribe