Support Questions
Find answers, ask questions, and share your expertise

Reading Ambari alerts using Ambari server API

Reading Ambari alerts using Ambari server API

New Contributor


Is there way we can read the alert of a failed component from Amabri server using API?

We are trying to read the alert from ambari server for a component that failed on a particular node and start it back if certain conditions are met.

Any info on this will be really helpful.




Re: Reading Ambari alerts using Ambari server API

Super Mentor

@Sajin Asokan

If you want to make sure that if any service component goes down abruptly (without manual effort or graceful stop) then it should get automatically restarted in crash or abnormal termination scenario. Then in that case it is best to enable the Ambari Auto Start feature for those components:

Some additional discussions about the "Service Autostart" feature of ambari can be found here to know how it works.


Regarding getting the Alerts using API Call. you can use the following kind of API call to fetch all the CRITICAL alerts. Then based on the host and component and the message you can proceed with checking.

# curl -u admin:admin -H "X-Requested-By:ambari" -X GET "http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/alerts?fields=*&Alert/state=CRITICAL&Alert/maintenance_state=OFF"