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

Hi,

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.


Thanks,

Sajin



1 REPLY 1

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:

https://docs.hortonworks.com/HDPDocuments/Ambari-2.7.3.0/managing-and-monitoring-ambari/content/amb_...


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

https://community.hortonworks.com/questions/184964/in-which-cases-services-auto-start-will-affected....

https://community.hortonworks.com/questions/236865/auto-start-for-service-when-it-fails-or-get-stop-...


.

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"

.