Member since
04-12-2016
30
Posts
12
Kudos Received
1
Solution
04-15-2016
01:26 PM
7 Kudos
First you need to get the ID of the alert definition in your system: curl -H "X-Requested-By: ambari" -u admin:<password> -X GET http://<ambari_host>:<ambari_port>/api/v1/clusters/<cluster_name>/alert_definitions?AlertDefinition/name=ambari_agent_disk_usage Get the alert definition with the id from prevoius step: curl -H "X-Requested-By: ambari" -u admin:<password> -X GET http://<ambari_host>:<ambari_port>/api/v1/clusters/<cluster_name>/alert_definitions/61
Set the new thresholds by changing the JSON alert definition: curl -H "X-Requested-By: ambari" -u admin:<password> -i -X PUT -d '
{
"AlertDefinition":{
"cluster_name":"xyz",
"component_name":"AMBARI_AGENT",
"description":"This host-level alert is triggered if the amount of disk space used on a host goes above specific thresholds. The default values are 85% for WARNING and 90% for CRITICAL.",
"enabled":true,
"id":61,
"ignore_host":false,
"interval":1,
"label":"Ambari Agent Disk Usage",
"name":"ambari_agent_disk_usage",
"scope":"HOST",
"service_name":"AMBARI",
"source":{
"parameters":[
{
"name":"minimum.free.space",
"display_name":"Minimum Free Space",
"units":"bytes",
"value":1.0E9,
"description":"The overall amount of free disk space left before an alert is triggered.",
"type":"NUMERIC",
"threshold":"WARNING"
},
{
"name":"percent.used.space.warning.threshold",
"display_name":"Warning",
"units":"%",
"value":0.85,
"description":"The percent of disk space consumed before a warning is triggered.",
"type":"PERCENT",
"threshold":"WARNING"
},
{
"name":"percent.free.space.critical.threshold",
"display_name":"Critical",
"units":"%",
"value":0.9,
"description":"The percent of disk space consumed before a critical alert is triggered.",
"type":"PERCENT",
"threshold":"CRITICAL"
}
],
"path":"alert_disk_space.py",
"type":"SCRIPT"
}
}
}' http://<ambari_host>:<ambari_port>/api/v1/clusters/<cluster_name>/alert_definitions/61 Ambari API Reference: https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md
... View more
Labels: