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

API : how to find the number of hosts (monitored and unmonitored)

fabian_turchiu1
Participant

Hi,

 

how to get the exact same number of hosts detected by Dynatrace. The same number as the one displayed on the attached screenshot (/#settings/deployment/newhostslist)

 

I can't find an API that does this.

 

Thank You.

 

8 REPLIES 8

Malaik
Helper

Hello @fabian_turchiu1 

 

If I understand well, i found the solution for you.

The only way that I see, is to use the API.

Using this call 'Gets the list of hosts with OneAgent deployment information for each host'

 

If your disabling was made since long time, don't forget to change the start time frame: and now with the integer as an entry (with a maximum of 92 days I think).

 

If you need more assistance not hesitate.

Sharing Knowledge

Thank you for the answer. 92 days is far too short. I would need to be able to get the information regardless of the time frame. In fact, I need to get all the hosts on which a watchdog is running.

ChadTurner
DynaMight Guru
DynaMight Guru

What you can do is to list all the hosts in Dynatrace Via the API. and from that GET Command, you can also include or choose to exclude monitoring candidates that Dynatrace sees.

ChadTurner_0-1628770289220.png

 

-Chad

Unfortunately, it doesn't work.The API returns 1093 hosts when I expect 2060. This is not really surprising since the smartscape does not display known but unmonitored hosts (unless I'm mistaken). But thanks anyway.

You may need to increase the payload output as in my tests we get the full output of all hosts. with monitoring candidates excluded

-Chad

I try through the Dynatrace interface. I don't put a limit in the size of the page. Is there any other way to increase the payload?

fabian_turchiu1
Participant

Ok, I think I've got it (1 year is enough and it returns more than 2000 hosts) :

 

/api/v2/entities?pageSize=3000&entitySelector=type%28%22HOST%22%29&from=now-1y&to=now&fields=properties.STATE

 

Thank you for your help.

You're welcome. some people use postman as well as they can gain a larger output since the API UI in Dynatrace can crash and such. Glad to hear that its working as expected 🙂 :dancing_blob:

-Chad