Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ambari Alert REST API to filter out services on maintenance mode

Solved Go to solution

Ambari Alert REST API to filter out services on maintenance mode

Rising Star

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

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Ambari Alert REST API to filter out services on maintenance mode

Rising Star

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...

2 REPLIES 2

Re: Ambari Alert REST API to filter out services on maintenance mode

Rising Star

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...

Re: Ambari Alert REST API to filter out services on maintenance mode

Rising Star

Thank you very much @zblanco. It worked perfectly fine. Also thank you very much for the reference API.

Don't have an account?
Coming from Hortonworks? Activate your account here