---
title: How to Install the DigitalOcean Metrics Agent Using the Metrics Agent Repository
description: Install the DigitalOcean metrics agent from its package repository to enable enhanced Droplet metrics in DigitalOcean Insights.
product: Insights
url: https://docs.digitalocean.com/products/insights/how-to/install-metrics-agent-repository/
last_updated: "2026-11-23"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Install the DigitalOcean Metrics Agent Using the Metrics Agent Repository

DigitalOcean Insights provides metrics, logs, traces, dashboards, and alerts to help you monitor, analyze, and troubleshoot supported DigitalOcean resources.

You can install the DigitalOcean metrics agent to collect enhanced Droplet metrics in Insights by manually configuring its package repository instead of using the [automated installation script](https://docs.digitalocean.com/products/insights/how-to/install-metrics-agent/index.html.md). This gives you more control over your package sources and repository configuration.

**Note**:

  The DigitalOcean metrics agent collects and sends system telemetry data for monitoring and alerts. It does not collect or transmit Customer Content. After you uninstall the agent, we keep historical data for 90 days, and then delete it.

  GPU Droplets have the metrics agent selected by default. To remove it, see [How to Uninstall the DigitalOcean Metrics Agent](https://docs.digitalocean.com/products/insights/how-to/uninstall-metrics-agent/index.html.md).

To install the metrics agent from the repository, go to the [**Droplets**](https://cloud.digitalocean.com/droplets?utm_source=docs-agent&utm_medium=md) page in the DigitalOcean Control Panel.

Then, find and select the Droplet you want to add the metrics agent to, and then in the top-right, click **Web Console** to open a terminal session.

## Check Your Droplet’s Operating System

The package manager you use to install the metrics agent depends on your operating system. For example, Ubuntu and Debian use `apt`, while CentOS and Fedora use `yum`. Each package manager uses its own repository format and setup process.

To check your Droplet’s operating system, run the following command:

```shell
cat /etc/os-release
```

For example, if your Droplet uses Ubuntu, you should see output similar to this:

```text
...
PRETTY_NAME="Ubuntu 22.04.4 LTS"
VERSION_ID="22.04"
```

## Install the Metrics Agent on Ubuntu or Debian

To install the metrics agent on Ubuntu or Debian, add the DigitalOcean APT repository, add the GPG key, update your package list, and install the `do-agent` package.

### Install Metrics Agent Repository

To add the metrics agent repository, create a new file in a text editor (such as `nano`), and then define the DigitalOcean repository source:

```shell
sudo nano /etc/apt/sources.list.d/digitalocean-agent.list
```

Then, add the following line to add the DigitalOcean APT repository to your package sources so your system can find the `do-agent` package:

```text
deb https://repos.insights.digitalocean.com/apt/do-agent/ main main
```

Press `CTRL+O` to save, and then press `ENTER` to confirm. Press `CTRL+X` to exit `nano`.

After you create the configuration file, download and add the DigitalOcean GPG key for the repository. This lets your system verify that the packages are authentic:

```shell
curl https://repos.insights.digitalocean.com/sonar-agent.asc | sudo apt-key add -
```

The command returns output confirming the key was added:

```text
| sudo apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1688  100  1688    0     0  34163      0 --:--:-- --:--:-- --:--:-- 34448
...
```

To confirm that the GPG key is installed, run the following command and check that the key appears in the list:

```shell
sudo apt-key list | grep -i digitalocean
```

If you see output similar to the following, the GPG key is installed on your Droplet:

```text
uid           [ unknown] DigitalOcean Insights Engineering <sonar-agent@digitalocean.com>
```

Update your system’s package list to include the DigitalOcean repository and its available packages:

```shell
sudo apt-get update
```

The update is successful if the output confirms a connection to the repositories like this:

**Note**:

  If you see warnings about duplicate entries, the same repository is listed more than once. You can ignore these warnings as long as your `.list` file contains the correct entry and does not include duplicates.

```text
Hit:1 http://mirrors.digitalocean.com/ubuntu oracular InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu oracular-updates InRelease
Hit:3 https://repos.insights.digitalocean.com/apt/do-agent main InRelease
...
Reading package lists... Done
W: Target Packages (main/binary-amd64/Packages) is configured multiple times ...
...
```

### Install Metrics Agent

Install the metrics agent by installing the `do-agent` package from the DigitalOcean repository with your system’s package manager:

```shell
sudo apt-get install do-agent
```

The command returns output confirming the agent was successfully downloaded, installed, and enabled to start automatically using `systemd` like below:

```text
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  do-agent
...
Setting up do-agent (3.17.1) ...
enable systemd service
Created symlink '/etc/systemd/system/multi-user.target.wants/do-agent.service' → '/etc/systemd/system/do-agent.service'.
...
```

## Install the Metrics Agent on CentOS or Fedora

To install the metrics agent on CentOS or Fedora, add the DigitalOcean YUM repository, verify the GPG key, and install the `do-agent` package.

### Install Metrics Agent Repository

To add the metrics agent repository, open a new `.repo` file in a text editor (such as `nano`), and then define the DigitalOcean package repository:

```shell
sudo nano /etc/yum.repos.d/digitalocean-agent.repo
```

Then, add the following contents to the file to define the repository configuration like this:

```text
[sonar]
name=do agent
baseurl=https://repos.insights.digitalocean.com/yum/do-agent/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=https://repos.insights.digitalocean.com/sonar-agent.asc
```

This configuration block defines the DigitalOcean repository:

- `baseurl`: URL where your system downloads the package.
- `gpgcheck=1`: verifies the package signature.
- `gpgkey`: location of the key used for verification.

Then, press `CTRL+O` to save, press `ENTER` to confirm the filename, and then press `CTRL+X` to exit `nano`.

After you add the repository, download and add the DigitalOcean GPG key so your system can verify that the package is trusted and hasn’t been changed:

```shell
sudo rpm --import https://repos.insights.digitalocean.com/sonar-agent.asc
```

This command produces no output if it succeeds. To confirm that the key was added, run the following command to list the installed GPG keys and filter for the DigitalOcean key:

```shell
rpm -qa gpg-pubkey --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" | xargs -I{} rpm -qi {} | grep -i digitalocean
```

The key was added successfully if the command output confirms that the DigitalOcean GPG key is present on your system.

```text
Summary     : DigitalOcean Agent Signing Key
```

### Install Metrics Agent

Install the metrics agent by installing the `do-agent` package from the DigitalOcean repository with your system’s package manager:

```shell
sudo yum install do-agent
```

The installation prompt appears if the system is ready to install the `do-agent` package and shows the package size and source. When prompted with `Is this ok [y/N]:`, type `y`, and then press `ENTER` to continue.

```text
Package        Arch    Version    Repository    Size
Installing:
 do-agent      x86_64  3.17.1-1   sonar         12.5 MiB
...
Transaction Summary:
 Installing: 1 package
...
Is this ok [y/N]:
```

After you confirm the installation, the system completes the remaining steps. The output shows that it installs the agent and prepares it to run like this:

```text
[1/1] do-agent-0:3.17.1-1.x86_64                                 100% |  44.6 MiB/s |   4.8 MiB |  00m00s
...
[3/3] Installing do-agent-0:3.17.1-1.x86_64                      100% |   2.3 MiB/s |  12.5 MiB |  00m05s
Complete!
```

## Verify Metrics Agent Installed

To check whether the `do-agent` systemd service is active, run the following command:

```shell
systemctl status do-agent
```

If the metrics agent is active, the output confirms that it’s installed, running, and set to start automatically on boot:

```text
● do-agent.service - The DigitalOcean Monitoring Agent
     Loaded: loaded (/etc/systemd/system/do-agent.service; enabled; ...)
     Active: active (running) since Wed 2025-06-18 19:14:50 UTC; 35s ago
...
   Main PID: 4675 (do-agent)
...
             └─4675 /opt/digitalocean/bin/do-agent --syslog
```

Then, check whether the agent process is running by searching for processes with the name `do-agent`:

```shell
ps aux | grep do-agent
```

If the metrics agent is running, the output includes a line that shows `do-agent` is running as a background process like this:

```text
do-agent    4675  0.0  0.3 ... ?  Ssl  19:14   0:00 /opt/digitalocean/bin/do-agent --syslog
root        4733  0.0  0.0 ... pts/0  S+  19:15   0:00 grep --color=auto do-agent
```

To see your Droplet’s metrics, exit your Droplet’s terminal session, and then click its **Insights** tab. Metrics appear a few minutes after the metrics agent starts reporting data.

If the service isn’t running or these commands return no output, [contact support](https://cloudsupport.digitalocean.com) for help troubleshooting the installation.