How to Install the DigitalOcean Metrics Agent

To enable extended metrics and enhanced monitoring features, like metrics-based alerting, you need to install the metrics agent on your Droplet. You can do this automatically when you create a Droplet, or manually after you create a Droplet.

Installing the Metrics Agent During Droplet Creation

To install the metrics agent during Droplet creation, select the Monitoring checkbox in the additional options section of the creation page:

Monitoring checkbox on the creation page

The metrics agent will be automatically installed and enabled during the Droplet creation process.

If you are using the DigitalOcean API to create Droplets, you can set the monitoring attribute to true in the creation parameters to automatically install the metrics agent on the Droplet during creation. The Droplet creation section of the API documentation contains additional details.

Installing the Metrics Agent Manually

You can also install the metrics agent manually. There is an installation script available that automatically detects the client operating system and configures repositories to install the agent. If you are uncomfortable running an installation script, you can set up your repositories manually.

With an Installation Script

An installation script is available to install the metrics agent manually. The script will add a repository to your system and use the native package manager to install the metrics agent. This simplifies package management tasks like upgrading or removing the metrics agent.

Log in to your Droplet as root or as a user with sudo access:

ssh root@203.0.113.0

Once connected, to install and enable the metrics agent immediately, you can download and execute the installation script by typing:

curl -sSL https://repos.insights.digitalocean.com/install.sh | sudo bash

You may be prompted for your password if running as a sudo user.

Note

If you would like to audit the script before installing, you can write it to disk first, then view the contents and run it manually.

curl -sSL https://repos.insights.digitalocean.com/install.sh -o /tmp/install.sh # Save the script
less /tmp/install.sh # View the contents
sudo bash /tmp/install.sh # Run the script manually

The agent should now be installed and running.

Configuring Repositories Manually

You can also add the repositories and install the package manually if you prefer.

Ubuntu and Debian

To add the metrics agent repository, create and open a file in the /etc/apt/sources.list.d directory with sudo privileges:

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

Inside, add the following line:

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

Save and close the file.

Next, add the DigitalOcean key to apt by typing:

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

Now you can update the repository package index and install the Agent by typing:

sudo apt-get update
sudo apt-get install do-agent

The agent should now be installed and running.

CentOS and Fedora

On CentOS or Fedora, create and open a repository definition file with sudo privileges:

sudo vi /etc/yum.repos.d/digitalocean-agent.repo

Inside, paste the following configuration:

  
    
[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

  

Import the DigitalOcean key by typing:

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

Now, you can install the metrics agent by typing:

sudo yum install do-agent

The agent should now be installed and running.

View the Enhanced Graphs

Once the metrics agent is enabled, click the Droplet’s name, which takes you to the Graphs section of your Droplet’s detail page. The extended metrics will be available once the metrics agent checks in and the initial data points are processed, which may take a few minutes.

The times displayed in the graphs are in your local time zone, determined by your browser. Use the drop-down menu to adjust the time window displayed and mouse over the graphs to view detailed information.

Droplet extended metric graphs