06 Apr 2021 02:54 PM
In the Dynatrace V2 API, my query returns the data however it gives me the cryptic host-Id.
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
Solved! Go to Solution.
06 Apr 2021 04:13 PM
You need to use the ':names' transformation described here:
https://www.dynatrace.com/support/help/shortlink/api-metrics-v2-selector#names-transformation
06 Apr 2021 05:56 PM - last edited on 20 Dec 2024 10:09 AM by MaciejNeumann
James, how would you modify this line?
https://xxxxxxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.(system)&resolution=1m&from=now-1h&to=now&entitySelector=type(HOST),tag(MyApplication:MyApp)
06 Apr 2021 06:07 PM
oooo, wait, I think I got it. Does this look right??
builtin:host.cpu.(system):names:merge(1)
06 Apr 2021 07:49 PM
@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!
06 Apr 2021 08:54 PM
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.