How to Track Performance with Droplet Graphs

DigitalOcean Droplets are Linux-based virtual machines (VMs) that run on top of virtualized hardware. Each Droplet you create is a new server you can use, either standalone or as part of a larger, cloud-based infrastructure.


Droplet graphs are up-to-the-minute visualizations of how your server is performing over time. They let you monitor Droplet performance metrics in the control panel.

Droplets come with some graphs available by default, and there are additional graphs available when you enable the free DigitalOcean Monitoring service.

Retrieve Performance Data via API

The DigitalOcean API provides many Monitoring endpoints that cover various performance metrics, such as bandwidth, CPU, and memory usage. The below code examples cover CPU usage. To learn more, explore the Monitoring endpoint of the DigitalOcean API.

How to obtain CPU metrics for a Droplet using the DigitalOcean API

To obtain CPU metrics for a Droplet using the DigitalOcean API, follow these steps:

  1. Create a personal access token, and save it for use with the API.

  2. Send a GET request to https://api.digitalocean.com/v2/monitoring/metrics/droplet/cpu

    cURL

    To obtain CPU metrics for a Droplet with cURL, call:

    
                    curl -X GET \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/monitoring/metrics/droplet/cpu?host_id=222651441&start=1636051668&end=1636051668"

    Python

    
                    import os
    from pydo import Client
    
    client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
    
    resp = client.monitoring.get_droplet_cpu_metrics(host_id="17209102", start="1620683817", end="1620705417")

Default Droplet Graphs

To view a Droplet’s graphs, click its name on the dashboard. You arrive directly on the Graphs page. By default, three graphs are available for any Droplet:

  • The Bandwidth public chart displays public bandwidth usage in megabits per second. Incoming bandwidth is dark purple and outgoing bandwidth is light purple.

  • The CPU usage shows the percent of total processing power being used, with light blue for user jobs and dark blue for system processes.

  • The Disk I/O displays disk read and write operations in megabytes per second, with read operations in dark green and write operations in light green.

The times in these graphs are in your local time zone, as determined by your browser.

The Droplet Graphs page with the default graphs visible

If you have enabled private networking on the Droplet, you also have access to a fourth graph to track VPC network bandwidth usage. Like the Bandwidth public graph, the Bandwidth private graph does not appear until there is actual network traffic. The Bandwidth private chart displays the VPC network bandwidth usage in megabits per second. Incoming bandwidth use is shown in dark purple and outgoing bandwidth in light purple.

Metrics Agent

The default Droplet graphs use metrics collected by external tools; they require no additional services on the Droplet itself. You can enable additional metrics graphs and alerting with the DigitalOcean metrics agent, which is a small utility that runs on the Droplet.

You can install the metrics agent automatically when you provision a Droplet or after a Droplet has been created.

Once the agent is installed, you’ll have access to these additional graphs:

  • Load Average measures whether the CPU is keeping up with queued processes. There are three lines representing 1-, 5-, and 15-minute load average calculation time frames in blue, green, and purple, respectively. You can find more details on load average in the metrics definitions.

  • The Memory line graph displays the percentage of physical RAM in use.

  • The Disk Usage line graph shows the percentage of space being used on the Droplet’s disk.

Screenshot of extended graphs

The Droplet graph time frame options are 6 hours, 24 hours, 7 days, or 14 days. Data resolution is based on number of points, with a fixed number of points per plot. When you mouse over any of the graphs, a line appears on all of them, pinpointing a moment in time. A graph legend appears along with metrics for that specific point in time.