28 Nov 2021 09:45 AM
Hello all,
I hope I will make my question clear;
I want to extract data using Dynatrace API, to look for hosts that are listed as "Monitoring Candidate" and so on...
I find it hard to work with the extracted data from the API, for example, if I'm extracting the list of hosts, I see many parameters I don't need. I want for example to filter only the "Monitoring Candidates" but I don't know how.
You guys have any tips? a software I can use to work with?
Thank you.
Solved! Go to Solution.
28 Nov 2021 10:29 AM
In order to make the output more useful you can:
HTH
Yos
29 Nov 2021 02:01 AM - last edited on 29 May 2023 01:32 PM by MaciejNeumann
The new /api/v2 "monitored entities" set of endpoints make this easier.
First, have a look at the possible properties for a particular entity (eg. HOST)
GET https://abc12345.live.dynatrace.com/api/v2/entityTypes/ENTITY-TYPE
eg.
GET https://abc12345.live.dynatrace.com/api/v2/entityTypes/HOST
Gives:
{ "type": "HOST", "displayName": "Host", "dimensionKey": "dt.entity.host", "entityLimitExceeded": false, "properties": [
...
{ "id": "isMonitoringCandidate", "type": "Boolean", "displayName": "isMonitoringCandidate" }
...
]
Now get the hosts and ask for that additional property:
GET https://abc12345.live.dynatrace.com/api/v2/entities?entitySelector=type(HOST)&fields=properties.isMonitoringCandidate
Gives
{ "totalCount": 1, "pageSize": 50, "entities": [{ "entityId": "HOST-1234706CD0451ABC", "displayName": "myHostname", "properties": { "isMonitoringCandidate": false } }] }
29 Nov 2021 02:04 AM
GET https://abc12345.live.dynatrace.com/api/v2/entities?entitySelector=type(HOST)&fields=properties.isMonitoringCandidate
To see all valid properties for an entity:
https://abc12345.live.dynatrace.com/api/v2/entityTypes/HOST