Skip to content
Skip to Content

Read a service's metrics

GET
/services/{serviceId}/metrics

CPU, memory, network and restarts of each of its replicas over the range, from the samples its servers' agents report every few seconds. Anyone who can see the service may read them.

Authorization

bearer
headerAuthorizationBearer <token>

An API key (opk_…) or a CLI token (opc_…).

Path parameters

serviceId*string

The service's id.

Query parameters

range?string

How far back: 1h, 6h, 24h, 7d or 30d. Default 1h.

Value in"1h""6h""24h""7d""30d"

Response body

Read a service's metrics

application/json
  1. response
serviceId*string
Formatuuid
range*string
Value in"1h""6h""24h""7d""30d"
step*integer

Seconds between points.

start*string
Formatdate-time
end*string
Formatdate-time
cpu*

Percent of one CPU core.

memory*

Bytes in use.

networkRx*

Bytes received per second.

networkTx*

Bytes sent per second.

restarts*

Each container's restart counter.

Example request
curl "https://openpanel.sh/api/v1/services/$SERVICE_ID/metrics" \  -H "Authorization: Bearer $OPENPANEL_TOKEN"
Example response
{  "serviceId": "8f8bb40f-b96b-40fe-9064-5031fbe483f9",  "range": "1h",  "step": 0,  "start": "2019-08-24T14:15:22Z",  "end": "2019-08-24T14:15:22Z",  "cpu": {    "unit": "string",    "series": [      {        "replica": 0,        "container": "string",        "serverId": "string",        "deploymentId": "string",        "points": [          [            0,            0          ]        ]      }    ]  },  "memory": {    "unit": "string",    "series": [      {        "replica": 0,        "container": "string",        "serverId": "string",        "deploymentId": "string",        "points": [          [            0,            0          ]        ]      }    ]  },  "networkRx": {    "unit": "string",    "series": [      {        "replica": 0,        "container": "string",        "serverId": "string",        "deploymentId": "string",        "points": [          [            0,            0          ]        ]      }    ]  },  "networkTx": {    "unit": "string",    "series": [      {        "replica": 0,        "container": "string",        "serverId": "string",        "deploymentId": "string",        "points": [          [            0,            0          ]        ]      }    ]  },  "restarts": {    "unit": "string",    "series": [      {        "replica": 0,        "container": "string",        "serverId": "string",        "deploymentId": "string",        "points": [          [            0,            0          ]        ]      }    ],    "total": 0  }}