pydo.monitoring.get_droplet_bandwidth_metrics()

Description

To retrieve bandwidth metrics for a given Droplet, send a GET request to /v2/monitoring/metrics/droplet/bandwidth. Use the interface query parameter to specify if the results should be for the private or public interface. Use the direction query parameter to specify if the results should be for inbound or outbound traffic. The metrics in the response body are in megabits per second (Mbps).

Parameters

Name Type Required Description Default Value
host_id string True The droplet ID.
interface string True The network interface.
direction string True The traffic direction.
start string True UNIX timestamp to start metric window.
end string True UNIX timestamp to end metric window.

Request Sample

import os
from pydo import Client

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

resp = client.monitoring.get_droplet_bandwidth_metrics(alert_uuid="dfa8da", host_id="17209102", interface="private", direction="inbound", start="1620683817", end="1620705417")

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

The response will be a JSON object with a key called data and status.

Click to expand an example response for Inbound Private Bandwidth.
{
  "value": {
    "status": "success",
    "data": {
      "resultType": "matrix",
      "result": [
        {
          "metric": {
            "direction": "inbound",
            "host_id": "222651441",
            "interface": "private"
          },
          "values": [
            [
              1634052360,
              "0.016600450090265357"
            ],
            [
              1634052480,
              "0.015085955677299055"
            ],
            [
              1634052600,
              "0.014941163855322308"
            ],
            [
              1634052720,
              "0.016214285714285712"
            ]
          ]
        }
      ]
    }
  }
}
Click to expand an example response for Inbound Public Bandwidth.
{
  "value": {
    "status": "success",
    "data": {
      "resultType": "matrix",
      "result": [
        {
          "metric": {
            "direction": "inbound",
            "host_id": "222651441",
            "interface": "public"
          },
          "values": [
            [
              1634052360,
              "0.016600450090265357"
            ],
            [
              1634052480,
              "0.015085955677299055"
            ],
            [
              1634052600,
              "0.014941163855322308"
            ],
            [
              1634052720,
              "0.016214285714285712"
            ]
          ]
        }
      ]
    }
  }
}
Click to expand an example response for Outbound Private Bandwidth.
{
  "value": {
    "status": "success",
    "data": {
      "resultType": "matrix",
      "result": [
        {
          "metric": {
            "direction": "outbound",
            "host_id": "222651441",
            "interface": "private"
          },
          "values": [
            [
              1634052360,
              "0.016600450090265357"
            ],
            [
              1634052480,
              "0.015085955677299055"
            ],
            [
              1634052600,
              "0.014941163855322308"
            ],
            [
              1634052720,
              "0.016214285714285712"
            ]
          ]
        }
      ]
    }
  }
}
Click to expand an example response for Outbound Public Bandwidth.
{
  "value": {
    "status": "success",
    "data": {
      "resultType": "matrix",
      "result": [
        {
          "metric": {
            "direction": "outbound",
            "host_id": "222651441",
            "interface": "public"
          },
          "values": [
            [
              1634052360,
              "0.016600450090265357"
            ],
            [
              1634052480,
              "0.015085955677299055"
            ],
            [
              1634052600,
              "0.014941163855322308"
            ],
            [
              1634052720,
              "0.016214285714285712"
            ]
          ]
        }
      ]
    }
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}