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

Get host entity filter by monitoring mode

Ousti
Visitor

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

 

4 REPLIES 4

ryan_ott
Dynatrace Mentor
Dynatrace Mentor

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

ACE Consultant, Dynatrace Services
Dynatrace Certified Professional

Ousti
Visitor

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

Ryan,

type("HOST"),monitoringMode("CLOUD_INFRA") is OK.

The value of monitoringMode can't be CLOUD_INFRASTRUCTURE or INFRASTRUCTURE

 

Thanks

 

 

ryan_ott
Dynatrace Mentor
Dynatrace Mentor

You are correct - my apologies for the confusion. You learn something new every day 🙂  I have edited my reply. 

ACE Consultant, Dynatrace Services
Dynatrace Certified Professional

Featured Posts