• 0
gwengrafana

API - Alerts - Filter by location

Question

In the logic monitor website I can filter alerts by location, I don't see that entry in the json file returned by the API.

How do I get alerts per location please? 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Ah okay so my companies naming convention has fooled me into thinking that the filter was called location, when I clear the filter it calls the box Group. 

When I look in the alert json data I can see monitorObjectGroups is that the same thing? If so I was trying below with no luck

 

$resourcePath =  '/alert/alerts'
$filters = '?filter=severity>:4&filter=monitorObjectGroups.id:4773'

Share this post


Link to post
Share on other sites
  • 0

Yep, you're correct. monitorObjectGroups field is: "Information about the groups the object is a member of" as a JSON object, per about-the-alerts-resource.

Try $filters ='?filter=monitorObjectGroups~myspecificlocation'

I'm actually not sure if it's possible to filter within the JSON object itself (like using .id) in the call itself.

Share this post


Link to post
Share on other sites
  • 0

Thanks!

There was another page that suggested you could do that. 

https://www.logicmonitor.com/support/rest-api-developers-guide/v1/collector-groups/get-collector-groups/

You can use the '.' character to filter values within an object

But, yes it doesn't mention that on the alert page. I tried the above and just get data that doesn't match, I can write somethingthatdefowontexist and it still return the same data

I have now found that I can go the other way round 

$resourcePath = '/device/groups/2846/alerts'

This works will for the devices but I am then going to miss websites that alert.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now