---
title: How to Install the DigitalOcean Metrics Agent
description: Install the DigitalOcean metrics agent to enable enhanced Droplet metrics and resource alerts in DigitalOcean Insights.
product: Insights
url: https://docs.digitalocean.com/products/insights/how-to/install-metrics-agent/
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

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

You can install the metrics agent by running the automated installation script. The script detects your operating system, adds the correct DigitalOcean package repository, installs the `do-agent` package, and then enables the service automatically.

**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).

If you don’t want to use the installation script, you can [install the agent manually with the metrics agent repository](https://docs.digitalocean.com/products/insights/how-to/install-metrics-agent-repository/index.html.md).

## Enable Metrics Agent During Droplet Creation

To enable monitoring when you [create a Droplet](https://docs.digitalocean.com/products/droplets/how-to/create/index.html.md#networking-monitoring-and-additional-options) under the **Monitoring** section, click the **Improved Metrics and monitoring (Free)** option.

When you [create a GPU Droplet](https://docs.digitalocean.com/products/droplets/how-to/gpu/create/index.html.md) using an **AI/ML Ready** image, under the **Monitoring** section, select **Improved Metrics and monitoring (Free)** to automatically enable GPU Observability in Insights. The DigitalOcean metrics agent (`do-agent`) collects GPU metrics such as utilization, temperature, power, and throttling. For GPU Droplets created with standard operating system images, such as Ubuntu or Debian, you can enable GPU metrics by [manually installing the exporter](https://docs.digitalocean.com/products/droplets/how-to/gpu/enable-metrics/index.html.md), binding it to `127.0.0.1`, reconfiguring `do-agent` to scrape it, and restarting `do-agent`.

**Note**:

  For GPU Droplets created with standard operating system images, such as Ubuntu or Debian, you must manually install and configure the appropriate GPU metrics exporter and metrics agent.

## Install Metrics Agent Using Script

The installation script detects your operating system, configures the correct DigitalOcean package repository, installs the `do-agent` package with your system’s package manager, and then enables the service automatically.

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

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

You can either [run the script directly](#download-run) or [review it before executing](#download-inspect-run).

### Download and Run Script

To download and immediately run the installation script, run the following command:

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

After you run the command, the script verifies compatibility, installs system dependencies, adds the required package repositories, and then installs the metrics agent. The script returns output similar to the following:

```text
Cleaning up old sources...OK
Verifying machine compatibility...OK
...
Installing apt repository...
Installing gpg key...
...
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'.
...
```

After installation, [verify that the agent is running](#verify).

### Download, Inspect, and Run Script

Before you download and run the installation script, you can review it to audit the changes it makes to your system. This is useful in production environments or when your security policies require script review.

To review the script, save the script to `/tmp/install.sh` like this:

```shell
curl -sSL https://repos.insights.digitalocean.com/install.sh -o /tmp/install.sh
```

This command produces no output. To confirm that the file downloaded successfully, run the following command to check that it exists and has content:

```shell
ls -lh /tmp/install.sh
```

If the download was successful, the command returns output similar to this and shows that the file exists at `/tmp/install.sh`:

```text
-rw-r--r-- 1 root root 7.2K ... /tmp/install.sh
```

Then, run a `less` command to review the script contents:

```shell
less /tmp/install.sh
```

Then, type `q` to exit the viewer. To install the metrics agent, run the script manually with administrative privileges, completing the installation:

```shell
sudo bash /tmp/install.sh
```

The output confirms that the script verified compatibility, installed the `do-agent` package, and enabled the agent service to start on boot, like this:

```text
Cleaning up old sources...OK
Verifying machine compatibility...OK
...
Installing apt repository...
Installing gpg key...
...
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'.
...
```

After installation, [verify that the agent is running](#verify).

### 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.

## Enable Metrics Agent Using Automation

You can enable the metrics agent when creating a Droplet using the DigitalOcean CLI or API.

### Enable Metrics Agent via the CLI

To enable the metrics agent using the CLI, add the `--enable-monitoring` flag when [creating a Droplet using the CLI](https://docs.digitalocean.com/products/droplets/how-to/create/index.html.md#create-a-droplet-using-the-cli).

## How to Enable the Metrics Agent Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl compute droplet create`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/compute/droplet/create/index.html.md) for more details:

   ```shell
   doctl compute droplet create <droplet-name>... [flags]
   ```

   The following example creates a Droplet named `example-droplet` with a two vCPUs, two GiB of RAM, and 20 GBs of disk space. The Droplet is created in the `nyc1` region and is based on the `ubuntu-20-04-x64` image. Additionally, the command uses the `--user-data` flag to run a Bash script the first time the Droplet boots up:

   ```shell
   doctl compute droplet create example-droplet --size s-2vcpu-2gb --image ubuntu-20-04-x64 --region nyc1 --user-data $'#!/bin/bash\n touch /root/example.txt; sudo apt update;sudo snap install doctl'
   ```

   Please note: In Windows Powershell, the example command would be the following instead:

   ```shell
   doctl compute droplet create example-droplet --size s-2vcpu-2gb --image ubuntu-20-04-x64 --region nyc1  --user-data "#!/bin/bash`n touch /root/example.txt; sudo apt update;sudo snap install doctl"
   ```

### Enable Metrics Agent via the API

To enable the metrics agent using the API, set the `monitoring` parameter to `true` when [creating a Droplet using the API](https://docs.digitalocean.com/products/droplets/how-to/create/index.html.md#create-a-droplet-using-the-api).

## How to Enable the Metrics Agent Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a POST request to [`https://api.digitalocean.com/v2/droplets`](https://docs.digitalocean.com/reference/api/reference/droplets/index.html.md#droplets_create).

Using cURL:

```shell
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"name":"example.com","region":"nyc3","size":"s-1vcpu-1gb","image":"ubuntu-20-04-x64","ssh_keys":[289794,"3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"],"backups":true,"ipv6":true,"monitoring":true,"tags":["env:prod","web"],"user_data":"#cloud-config\nruncmd:\n  - touch /test.txt\n","vpc_uuid":"760e09ef-dc84-11e8-981e-3cfdfeaae000","subnet_uuid":"9c7a0d63-3c4e-4d3d-9f56-3b0fb0e5e4a1"}' \
  "https://api.digitalocean.com/v2/droplets"
```

### Go

Using [Godo](https://github.com/digitalocean/godo), the official DigitalOcean API client for Go:

```go
import (
    "context"
    "os"

    "github.com/digitalocean/godo"
)

func main() {
    token := os.Getenv("DIGITALOCEAN_TOKEN")

    client := godo.NewFromToken(token)
    ctx := context.TODO()

    createRequest := &godo.DropletCreateRequest{
        Name:   "example.com",
        Region: "nyc3",
        Size:   "s-1vcpu-1gb",
        Image: godo.DropletCreateImage{
            Slug: "ubuntu-20-04-x64",
        },
        SSHKeys: []godo.DropletCreateSSHKey{
            godo.DropletCreateSSHKey{ID: 289794},
            godo.DropletCreateSSHKey{Fingerprint: "3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"}
        },
        Backups: true,
        IPv6: true,
        Monitoring: true,
        Tags: []string{"env:prod","web"},
        UserData: "#cloud-config\nruncmd:\n  - touch /test.txt\n",
        VPCUUID: "760e09ef-dc84-11e8-981e-3cfdfeaae000",
        SubnetUUID: "9c7a0d63-3c4e-4d3d-9f56-3b0fb0e5e4a1",
    }
```

### Ruby

Using [DropletKit](https://github.com/digitalocean/droplet_kit), the official DigitalOcean API client for Ruby:

```ruby
require 'droplet_kit'
token = ENV['DIGITALOCEAN_TOKEN']
client = DropletKit::Client.new(access_token: token)

droplet = DropletKit::Droplet.new(
  name: 'example.com',
  region: 'nyc3',
  size: 's-1vcpu-1gb',
  image: 'ubuntu-20-04-x64',
  ssh_keys: [289794,"3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"],
  backups: true,
  ipv6: true,
  monitoring: true,
  tags: ["env:prod","web"],
  user_data: "#cloud-config\nruncmd:\n  - touch /test.txt\n",
  vpc_uuid: "760e09ef-dc84-11e8-981e-3cfdfeaae000",
  subnet_uuid: "9c7a0d63-3c4e-4d3d-9f56-3b0fb0e5e4a1",
)
client.droplets.create(droplet)
```

### Python

Using [PyDo](https://github.com/digitalocean/pydo), the official DigitalOcean API client for Python:

```python
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "name": "example.com",
  "region": "nyc3",
  "size": "s-1vcpu-1gb",
  "image": "ubuntu-20-04-x64",
  "ssh_keys": [
    289794,
    "3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"
  ],
  "backups": True,
  "ipv6": True,
  "monitoring": True,
  "tags": [
    "env:prod",
    "web"
  ],
  "user_data": "#cloud-config\nruncmd:\n  - touch /test.txt\n",
  "vpc_uuid": "760e09ef-dc84-11e8-981e-3cfdfeaae000",
  "subnet_uuid": "9c7a0d63-3c4e-4d3d-9f56-3b0fb0e5e4a1"
}

resp = client.droplets.create(body=req)
```