Back

Prometheus Metrics in Public API

servers.com will provide you with data on traffic consumption for dedicated servers and number of servers in the OpenMetrics format that can be easily handled by Prometheus, VictoriaMetrics or other monitoring software. To access the data, you need to make an API request to the /v1/metrics/hosts endpoint.

Metrics format

The metrics will be provided by servers.com in the following formats:

1. A quantity 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
  • chassis_name - a human readable name of a chassis.

  • host_type - this label shows if it's a standalone dedicated server or a server included as part of a managed service.

  • location_id - a unique identifier of a location.

  • rack_id - a unique identifier of a rack.

  • rack_type - a private or shared rack.

  • 5 - a quantity of hosts for the moment of the request.

2. Amount of 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
    • 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 chassis.

    • host_type - this label shows if 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.

    • 77972 - a counter of traffic in bytes.

    3. Amount of 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"} 77972
    • Labels are the same as in the previous one.

    The metrics counter displays the value for the current month and is reset to zero every first day of a new month (UTC timezone). The traffic metrics are shown in bytes.

    Use cases

    It's up to you whether you want to process metrics using your own scripts and tools or third-party software. We assume that the most common use case will employ Prometheus alongside Grafana.

    This is an example of how the Prometheus configuration may be set up 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: https

    The credentials value is your Public API token that you can get in the Public API section of the Customer Portal.

    Please keep in mind that each call to the endpoint will consume your requests within the limit. Usually, it's 2,000 requests per hour. To get actual information on limits, please take a look at the relevant section on the servers.com Public API documentation.

    You can refer to the Prometheus and Grafana documentation to learn more on how to set up the monitoring.

    Metrics gap

    In case of a connectivity issue, there may be a gap when metrics are not sent. When connectivity is restored, all data will rapidly flow out and a chart will show a spike. This peak doesn't represent actual traffic consumption because it contains delayed data from a previous period.

    Share

    Suggested Articles

    • Customer Portal

      RESTful API and Terraform provider

    • Cloud servers

      Where can I find OpenStack API credentials