27 May 2021 03:37 PM - last edited on 02 Jun 2021 08:09 AM by Karolina_Linda
Hi,
We are working on ability to enable/disable monitoring for multiple Hosts at once and need a way to identify current monitoring status for all Hosts in environment.
with fields=+properties.monitoringMode in /api/v2/entities call we can easily to identify monitoring mode, however, only way we found so far to identify if monitoring is enabled or not is to call /api/config/v1/hosts/ API for every single HOST.
Is there any better way to do this? not doing 5000 calls for 5000 Hosts?
Thanks!
I.
Solved! Go to Solution.
27 May 2021 07:53 PM
If you use the V1 SmartScape - Hosts API it includes monitoring mode in the response if you select to include details: https://www.dynatrace.com/support/help/shortlink/api-hosts-get-all#response-body
01 Jun 2021 09:57 AM
Hi James,
Thanks for information. I have tow painpoints with this solution:
- it is v1 API. Will it be kept for the future?
- it allows me to get information for one HOST. SO, if I have 10.000 hosts I have to loop it 10.000 times if I need to get an overview about status.
it is not a problem to get Monitoring mode with v2 entities call as it is part of entity Type HOST properties. However, I am talking about monitoringEnable property for which I would need to use v1 call in loop.... 😞
Any other option?
Thanks!
I.
01 Jun 2021 03:12 PM
The API I linked returns multiple hosts, II just verified that, not one so it won't need a separate call to get every host. I'm not aware of any plans to get rid of any v1 endpoints, most likely they just won't get any enhancements.
02 Jun 2021 08:00 AM
hi James, you are absolutelly right, sorry for confusion, /api/v1/entity/infrastructure/hosts returns all hosts, however, it doesnot return monitoringEnable property, just monitoringMode.
However, I found meanwhile that /api/v1/oneagents is able toprovide this information via configuredMonitoringEnabled property, hence my problem too get montoringenabled state for all hosts in one call is solved by now.
Thanks for support!
I.