The GET metrics endpoint provides you the ability to select the full subtree of metrics with a trailing asterisk wildcard (*
). The asterisk wildcard selects all the metrics of the parent without the need to specify every one of them.
This example shows how to fetch the descriptors of all host CPU metrics.
To make the response shorter, we'll query only the following parameters:
Of course, you can query the full descriptors of a metric. To learn how to do that, check the select multiple metrics example.
We have to set the following query parameters:
builtin:host.cpu.*
.displayName,defaultAggregation
. Note that metricId
is omitted here, because it is always presented in the response.You can get the response in two formats:
application/json
.text/csv; header=present
. If you're not interested in the header row, use text/csv; header=absent
.To authenticate the request, set the Authorization header of the request to Api-token {your-token}
. The token must have the Read metrics (metrics.read
) permission.
Here's the Curl code of the request. Make sure to use the URL of your own environment and a real API token.
curl -L -X GET 'https://mySampleEnv.live.dynatrace.com/api/v2/metrics?fields=displayName,defaultAggregation&metricSelector=builtin:host.cpu.*' \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \-H 'Accept: application/json'
curl -L -X GET 'https://mySampleEnv.live.dynatrace.com/api/v2/metrics?fields=displayName,defaultAggregation&metricSelector=builtin:host.cpu.*' \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \-H 'Accept: text/csv; header=present'
https://mySampleEnv.live.dynatrace.com/api/v2/metrics?fields=displayName,defaultAggregation&metricSelector=builtin:host.cpu.*
Both examples contain the full payload; nothing is truncated.
{"totalCount": 17,"nextPageKey": null,"metrics": [{"metricId": "builtin:host.cpu.entc","displayName": "AIX Entitlement used","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.entConfig","displayName": "AIX Entitlement configured","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.idle","displayName": "CPU idle","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.iowait","displayName": "CPU I/O wait","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.load","displayName": "System load","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.load15m","displayName": "System load15m","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.load5m","displayName": "System load5m","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.msu.avg","displayName": "MSU average","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.msu.capacity","displayName": "MSU capacity","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.other","displayName": "CPU other","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.physc","displayName": "AIX Physical consumed","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.steal","displayName": "CPU steal","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.system","displayName": "CPU system","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.usage","displayName": "CPU usage %","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.user","displayName": "CPU user","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.ziip.eligible","displayName": "zIIP eligible","defaultAggregation": {"type": "avg"}},{"metricId": "builtin:host.cpu.ziip.usage","displayName": "zIIP usage","defaultAggregation": {"type": "avg"}}]}
metricId,displayName,defaultAggregationbuiltin:host.cpu.entc,AIX Entitlement used,avgbuiltin:host.cpu.entConfig,AIX Entitlement configured,avgbuiltin:host.cpu.idle,CPU idle,avgbuiltin:host.cpu.iowait,CPU I/O wait,avgbuiltin:host.cpu.load,System load,avgbuiltin:host.cpu.load15m,System load15m,avgbuiltin:host.cpu.load5m,System load5m,avgbuiltin:host.cpu.msu.avg,MSU average,avgbuiltin:host.cpu.msu.capacity,MSU capacity,avgbuiltin:host.cpu.other,CPU other,avgbuiltin:host.cpu.physc,AIX Physical consumed,avgbuiltin:host.cpu.steal,CPU steal,avgbuiltin:host.cpu.system,CPU system,avgbuiltin:host.cpu.usage,CPU usage %,avgbuiltin:host.cpu.user,CPU user,avgbuiltin:host.cpu.ziip.eligible,zIIP eligible,avgbuiltin:host.cpu.ziip.usage,zIIP usage,avg