How to Install the DigitalOcean Metrics Agent Using the Metrics Agent Repository
Validated on 3 Jul 2025 • Last edited on 14 Jul 2025
DigitalOcean Monitoring is a free, opt-in service that lets you track Droplet resource usage in real time, visualize performance metrics, and receive alerts via email or Slack to proactively manage your infrastructure’s health.
You can install the metrics agent by manually configuring the DigitalOcean package repository instead of using the automated installation script. Use this option for more control over your system’s package sources or to audit and manage repository configuration directly.
Check Which Operating System Your Droplet Uses
The package manager used to install the metrics agent repository depends on your operating system. For example, Ubuntu and Debian use apt
, while CentOS and Fedora use yum
. Each package manager requires its own repository format and configuration process.
To check which operating system your Droplet is running, use the following command:
cat /etc/os-release
For example, if your Droplet is uses Ubuntu, you should see output similar to this:
NAME="Ubuntu"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 22.04.4 LTS"
VERSION_ID="22.04"
Install Metrics Agent Repository
Installing the DigitalOcean metrics agent repository depends on your operating system. After you check which operating system your Droplet uses, follow the steps for your system to add the repository, verify the GPG key, and install the do-agent
package.
To add the metrics agent repository, open a new file using a text editor of your choice (for example, nano
) to define the DigitalOcean repository source:
sudo nano /etc/apt/sources.list.d/digitalocean-agent.list
This command opens a blank file in the nano
editor. Then, add the following line to the file.
deb https://repos.insights.digitalocean.com/apt/do-agent/ main main
This line adds the DigitalOcean APT repository to your package sources so your system can locate the do-agent
package.
Afterwards, save the changes and exit the file.
After creating the configuration file, download and add the DigitalOcean GPG key for the DigitalOcean repository. This verifies the authenticity of the packages you install:
curl https://repos.insights.digitalocean.com/sonar-agent.asc | sudo apt-key add -
The command returns output confirming the key was added:
| 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
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
To confirm that the GPG key is present, run the following command to see if your key is listed:
sudo apt-key list | grep -i digitalocean
If you see similar output like below, then the GPG key is present in your Droplet:
uid [ unknown] DigitalOcean Insights Engineering <[email protected]>
Restart your system’s package list so that it includes the DigitalOcean repository and its available packages:
sudo apt-get update
You should see output confirming a successful connection to the repositories. If you see warnings about duplicate entries, it means the same repository is listed more than once. These warnings are safe to ignore as long as your .list
file contains the correct, non-duplicated entry, which you confirmed earlier.
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 ...
...
Lastly, install the metrics agent by installing the do-agent
package from the DigitalOcean repository using your system’s package manager:
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:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
do-agent
...
Selecting previously unselected package do-agent.
(Reading database ... 76045 files and directories currently installed.)
Preparing to unpack .../do-agent_3.17.1_amd64.deb ...
Unpacking do-agent (3.17.1) ...
Setting up do-agent (3.17.1) ...
Detecting SELinux
SELinux not enforced
useradd: user 'do-agent' already exists
enable systemd service
Created symlink '/etc/systemd/system/multi-user.target.wants/do-agent.service' → '/etc/systemd/system/do-agent.service'.
...
To create the repository configuration file, open a new .repo
file using a text editor of your choice (for example, nano
) where you define the DigitalOcean package repository:
sudo nano /etc/yum.repos.d/digitalocean-agent.repo
This command creates and opens a blank file in the nano
editor. Add the following contents to define the repository configuration, like this:
[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
: where your system fetches the packagegpgcheck=1
: ensures that package signatures is verifiedgpgkey
: location of the key used for verification
After pasting the contents of the config file, save and exit the file.
Then, download and add the DigitalOcean GPG key to ensure that the install package is trusted and not tampered with:
sudo rpm --import https://repos.insights.digitalocean.com/sonar-agent.asc
This command does not produce any output if successful. To confirm the key was added, run the following command, which lists all installed GPG keys and filters for one associated with DigitalOcean, like this:
rpm -qa gpg-pubkey --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" | xargs -I{} rpm -qi {} | grep -i digitalocean
If the key was added successfully, the command outputs a confirmation that the DigitalOcean GPG key is present and trusted by your system:
Summary : DigitalOcean Agent Signing Key
Lastly, install the metrics agent via the do-agent
package from the DigitalOcean repository using your system’s package manager:
sudo yum install do-agent
You should see output showing the system is ready to install the do-agent
package, listing its size and origin. When prompted with Is this ok [y/N]:
, type y
, and then press ENTER
to confirm you want to proceed with the installation.
Updating and loading repositories:
do agent 100% | 105.7 KiB/s | 7.8 KiB | 00m00s
Repositories loaded.
Package Arch Version Repository Size
Installing:
do-agent x86_64 3.17.1-1 sonar 12.5 MiB
Transaction Summary:
Installing: 1 package
Total size of inbound packages is 5 MiB. Need to download 5 MiB.
After this operation, 13 MiB extra will be used (install 13 MiB, remove 0 B).
Is this ok [y/N]:
After you confirm the installation, the system completes the remaining steps. The output shows the agent being installed and prepared to run:
[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!
After installing the metrics agent, verify that it is active and running.
In the DigitalOcean Control Panel, go to your Droplet’s Graphs tab to view its metrics. Data appears a few minutes after the metrics agent is activated and begins reporting.