Prometheus metrics in Public API
Servers.com provides data on traffic consumption for dedicated servers and the number of servers in the OpenMetrics format, which can be handled by Prometheus, VictoriaMetrics, or other monitoring software. To access the data, make an API request to the /v1/metrics/hosts endpoint.
Metrics format
The metrics are provided in the following formats:
1. Number of hosts within a location: serverscom_hosts_count
serverscom_hosts_count{chassis_name="Dell R450",host_type="dedicated_server",location_id="1",location_code="AMS1",rack_id="eX4mPle",rack_type="shared"} 5| Label | Description |
|---|---|
chassis_name | A human-readable name of a chassis. |
host_type | Indicates whether it's a standalone dedicated server or a server included as part of a managed service. |
location_id | A unique identifier of a location. |
location_code | Another identifier of a location. |
rack_id | A unique identifier of a rack. |
rack_type | A private or shared rack. |
| (value) | The quantity of hosts at the moment of the request. |
2. Outgoing traffic from a host: serverscom_host_monthly_sent_bytes_total
serverscom_host_monthly_sent_bytes_total{host_id="eX4mPle",title="test-host-server-ams1",traffic_type="private",chassis_name="Dell R220",host_type="dedicated_server",location_id="1",location_code="AMS1",rack_id="eX4mPle",rack_type="shared"} 77972| Label | Description |
|---|---|
host_id | A unique identifier of a host. |
title | A human-readable identifier of a host. |
traffic_type | Private or public traffic. |
chassis_name | A human-readable name of a chassis. |
host_type | Indicates whether it's a standalone dedicated server or a server included as part of a managed service. |
location_id | A unique identifier of a location. |
location_code | Another identifier of a location. |
rack_id | A unique identifier of a rack. |
rack_type | A private or shared rack. |
| (value) | A counter of traffic in bytes. |
3. Inbound traffic to a host: serverscom_host_monthly_received_bytes_total
serverscom_host_monthly_received_bytes_total{host_id="eX4mPle",title="test-host-server-ams1",traffic_type="private",chassis_name="Dell R220",host_type="dedicated_server",location_id="1",location_code="AMS1",rack_id="eX4mPle",rack_type="shared"} 77972Labels are the same as for serverscom_host_monthly_sent_bytes_total above.
The metrics counter displays the value for the current month and is reset to zero on the first day of each new month (UTC timezone). All traffic metrics are shown in bytes.
Use cases
You can process metrics using your own scripts and tools or with third-party software. The most common setup uses Prometheus alongside Grafana.
Below is an example Prometheus configuration to fetch metrics from the Servers.com API endpoint:
scrape_configs:
- job_name: 'serverscom_hosts'
scrape_interval: 60s
authorization:
type: "Bearer"
credentials: "eX4mPle_oF_puBlicAp1.TokEN"
static_configs:
- targets: ['api.servers.com']
metrics_path: /v1/metrics/hosts
scheme: httpsThe credentials value is your Public API token, available in the Public API section of the Customer Portal.
Each call to the endpoint counts against your request limit — typically 2,000 requests per hour. For up-to-date limit information, see the Rate limits section of the Public API documentation.
Refer to the Prometheus and Grafana documentation for guidance on setting up monitoring.
Metrics gap
In case of a connectivity issue, there may be a gap when metrics are not sent. When connectivity is restored, all delayed data will flow out rapidly, causing a spike in charts. This peak does not represent actual traffic consumption — it contains delayed data from a previous period.