- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Ambari Alert REST API to filter out services on maintenance mode
- Labels:
-
Apache Ambari
Created ‎01-07-2016 04:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
we are using Ambari alerts Rest API to poll for components health. We would like to filter out the ones which are in Maintenance mode. Any idea what how we can get that. The REST API call throws all the services that are critical- http://<ambari host>:8080/api/v1/clusters/tech_hdp/alerts?Alert/state=CRITICAL
Created ‎01-07-2016 04:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Given your initial request that you had, you can expand the fields which are returned by adding
fields=*
This will add a new field called "maintenance_state". So then we have the request
/api/v1/clusters/tech_hdp/alerts?fields=*&Alert/state=CRITICAL
From here we can filter out the ones with a maintenance state of ON, (returning only those with maintenance mode off)
/api/v1/clusters/tech_hdp/alerts?fields=*&Alert/state=CRITICAL&Alert/maintenance_state=OFF
I found this info on the API reference https://github.com/apache/ambari/blob/trunk/ambari...
Created ‎01-07-2016 04:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Given your initial request that you had, you can expand the fields which are returned by adding
fields=*
This will add a new field called "maintenance_state". So then we have the request
/api/v1/clusters/tech_hdp/alerts?fields=*&Alert/state=CRITICAL
From here we can filter out the ones with a maintenance state of ON, (returning only those with maintenance mode off)
/api/v1/clusters/tech_hdp/alerts?fields=*&Alert/state=CRITICAL&Alert/maintenance_state=OFF
I found this info on the API reference https://github.com/apache/ambari/blob/trunk/ambari...
Created ‎01-07-2016 05:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much @zblanco. It worked perfectly fine. Also thank you very much for the reference API.
