16 May 2022 07:55 AM - last edited on 16 May 2022 08:48 AM by MaciejNeumann
https://xxxxxxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.mem.avail.pct&resolution=1h
Suppose we use above URL and get sample data
{
"totalCount": 2,
"nextPageKey": null,
"resolution": "1h",
"result": [
{
"metricId": "builtin:host.mem.avail.pct",
"data": [
{
"dimensions": [
"HOST-ADBCDAE05CEA42B2"
],
"dimensionMap": {
"dt.entity.host": "HOST-ADBCDAE05CEA42B2"
},
"timestamps": [
1652248800000
],
"values": [
83.1603291829427
]
}
]
}
]
}
This is sample dynatrace response we get. Here we have internal Id's for host.
Inorder to find actual host name mapping and also process mapping we can use below mentioned APIs seperately.
https://xxxxx.live.dynatrace.com/api/v1/entity/services?relativeTime=5mins
https://xxxxx.live.dynatrace.com/api/v1/entity/infrastructure/process-groups?relativeTime=5mins
https://xxxxx.live.dynatrace.com/api/v1/entity/infrastructure/processes?relativeTime=5mins
https://xxxxx.live.dynatrace.com/api/v1/entity/applications/
https://xxxxx.live.dynatrace.com/api/v1/entity/infrastructure/hosts
Can we get all metric data along with mapping data in /metrics/query API without calling above 5 apis? If any apis like that please let us know
Solved! Go to Solution.
17 May 2022 07:19 PM
It sounds like you may just need to add the 'names' transformation to your metric query e.g.:
builtin:host.disk.usedPct:splitBy("dt.entity.disk", "dt.entity.host"):names
This includes the names that map to the ids in the dimension mapping: