How to Switch Between the Current Metrics Agent and the New Metrics Agent

In preparation for the deprecation of our initial metrics agent, DigitalOcean has released a beta metrics agent that uses the Prometheus node_exporter codebase. The new agent makes it easier for users to contribute custom metrics, adds an additional load average plot, supports Fedora 27, allows users to opt out of process name collection, and will be the default agent used by our managed databases and Kubernetes products. Learn more in the metrics agent repo.

To use the new agent during the beta period, you can upgrade Droplets running the current agent. In mid-2019, we plan to fully deprecate the initial metrics agent, at which point you’ll have three months to switch to the new agent. We’ll announce this deprecation in our release notes.

Upgrading to the New Metrics Agent

To upgrade from the current metrics agent to the new metrics agent, log into your Droplet as root or a user with sudo accesss and remove the old agent.

On Debian-based operating systems (like Ubuntu), use apt-get:

sudo apt-get remove -y do-agent

On RHEL-based operating systems (like CentOS and Fedora), use yum:

sudo yum remove -y do-agent

Then install the new metrics agent. You can do this by automatically running the script with curl ... | bash, as below, or you can download the script, inspect it, and run it manually.

curl -sSL https://insights.nyc3.cdn.digitaloceanspaces.com/install.sh | sudo bash

Downgrading to the Current Metrics Agent

To downgrade from the new metrics agent to the current metrics agent, log into your Droplet as root or a user with sudo accesss and remove the new agent.

On Debian-based operating systems (like Ubuntu), use apt-get and remove the repo file in /etc/apt/sources.list.d:

sudo apt-get remove -y do-agent
sudo rm -f /etc/apt/sources.list.d/digitalocean-agent.list

On RHEL-based operating systems (like CentOS and Fedora), use yum and remove the repo file in /etc/yum.repos.d:

sudo yum remove -y do-agent
sudo yum clean all
sudo rm /etc/yum.repos.d/digitalocean-agent.repo

Then install the current metrics agent. You can do this by automatically running the script with curl ... | bash, as below, or you can download the script, inspect it, and run it manually.

curl -sSL https://agent.digitalocean.com/install.sh | sh

Optional Process Name Collection Opt-out

With the new metrics agent, you have the option to opt out of process name collection. We occasionally collect process name data from users and analyze it in aggregate to guide feature prioritization.

First, log into your Droplet as root or as a user with sudo access. The commands you should execute depend on whether your operating system uses systemctl or initctl. To check, you can use commands like command -v systemctl or which systemctl, which will output a path if your system uses systemctl or output nothing if it doesn’t.

On operating systems with systemctl (like Ubuntu 16.04+, Debian, CentOS 7+, and Fedora), you need to add the --no-collector.processes flag to the end of the start command in /etc/systemd/system/do-agent.service. You can edit the file directly, or use the following sed command. Then, you need to restart the agent to put the changes into effect.

# For OSes with systemctl:
# Modify the exec command
sed -i 's%ExecStart=/opt/digitalocean/bin/do-agent%ExecStart=/opt/digitalocean/bin/do-agent --no-collector.processes%' /etc/systemd/system/do-agent.service
# Restart the agent
sudo systemctl daemon-reload
sudo systemctl restart do-agent

On operating systems with initctl (like Ubuntu 14.04, and CentOS 6.9), you need to add the --no-collector.processes flag to the end of the exec command in /etc/init/do-agent.conf. You can edit the file directly, or use the following sed command. Then, you need to restart the agent to put the changes into effect.

# For OSes with initctl:
# Modify the exec command
sed -i 's%exec su -s /bin/sh -c \x27exec \"$0\" \"$@\"\x27 do-agent -- /opt/digitalocean/bin/do-agent --syslog%exec su -s /bin/sh -c \x27exec \"$0\" \"$@\"\x27 do-agent -- /opt/digitalocean/bin/do-agent --syslog --no-collector.processes%' /etc/init/do-agent.conf
# Restart the agent
sudo initctl stop do-agent
sudo initctl reload-configuration
sudo initctl start do-agent