API - Alerts - Filter by location
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?
gwengrafana
Posted 7 years ago·Last reply 7 years ago
6 comments
gwengrafana
OP7 years agoJust found this to try.
https://www.logicmonitor.com/support/rest-api-developers-guide/v1/services/get-all-alerts-for-a-service/
gwengrafana
OP7 years agoThanks!
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.
Mike Moniz
·7 years agoYep, 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.
gwengrafana
OP7 years agoAh 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'
gwengrafana
OP7 years agoMike Moniz
·7 years agoHow are you filtering alerts by location on the portal exactly?