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.

Is it possible to restore predefined alert that has been deleted over API?

Is it possible to restore predefined alert that has been deleted over API?

New Contributor

Hello everyone! I tried to disable the predefined "Metrics Collector - HBase Master CPU Utilization" alert with "id 8" using the following API request:

curl -H "X-Requested-By: ambari" -X DELETE "http://ambari-server:8080/api/v1/clusters/newcluster/alert_definitions/8" -u admin:admin

But it turned out I completely removed it. I cannot find alert in a list of alerts that are disabled.

Is there any way to recover it? And how to properly disable and not delete predefined alert over API?

Thanks!

1 REPLY 1
Highlighted

Re: Is it possible to restore predefined alert that has been deleted over API?

Guru

The original alert definition can be found here:

https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/AMBARI_...

This API doc has info on how to create:

https://github.com/apache/ambari/blob/branch-2.1/ambari-server/docs/api/v1/alert-definitions.md

Then, once you have re-created the alert, you can disable via API by performing a PUT with this payload:

PUT http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/alert_definitions/1

{"AlertDefinition/enabled":false}
Don't have an account?
Coming from Hortonworks? Activate your account here