---
title: "Getting Started with the Datadog Agent on Ubuntu Linux"
description: "Be alerted to problems before they get out of control by monitoring your Ubuntu hosts with the Datadog agent!"
canonical: "https://adamtheautomator.com/datadog-agent/"
---

# Getting Started with the Datadog Agent on Ubuntu Linux

> Be alerted to problems before they get out of control by monitoring your Ubuntu hosts with the Datadog agent!

Source: https://adamtheautomator.com/datadog-agent/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Getting Started with the Datadog Agent on Ubuntu Linux](https://adamtheautomator.com/wp-content/uploads/2022/03/Getting-Started-with-the-Datadog-Agent-on-Ubuntu-Linux.jpg)

# Getting Started with the Datadog Agent on Ubuntu Linux

[![](https://secure.gravatar.com/avatar/2beb65fca997135120ed98dc6a2e57dcdf1a7d7d2f5ff687b5d91dc7ccd7a6b5?s=192&d=mm&r=g)Sagar](https://adamtheautomator.com/author/shanky-mendiratta/)31 March 20227 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[DataDog](/tag/datadog/)[Monitoring](/tag/monitoring/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Installing Datadog Agent on Ubuntu Machine](#installing-datadog-agent-on-ubuntu-machine)
*   [Monitoring the Metrics in Datadog dashboard](#monitoring-the-metrics-in-datadog-dashboard)
*   [Creating Monitoring Alerts](#creating-monitoring-alerts)
*   [Integrating Datadog Agent with Third-Party Tools and Services (High-Level Example)](#integrating-datadog-agent-with-third-party-tools-and-services-high-level-example)
*   [Conclusion](#conclusion)

Monitoring is crucial for multi-tier microservices and applications in a data center or cloud infrastructure. One of the most widely used log monitoring tools is [Datadog](https://app.datadoghq.com/) which retrieves logs, events, and metrics from hosts with the Datadog agent.

The Datadog agent is a lightweight software installed on applications hosts that helps push every log, event, trace, and metric produced by your applications and infrastructure using the [Datadog APIs](https://docs.datadoghq.com/api/latest/).

In this tutorial, you’ll learn how to install the Datadog agent on Ubuntu, monitor the host from your Datadog account online, and create a sample criteria-based monitoring alert.

## Prerequisites

This post will be a step-by-step tutorial. To follow along, be sure you have the following:

*   You’ll need a computer running at least Ubuntu 14.04.4 LTS. This tutorial uses [Ubuntu 20.04.4 LTS](https://lists.ubuntu.com/archives/ubuntu-announce/2022-February/000277.html).

Related:[How to Install Ubuntu 20.04 \[Step-by-Step\]](https://adamtheautomator.com/install-ubuntu/)

*   You must have installed an Ansible instance on your Ubuntu computer.

Related:[How to Setup Ansible (Ubuntu, RHEL, CentOS, macOS)](https://adamtheautomator.com/install-ansible/)

*   You’ll need a [Datadog account](https://www.datadoghq.com/) and [API key](https://app.datadoghq.com/organization-settings/api-keys).

> _When you register for a Datadog account, your new account will automatically have a new API key._

## Installing Datadog Agent on Ubuntu Machine

Before installing Datadog Agent on Ubuntu, you should first run through a few prerequisite tasks to ensure the installation goes smoothly.

To get started, open your favorite SSH client, connect to an Ubuntu machine and follow along.

Related:[A Windows Guy in a Linux World: Setting up SSH in Linux](https://adamtheautomator.com/ssh-command-in-linux/)

1.  First, [update your Ubuntu package repository list](https://www.cyberciti.biz/faq/what-does-sudo-apt-get-update-command-do-on-ubuntu-debian/) by running the [`apt update`](https://www.cyberciti.biz/faq/what-does-sudo-apt-get-update-command-do-on-ubuntu-debian/) command.

```bash
sudo apt update -y
```

Related:[Learning Ubuntu Apt Get Through Examples](https://adamtheautomator.com/ubuntu-apt-get/)

2\. Now, run the [`apt install`](https://vitux.com/how-to-use-apt-to-install-programs-from-command-line-in-debian/) to install the Datadog agent dependency packages [transport-https](http://manpages.ubuntu.com/manpages/bionic/man1/apt-transport-https.1.html) and [curl](http://manpages.ubuntu.com/manpages/trusty/man1/curl.1.html). You’ll need these packages to download the required Datadog agent packages later.

```bash
# Installing the transport-https and curl package on each ubuntu system
sudo apt-get install -y apt-transport-https curl gnupg
```

![Installing the transport-https, curl, and GnuPG packages on each ubuntu system](https://adamtheautomator.com/wp-content/uploads/2022/03/image-513.png)

Installing the transport-https, curl, and GnuPG packages on each ubuntu system

3\. Next, configure and set up the Datadog repository by creating a Datadog archive keyring. Afterward, run `curl` to download and add the required GPG security key with `apt-key` to authenticate to the Datadog package repository later.

```powershell
# Setting up the Datadog repository and creating the archive keyring
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

# Adding the Datadog GPG Key on each ubuntu system
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_382E94DE.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
```

![Configuring and setting up the Datadog repository](https://adamtheautomator.com/wp-content/uploads/2022/03/image-514.png)

Configuring and setting up the Datadog repository

4\. Again run the [`sudo apt update`](https://www.cyberciti.biz/faq/what-does-sudo-apt-get-update-command-do-on-ubuntu-debian/) command to force `apt` to read the new package repository list and ensure all of the latest packages are available for installation.

5\. Now, run the command below to `install` the Datadog agent package on your Ubuntu machine.

```powershell
sudo apt-get install datadog-agent datadog-signing-keys
```

![Installing the Datadog agent package on an ubuntu machine](https://adamtheautomator.com/wp-content/uploads/2022/03/image-515.png)

Installing the Datadog agent package on an ubuntu machine

6\. Further, configure the Datadog main configuration file (`datadog.yaml`), which came with the Datadog agent installation.

The `datadog.yaml` file allows you to connect and associate your host’s data to the Datadog site using the [Datadog API key](https://app.datadoghq.com/organization-settings/api-keys). The below command adds your Datadog API key to `datadog.yaml`. Before running the below command, make sure to replace `<API-KEY>` with your 32-character Datadog API key value.

> _The API keys will be different for every Datadog account, so make sure to replace this tutorial API Keys with yours._

```powershell
sudo sh -c "sed 's/api_key:.*/api_key: <API-KEY>/' /etc/datadog-agent/datadog.yaml.example > /etc/datadog-agent/datadog.yaml"
sudo sh -c "sed -i 's/# site:.*/site: datadoghq.com/' /etc/datadog-agent/datadog.yaml"
sudo sh -c "chown dd-agent:dd-agent /etc/datadog-agent/datadog.yaml && chmod 640 /etc/datadog-agent/datadog.yaml"
```

7\. Finally, start the Datadog agent with the below command on your ubuntu machine.

```powershell
sudo systemctl start datadog-agent.service
```

![Starting the Datadog agent service on ubuntu service ](https://adamtheautomator.com/wp-content/uploads/2022/03/image-516.png)

Starting the Datadog agent service on ubuntu service

To verify if the Datadog agent has started, run the below `datadog-agent` command.

```powershell
sudo datadog-agent status
```

![Verifying the Datadog agent on ubuntu service](https://adamtheautomator.com/wp-content/uploads/2022/03/image-517.png)

Verifying the Datadog agent on ubuntu service

## Monitoring the Metrics in Datadog dashboard

You’ve successfully installed the Datadog agent on an Ubuntu machine. What next? There are many things you can do in the Datadog dashboard, such as monitoring the metrics of your machine where you recently installed the agent, configuring the metrics, and creating a real-time monitoring dashboard.

But in this section, you’ll first learn to monitor your Ubuntu machine’s metrics quickly. Assuming you have Datadog’s website opened.

1\. First, open a web browser, navigate to the **[Datadog website](https://app.datadoghq.com/)**, and log in with your account.

2\. Click **Metrics ➔ Explorer** on the sidebar, which will open the _**Metrics Explorer**_. On the **Metrics Explorer**, click inside the **Graph** and click **datadog.agent.running.**

As you can see in the below image, Datadog metrics showed that the agent has been running for the last 4 hours.

![Monitoring the status of the Datadog agent on the Datadog website](https://adamtheautomator.com/wp-content/uploads/2022/03/image-12.gif)

Monitoring the status of the Datadog agent on the Datadog website

3\. To check the summary of all metrics of the Ubuntu machine where you previously installed the agent, click **Metrics → Summary** on the sidebar.

As you can see, the below snapshot shows various metrics such as:

> `datadog.dogstatsd.client.metric_dropped_on_receive`
> 
> `datadog.dogstatsd.client.packets_sent`
> 
> `datadog.trace_agent.cpu_percent`

Click each metric to drill down each metric’s data.

![Summary of all metrics of the Ubuntu machine on Datadog website](https://adamtheautomator.com/wp-content/uploads/2022/03/image-13.gif)

Summary of all metrics of the Ubuntu machine on Datadog website

4\. Finally, navigate to the **Infrastructure** section from the sidebar. On the **Infrastructure** page, you’ll find all the information regarding your host’s infrastructure, including running processes, installed software, memory consumption, and so much more.

For example, the screenshot below shows the `grafana-server` server process running on the host and its memory and disk consumption.

![Checking the host metrics using Datadog](https://adamtheautomator.com/wp-content/uploads/2022/03/image-518.png)

Checking the host metrics using Datadog

## Creating Monitoring Alerts

Nowadays, monitoring alerts is crucial for any organization running applications or microservices. Suppose you’ve decided to spin up some new Linux VMs or Kubernetes cluster host, and if any of your nodes go offline or if the CPU spikes, then you need a way to notify your team.

But, in this example, you’ll create a monitoring alert that sends an email notification if any of your Datadog agent hosts are offline.

1\. On the Datadog website, click **Monitors → New Monitor** on the left sidebar.

![Adding a new monitor](https://adamtheautomator.com/wp-content/uploads/2022/03/image-519.png)

Adding a new monitor

2\. Click **Host** as the monitor type.

![Selecting a monitor type](https://adamtheautomator.com/wp-content/uploads/2022/03/image-520.png)

Selecting a monitor type

3\. Select **All Monitored Hosts** from the dropdown box on the **Pick hosts by name or tag** section.

![Selecting the hosts to monitor](https://adamtheautomator.com/wp-content/uploads/2022/03/image-521.png)

Selecting the hosts to monitor

4\. On the **Set alert conditions,** leave the **Check Alert** selection. Doing so means that the monitor tracks if any host stop reporting to Datadog at any time. Leave the other options unchanged.

![Setting the alert conditions](https://adamtheautomator.com/wp-content/uploads/2022/03/image-522.png)

Setting the alert conditions

5\. Under **Notify your team**, select `@all` from the dropdown. This option means to notify every user you [added](https://docs.datadoghq.com/account_management/users/) to your Datadog [organization](https://app.datadoghq.com/organization-settings).

![Selecting the notification target](https://adamtheautomator.com/wp-content/uploads/2022/03/image-523.png)

Selecting the notification target

6\. Under the **Say what’s happening** section, compose the message title as below. This title includes `{{host.name}}` and `{{host.ip}}`, which are the variables for the affected host’s hostname and IP address.

```powershell
Host {{host.name}} with IP {{host.ip}} is down.
```

> _Hover your mouse cursor over the **Use Message Template Variables** link to see every available variable._

![Setting the monitoring alert title](https://adamtheautomator.com/wp-content/uploads/2022/03/image-524.png)

Setting the monitoring alert title

7\. Now, click on the **Test Notifications** button to run a monitoring alert simulation and ensure that the monitor works. Select **Alert** and click **Run Test**.

![Testing the monitoring alert notification](https://adamtheautomator.com/wp-content/uploads/2022/03/image-525.png)

Testing the monitoring alert notification

8\. Now, check your inbox (the email address you registered with your Datadog account), and you should find an email similar to the one below.

![Verifying the Datadog notification email message](https://adamtheautomator.com/wp-content/uploads/2022/03/image-526.png)

Verifying the Datadog notification email message

9\. Finally, go back to the Datadog monitor page and click **Save** to save the new monitoring alert.

![Saving the new host monitoring alert](https://adamtheautomator.com/wp-content/uploads/2022/03/image-527.png)

Saving the new host monitoring alert

And that’s how you create a monitoring alert in Datadog. You can now try creating different monitor types, such as monitoring metrics and audit logs.

## Integrating Datadog Agent with Third-Party Tools and Services (High-Level Example)

So far, you have learned how to check your host’s metrics and create monitors, which is cool, but that’s not the end of Datadog’s awesomeness. If you work with third-party tools like Ansible or Kubernetes, you’ll be glad to know that Datadog can integrate with them and more.

This section shows you an example of how to integrate Datadog with [Amazon EKS](https://docs.aws.amazon.com/whitepapers/latest/overview-deployment-options/amazon-elastic-kubernetes-service.html).

1\. Click **Integrations** on the sidebar and again click on **Integrations**.

![Navigating to Integrations sections to view integrations](https://adamtheautomator.com/wp-content/uploads/2022/03/image-528.png)

Navigating to Integrations sections to view integrations

You should see a couple of available integrations that you can install.

![Viewing all the integrations available for Datadog Site](https://adamtheautomator.com/wp-content/uploads/2022/03/image-529.png)

Viewing all the integrations available for Datadog Site

2\. In this example, install the Amazon EKS Integration with Datadog to manage the Kubernetes service on AWS Cloud.

Related:[Creating your First EKS Cluster with Terraform \[Step-by-Step\]](https://adamtheautomator.com/terraform-eks-module/)

Click on the Integrations → Amazon EKS Integration, which is available for installation.

![Viewing the Amazon EKS Integration Plugin](https://adamtheautomator.com/wp-content/uploads/2022/03/image-530.png)

Viewing the Amazon EKS Integration Plugin

3\. When you see the option to install the plugin, as shown below, click **Install**.

![Installing the Amazon EKS Integration Plugin on the Datadog website ](https://adamtheautomator.com/wp-content/uploads/2022/03/image-531.png)

Installing the Amazon EKS Integration Plugin on the Datadog website

After you install the plugin, you will see a list of all the configuration steps you can perform so that Datadog can monitor your Kubernetes and its related components.

![Viewing the Amazon EKS Integration ](https://adamtheautomator.com/wp-content/uploads/2022/03/image-532.png)

Viewing the Amazon EKS Integration

> _If you want to list all the configuration steps to configure EKS and Kubernetes on Datadog, you can [find them here](https://app.datadoghq.com/account/settings#integrations/eks-anywhere)._

## Conclusion

In this tutorial, you’ve learned how to set up a Datadog agent and monitor the data stored in the Datadog agent host. You also learned to monitor the metrics in various visualizations in different panels within the Datadog Dashboard.

You now have a fully functional Datadog Dashboard and agent installed in your machine. So go wild and test out everything you can with the Datadog agent.

After all, you have 14 days to use Datadog for free before. Perhaps by then, you can decide whether upgrading to a paid Datadog account is worth the investment. Good luck!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fdatadog-agent%2F&text=Getting%20Started%20with%20the%20Datadog%20Agent%20on%20Ubuntu%20Linux)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fdatadog-agent%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fdatadog-agent%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2023/01/pandora-fms.jpg)

### [Discover Proactive Linux Monitoring with Pandora FMS](/pandora-fms/)

Learn about how Pandora FMS is a powerful Linux monitoring tool that helps admins stay ahead of problems, identify trends, and optimize system performance.

![](https://adamtheautomator.com/wp-content/uploads/2022/04/Getting-Started-with-Grafana-Prometheus-Kubernetes-Cluster-Monitoring-1.jpg)

### [Utilizing Grafana & Prometheus Kubernetes Cluster Monitoring](/prometheus-kubernetes/)

Learn how to effectively monitor your Grafana and Prometheus Kubernetes cluster in this tutorial!

![](https://adamtheautomator.com/wp-content/uploads/2022/04/Deploying-an-EFK-Stack-with-Docker.jpg)

### [Deploying an EFK Stack with Docker](/efk-stack/)

Learn how to deploy the EFK stack, one of the most popular software stacks for log analysis and monitoring, in this step-by-step tutorial!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
