Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (1)
avatar
Rising Star

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

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

4,437 Views
Comments
avatar
New Member

I found it easier to download the json to a file, edit it on disk, then use the `-d @filename.json` in the final step to avoid lengthy command lines. The only caveat: the "href" line needs to be deleted from the json obtained in step two.

Version history
Last update:
‎04-15-2016 01:26 PM
Updated by:
Contributors