Created 01-07-2016 04:00 PM
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
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
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
Thank you very much @zblanco. It worked perfectly fine. Also thank you very much for the reference API.