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).
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. |
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")
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.