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

I can not get the API to collect the %CPU of a monitor host

olivier_ebaach1
Contributor

Hi

I need to collect Memory, CPU of a Host.

I also need to collect Response time of a service.

I read the API Document but didn't understand what to do.

Can you give me an exemple then i will learn from it

Can you help me?

Regards

2 REPLIES 2

MaciejNeumann
Community Team
Community Team

Hello @EBA'A CHI O.,

Remember to never provide the Dynatrace environment ID in your question. Here are a couple of tips on how to ask the best question on our forum and increase your chances of getting a quick and precise answer:

If you have any questions about the Forum, you can contact me at maciej.neumann@dynatrace.com

Dallas
Dynatrace Mentor
Dynatrace Mentor

Hello @EBA'A CHI O.,

Here is an example request to capture host CPU idle for every hour in the last day:

https://xxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Ahost.cpu.idle&resolution=h&from=now-1d%2Fh&entitySelector=type%28HOST%29%2CentityId%28HOST-C98F015DFD9D8A95%29

Keep in mind you will also need your token for this.

Here are some good resources for creating these requests:

https://www.dynatrace.com/news/blog/integrate-dynatrace-more-easily-using-the-new-metrics-rest-api/

https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/metric-v2/get-...

Also, if you haven't tried. Go to your tenant and click the user icon. Under "dynatrace API" select "Environment API". This gives you a pretty great interface for creating a simple query.

Let me know if you need more help.

Thanks

-Dallas