# Find the number of monitored and unmonitored hosts

**URL:** <https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [August 12, 2021, 6:28am UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381 "2021-08-12T06:28:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Fabian](https://avatars.discourse-cdn.com/v4/letter/_/b5ac83/32.png) [@\_Fabian](https://community.dynatrace.com/u/_Fabian)\
**Post date:** [August 12, 2021, 6:28am UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/1 "2021-08-12T06:28:57Z")

</div>

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.

 ![nb host.png](https://global.discourse-cdn.com/dynatrace/original/3X/5/5/5591a69081951ece6597c38a9a8599a6a6506c86.png)

---

<div class="post-metadata">

**Author:** ![Malaik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/malaik/32/32673_2.png) [@Malaik](https://community.dynatrace.com/u/Malaik)\
**Post date:** [August 12, 2021, 11:37am UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/2 "2021-08-12T11:37:17Z")

</div>

Hello&nbsp;[@\_Fabian\_](https://community.dynatrace.com/user/24950)

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&nbsp;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.

---

<div class="post-metadata">

**Author:** ![\_Fabian](https://avatars.discourse-cdn.com/v4/letter/_/b5ac83/32.png) [@\_Fabian](https://community.dynatrace.com/u/_Fabian)\
**Post date:** [August 12, 2021, 11:55am UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/3 "2021-08-12T11:55:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 12, 2021, 12:12pm UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/4 "2021-08-12T12:12:37Z")

</div>

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](https://global.discourse-cdn.com/dynatrace/original/3X/4/3/43b4e54b7c795634f3d7f50f9ba7b0ae6758ab6e.png)

---

<div class="post-metadata">

**Author:** ![\_Fabian](https://avatars.discourse-cdn.com/v4/letter/_/b5ac83/32.png) [@\_Fabian](https://community.dynatrace.com/u/_Fabian)\
**Post date:** [August 12, 2021, 1:12pm UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/5 "2021-08-12T13:12:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 12, 2021, 1:16pm UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/6 "2021-08-12T13:16:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![\_Fabian](https://avatars.discourse-cdn.com/v4/letter/_/b5ac83/32.png) [@\_Fabian](https://community.dynatrace.com/u/_Fabian)\
**Post date:** [August 12, 2021, 1:25pm UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/7 "2021-08-12T13:25:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![\_Fabian](https://avatars.discourse-cdn.com/v4/letter/_/b5ac83/32.png) [@\_Fabian](https://community.dynatrace.com/u/_Fabian)\
**Post date:** [August 12, 2021, 2:27pm UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/8 "2021-08-12T14:27:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 12, 2021, 2:31pm UTC](https://community.dynatrace.com/t/find-the-number-of-monitored-and-unmonitored-hosts/32381/9 "2021-08-12T14:31:49Z")

</div>

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 🙂&nbsp;:dancing\_blob:
