17 Aug 2021 04:38 PM - last edited on 19 Nov 2021 12:21 PM by MaciejNeumann
I'm calling v2 entities api for selectig hosts machines with infrastructure mode. I met a problem with the query syntax for attribute params in entitySelectorField.
my Syntax is : entitySelector=type("HOST"),<monitoringMode>("INFRASTRUCTURE") according to the documentation but it return a 400 response.
{ "error": { "code": 400, "message": "Constraints violated.", "constraintViolations": [ { "path": "entitySelector", "message": "Unknown predicate name <monitoringMode>", "parameterLocation": "QUERY", "location": null }, { "path": "entitySelector", "message": "Unknown predicate name <monitoringMode>", "parameterLocation": "QUERY", "location": null } ] } }
Thanks in advance
Solved! Go to Solution.
17 Aug 2021 09:14 PM - edited 18 Aug 2021 01:19 PM
EDIT: Deleted the first half of this response as I was incorrect. You are able to achieve this using monitoringMode("CLOUD_INFRA"). Leaving the second half of this response as it may still serve the purpose using a different API endpoint.
---
For what you are trying to achieve, might I suggest using the OneAgent on a Host API. You can create an API query such as this to pull a list of all hosts that are in Infrastructure monitoring mode:
https://{environmentURL}/api/v1/oneagents?includeDetails=true&monitoringType=CLOUD_INFRASTRUCTURE
More information on this API endpoint can be found here: https://www.dynatrace.com/support/help/shortlink/api-oneagent-on-host
Hope this helps!
-Ryan
18 Aug 2021 08:23 AM
Hi Ryan,
Thanks for your reponse. Entity Attribute can't achieve this need ?
=> The attribute name—attribute value pair that the requested entity should have.
To specify several attribute values, separate them with commas (,).
To fetch the list of available attributes, execute the GET entity type call and check the properties field. You can use attributes with values that can be represented by a string.
We have monitoringMode in the properties list on the host so i thought it was possible.
Thanks again Ryan
18 Aug 2021 09:35 AM
Ryan,
type("HOST"),monitoringMode("CLOUD_INFRA") is OK.
The value of monitoringMode can't be CLOUD_INFRASTRUCTURE or INFRASTRUCTURE
Thanks
18 Aug 2021 01:20 PM
You are correct - my apologies for the confusion. You learn something new every day 🙂 I have edited my reply.