cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynatrace V2 API - Metrics Call Does Not Return An Actual Server Name

louis_gallo
Helper

In the Dynatrace V2 API, my query returns the data however it gives me the cryptic host-Id.

 

API call - https://******.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.(system)&reso...

 

I get this back (CSV Format):

metricId,dt.entity.host,time,value
builtin:host.cpu.system,HOST-FFFFFFCFD79DB1E0,4/6/2021 12:45,0.778690974

 

How can I get the actual server name back rather than dt.entity.host?

Any help is appreciated.

Thanks,

Lou

5 REPLIES 5

JamesKitson
Dynatrace Guru
Dynatrace Guru

You need to use the ':names' transformation described here: 

https://www.dynatrace.com/support/help/shortlink/api-metrics-v2-selector#names-transformation

oooo, wait, I think I got it. Does this look right??

 

builtin:host.cpu.(system):names:merge(1)

@louis_gallo that is right! You just don't need the parentesis if you only want "system":

builtin:host.cpu.system:names:merge

You would put parenthesis if you want another value regarding the cpu:

builtin:host.cpu.(system,usage):names:merge

v2 are tricky but really cool, once you wrap your mind around it!

louis_gallo
Helper

Thanks to all for helping me to get my feet wet. I'll be working on app stats next through the V2 API. Fun fun fun and more questions.

Featured Posts