Alerts - Definitions


Overview

Each of the API commands described here relate to retrieving, creating, editing and deleting one or more Alert Definitions at your site. There are four kinds of Alert Definitions:

  • those created for system alerts (RevealCloud),
  • those created for website / probe alerts (RevealUptime), and
  • those created for alerts on custom metrics (RevealMetrics)
  • those created for AWS services being monitored.

Each Alert Definition is completely described by an Alert Definition Hash and has a unique ALERT_DEF_ID (alert definition ID).

Please Note: Since this document was last updated, the API calls to specify notifications for have changed. While the ‘notify’ hash in the Alert Definition Hash is still present, it should no longer be used. Instead, you should begin using Notification Profiles, and specify which notification profile / type should be used for each Alert Definition, using the ‘alert_targets’ array.

This process is explained below, in Update Example 2. Please also refer to the Notification Profiles section for more detail.


The Alert Definition Hash

A JSON-encoded Alert Definition Hash is shown in the following system alert definition example:

{
    "id":117439,                                   # unique ALERT_DEF_ID (generated by Uptime Cloud Monitor)
    "auto_clear":true,                             # clear the alert once the alert condition resolves
    "notify_on_clear":true,                        # notify when the alert clears (whether automatically or when manually cleared)
    "auto_annotate":true,                          # create an annotation on each new occurrence of the alert condition
    "defn_desc":"Memory Use - High",               # your text description of this alert definition
    "comp_func":">=",                              # the comparison to apply to comp_val1 and comp_val2
    "comp_val1":["ce_rcsummary_v1","used_pcent"],  # specifies the metric to be compared, and a text description of its units
    "comp_val1_as":"counter",                      # indicates whether to compare as a counter ('counter') or as a rate ('rate')
    "comp_desc1":"Active Memory",                  # text desription of the metric to compare
    "comp_val2":[0.95],                            # the value to compare against
    "comp_desc2":"95%",                            # text description of the comparison value
    "duration":60,                                 # minimum duration of alert condition before an alert is triggered
    "kind":"ce_revealcloud",                       # kind of alert: "ce_revealcloud", "ce_revealuptime" or "ce_revealmetrics"
    "match":{"idp":["uuid|"]},                     # specify one or more tags to which associate this alert
    "match_exclude":{"tag":["exclude"]},           # specify one or more tags for which alert needs to be ignored
    "state":"disabled",                            # can be "enabled" or "disabled"
    "created_at":1347142927,                       # timestamp of alert creation generated by Uptime Cloud Monitor
    "updated_at":1350863583,                       # timestamp of last update generated by Uptime Cloud Monitor
    "notify":{},                                   # no longer used
    "group_match":"none",                          # specify if alert matching is allowed
    "alert_targets":[                              # hash of notification profiles associated with this alert
      {
        "notification_profile_id":4028,
        "notification_type":"Email"
      }
    ],
    "unit":""                                      # read-only field, internal use
}

Index

Retrieve all Alert Definitions at your site.

CURL Command, and variations:

curl -su <APIKEY>:U https://api.copperegg.com/v2/alerts/definitions.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/definitions.json

The API key is a unique key that identifies each customer. You can obtain it by clicking the Settings tab while logged on to Uptime Cloud Monitor UI. It is presented at the bottom of the screen under “User API Access”.

CURL Response:

Response is an array of JSON-encoded Alert Definition Hashes. In the following example, two Alert Definition Hashes are returned, one probe and one custom metrics alert definition:

[
 {
   "id":134416,
   "auto_clear":true,
   "notify_on_clear":true,
   "auto_annotate":true,
   "defn_desc":"Website Down",
   "comp_func":"=",
   "comp_val1":["ce_probe_summary_v1","status"],
   "comp_val1_as":null,
   "comp_desc1":"Uptime",
   "comp_val2":[0],
   "comp_desc2":"0%",
   "duration":60,
   "kind":"ce_revealuptime",
   "match":{
     "tag":["test"],
     "group_dt":["ce_probe_summary_v1"]
   },
   "match_exclude":{"tag":["exclude"]},
   "state":"enabled",
   "created_at":1351269990,
   "updated_at":1351269990,
   "notify":{},
   "group_match":"none",
   "alert_targets":[
     {"notification_profile_id":4028,"notification_type":"Email"},
     {"notification_profile_id":4028,"notification_type":"Sms"}
   ],
   "unit":""
 },
 {
   "id":147854,
   "auto_clear":true,
   "notify_on_clear":true,
   "auto_annotate":true,
   "defn_desc":"Change in number of EC2 Running Instances",
   "comp_func":"!=",
   "comp_val1":["demo_aws_ec2_v2","Running"],
   "comp_val1_as":null,
   "comp_desc1":"Running",
   "comp_val2":[6],
   "comp_desc2":"6",
   "duration":60,
   "kind":"ce_revealmetrics",
   "match":{"tag":["demo"]},
   "match_exclude":{"tag":["exclude"]},
   "state":"enabled",
   "created_at":1355072376,
   "updated_at":1355256644,
   "notify":{},
   "group_match":"none",
   "alert_targets":[
     {"notification_profile_id":4028,"notification_type":"Email"},
     {"notification_profile_id":4028,"notification_type":"Sms"},
     {"notification_profile_id":6157,"notification_type":"Push"}
   ],
   "unit":""
 }
]

Show

Show in-depth information about a single alert definition.

Required parameters: ALERT_DEF_ID (alert definition id) as part of the path.

The value of ALERT_DEF_ID can be picked from the list of alert definitions fetched using above curl command or it can be seen in the URL when editing an alert definition.

CURL Command, and variations:

curl -su <APIKEY>:U https://api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json

CURL Response:

Response is a single JSON-encoded Alert Definition Hash. In this case, the alert defined is a ‘Website Down’ alert.

{
 "id":134416,
 "auto_clear":true,
 "notify_on_clear":true,
 "auto_annotate":true,
 "defn_desc":"Website Down",
 "comp_func":"=",
 "comp_val1":["ce_probe_summary_v1","status"],
 "comp_val1_as":null,
 "comp_desc1":"Uptime",
 "comp_val2":[0],
 "comp_desc2":"0%",
 "duration":60,
 "kind":"ce_revealuptime",
 "match":{
   "tag":["test"],
   "group_dt":["ce_probe_summary_v1"]
 },
 "match_exclude":{"tag":["exclude"]},
 "state":"enabled",
 "created_at":1351269990,
 "updated_at":1351269990,
 "notify":{},
 "group_match":"none",
 "alert_targets":[
   {"notification_profile_id":4028,"notification_type":"Email"},
   {"notification_profile_id":4028,"notification_type":"Sms"}
 ],
 "unit":""
}

Create

Create a new alert definition.

Required parameters:

You must include all of the following:

defn_desc
Your short text description of the alert (string); e.g., “defn_desc”:”MyAlert”.
kind
A string that may be “ce_revealcloud” (system alert), “ce_revealuptime” (website alert), or “ce_revealmetrics” (alert on custom metric) or “aws_", where service is AWS service for which alert is being made (alerts on AWS).
duration
This number of seconds that the alert condition must be continuously present before the alert is triggered. Valid durations (in seconds) are 60, 120, 180, 300, 600, 900, 1800, 3600. Valid durations (in seconds) for AWS Alerts 900, 1800, 3600.
comparison parameters
Refer to ‘Specifying Comparison parameters’ for the following parameters:
  • comp_func
  • comp_desc1
  • comp_val1
  • comp_val2
  • comp_desc2

Optional parameters:

You may include any of the following:

auto_clear
Clear the issue when the alert trigger condition is no longer true. May be true or false, not in quotes; e.g., “auto_clear”:true. Default if not specified: true
notify_on_clear
Send an ‘ALERT CLEARED’ notification when the alert is cleared. May be true or false, not in quotes; e.g., “notify_on_clear”:false. Default if not specified: true
auto_annotate
Create a chart annotation when this alert triggers. May be true or false, not in quotes; e.g., “auto_annotate”:true. Default if not specified: false
comp_val1_as
This may be set to ‘counter’ or ‘rate’. If not included in the create call, its value will be null, and it will behave as ‘counter’. If set to ‘counter’, the value is treated as a counter; always incrementing. If set to ‘rate’, the value is processed as a rate, which may fluctuate up and down.
state
An alert definition may be either “enabled” or “disabled”. If disabled, no alerts will be generated by this alert definition. e.g., “state”:”enabled”. Default if not specified: “enabled”
match
If not specified, defaults to match any tag or no tag. To specify one or more tags to match, use the following format: “match”:{“tag”:[“TAG1”,”TAG2”]}. Default if not specified: {}
match_exclude
If not specified, defaults to not exclude matching any tag i.e. alert will be matched against all tags. To specify one or more tags to exclude from alert monitoring, use the following format: “match_exclude”:{“tag”:[“TAG1”,”TAG2”]}. Default if not specified: {}
alert_targets
An array of hashes, each containing a NOTIFICATION_PROFILE_ID and a NOTIFICATION_TYPE. To associate this alert with a notification profile, the notification profile must have been created previously. Default if not specified: {} Please refer to the Notification Profiles section.

Specifying Comparison parameters

Comparison parameters for a system alert (RevealCloud)
  Process List
    "comp_func":"COMPFUNC"              "COMPFUNC" may be "=~" or "!~"
    "comp_val1":["ce_usage","payload"]
    "comp_desc1":"Process list"
    "comp_val2":["YOURPROCESS"]         "YOURPROCESS" is a string containing the name of the process of interest
    "comp_desc2":"YOURPROCESS"          same string as above

  CPU Total Usage
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_rcsummary_v1","active"]
    "comp_desc1":"CPU Total Usage"
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".

  CPU Steal Usage
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_rcsummary_v1","steal"]
    "comp_desc1":"CPU Steal Usage"
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".

  CPU IOWait Usage
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_rcsummary_v1","iowait"]
    "comp_desc1":"CPU IOWait Usage"
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".

  Active Memory Usage
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_rcsummary_v1","used_pcent"]
    "comp_desc1":"Active Memory"
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".

  Filesystem Usage
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_filesystem_v1","used_pcent"]
    "comp_desc1":"Filesystem Usage"
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".

  Load
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_rcsummary_v1","load_shortterm"]
    "comp_desc1":"Load"
    "comp_val2":[NUMBER]                NUMBER is >= 0 (number)
    "comp_desc2":"NUMBERSTR"            NUMBERSTR is comp_val2 converted to a string; "0" and higher

  Network Bytes Sent
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_rcsummary_v1","if_bytes_tx_gauge"]
    "comp_desc1":"Network Bytes Sent"
    "comp_val2":[BYTESPERSEC]           BYTESPERSEC is number of bytes sent per second; will be >= 0 (number); e.g,
                                        BYTESPERSEC of 1048576 should be followed by "comp_desc2":"1 MB/S"
                                        NOTE: 1048576 bytes/sec = 1 MB/s
    "comp_desc2":"MBPERSEC+UNITS"       "MBPERSEC+UNITS" is comp_val2 expressed as MB/s, converted to str with 'MB/s' appended. (e.g., "1 MB/s")

  Network Bytes Received
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_rcsummary_v1","if_bytes_rx_gauge"]
    "comp_desc1":"Network Bytes Received"
    "comp_val2":[BYTESPERSEC]           BYTESPERSEC is number of bytes received per second; will be >= 0 (number); e.g,
                                        BYTESPERSEC of 1048576 should be followed by "1 MB/S"
                                        NOTE: 1048576 bytes/sec = 1 MB/s
    "comp_desc2":"MBPERSEC+UNITS"       "MBPERSEC+UNITS" is comp_val2 expressed as MB/s, converted to str with 'MB/s' appended. (e.g., "1 MB/s")

  Health
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_health","health_index"]
    "comp_desc1":"Health Index"
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".

  System Not Seen
    "comp_func":""                      must be ""
    "comp_val1":["ce_health","health_state_last_updated"]
    "comp_desc1":"System Not Seen"
    "comp_val2":[""]                    must be ""
    "comp_desc2":""                     must be ""
Comparison parameters for a website / probe alert (RevealUptime)
  Response Time
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_probe_summary_v1","time"]
    "comp_desc1":"Response Time"
    "comp_val2":["NUMBERSTR"]           NUMBERSTR is comparison value in milliseconds, in string format; "0" and above.
    "comp_desc2":"NUMBERSTR+UNITS"      NUMBERSTR+UNITS is the comp_val2 string with "ms" appended; e.g., "3000ms"

  Response Status Code
    "comp_func": "COMPFUNC"             "=~" or "!~"
    "comp_val1":["ce_probe_summary_v1","status_code"]
    "comp_desc1":"Status Code"
    "comp_val2":["REGEXSTR"]            "REGEXSTR" is a regex expression in string format; e.g., "^[45]", or "500"
    "comp_desc2":"REGEXSTR"             "REGEXSTR" is the same string as above

  Uptime
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_probe_summary_v1","status"],
    "comp_desc1":"Uptime",
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".


  Health
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_probe_summary_v1","health"]
    "comp_desc1":"Health Index"
    "comp_val2":[FRACTION]              FRACTION is 0.0 to 1.0 (number)
    "comp_desc2":"PERCENTAGE"           PERCENTAGE is comp_val2 expressed as a percentage, and converted to a string; "0%" to "100%".
Comparison parameters for a custom metrics alert (RevealMetrics)
  Response Time
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["ce_probe_summary_v1","time"]
    "comp_desc1":"Response Time"
    "comp_val2":["NUMBERSTR"]           NUMBERSTR is comparison value in milliseconds, in string format; "0" and above.
    "comp_desc2":"NUMBERSTR+UNITS"      NUMBERSTR+UNITS is the comp_val2 string with "ms" appended; e.g., "3000ms"
Comparison parameters for AWS alert

For more alerts type on AWS, refer to Application.

  Response Time
    "comp_func": "COMPFUNC"             "COMPFUNC" may be "<", ">", "<=", ">=", "=" or "!="
    "comp_val1":["aws_rds","CPUUtilization"]
    "comp_desc1":"AWS - RDS Cpuutilization (avg)"
    "comp_val2":["NUMBERSTR"]           NUMBERSTR is comparison value in string format; "0" and above.
    "comp_desc2":"NUMBERSTR"      NUMBERSTR+UNITS is the comp_val2 string

Create Example 1: create a new alert definition, with only required parameters.

CURL Command, and variations:

curl -su <APIKEY>:U -H "Content-Type: application/json" -XPOST -d '{"defn_desc":"Decreased Availability", "duration":180,"comp_func":"<","comp_desc1":"Uptime","comp_val1":["ce_probe_summary_v1","status"],"comp_val2":[0.75],"comp_desc2":"75%","kind":"ce_revealuptime"}' https://api.copperegg.com/v2/alerts/definitions.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/definitions.json -H "Content-Type: application/json" -XPOST -d '{"defn_desc":"Decreased Availability", "duration":180,"comp_func":"<","comp_desc1":"Uptime","comp_val1":["ce_probe_summary_v1","status"],"comp_val2":[0.75],"comp_desc2":"75%","kind":"ce_revealuptime"}'

CURL Response:

Status Code 200, and a newly-created Alert Definition Hash:

{
  "id":183004,
  "auto_clear":true,                     # unspecified defaults to true
  "notify_on_clear":true,                # unspecified defaults to true
  "auto_annotate":false,                 # unspecified defaults to false
  "defn_desc":"Availability Down",
  "comp_func":"<",
  "comp_val1":["ce_probe_summary_v1","status"],
  "comp_val1_as":null,                   # unspecified defaults to null
  "comp_desc1":"Uptime",
  "comp_val2":[0.75],
  "comp_desc2":"75%",
  "duration":180,
  "kind":"ce_revealuptime",
  "match":{},                            # unspecified defaults to 'match anything'
  "match_exclude":{},                    # unspecified defaults to 'don't exclude anything'
  "state":"enabled",                     # unspecified defaults to enabled
  "created_at":1364499443,
  "updated_at":1364499443,
  "notify":{},
  "group_match":"none",
  "alert_targets":[],
  "unit":""
}

Create Example 2: create a new alert definition, with all parameters.

CURL Command, and variations:

curl -su <APIKEY>:U -H "Content-Type: application/json" -XPOST -d '{"defn_desc":"Himem","comp_func":">=","comp_desc1":"Active Memory","auto_clear":true,"notify_on_clear":true,"auto_annotate":false,"comp_val1":["ce_rcsummary_v1","used_pcent"],"comp_val2":[0.91],"comp_desc2":"91%","duration":60,"kind":"ce_revealcloud","match":{"tag":["my_webtier"]},"match_exclude":{"tag":["exclude"]}}' https://api.copperegg.com/v2/alerts/definitions.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/definitions.json -H "Content-Type: application/json" -XPOST -d '{"defn_desc":"Himem","comp_func":">=","comp_desc1":"Active Memory","auto_clear":false,"notify_on_clear":true,"auto_annotate":false,"comp_val1":["ce_rcsummary_v1","used_pcent"],"comp_val2":[0.91],"comp_desc2":"91%","duration":60,"kind":"ce_revealcloud","match":{"tag":["my_webtier"]}}'

CURL Response:

Status Code 200, and a newly-created Alert Definition Hash:

{
  "id":183020,
  "auto_clear":true,
  "notify_on_clear":true,
  "auto_annotate":false,
  "defn_desc":"Himem",
  "comp_func":">=",
  "comp_val1":["ce_rcsummary_v1","used_pcent"],
  "comp_val1_as":null,
  "comp_desc1":"Active Memory",
  "comp_val2":[0.91],
  "comp_desc2":"91%",
  "duration":60,
  "kind":"ce_revealcloud",
  "match":{"tag":["my_webtier"]},
  "match_exclude":{"tag":["exclude"]},
  "state":"enabled",
  "created_at":1364500695,
  "updated_at":1364500695,
  "notify":{},
  "group_match":"none",
  "alert_targets":[]},
  "unit":""
}

Update

Update an existing alert definition.

Required parameter:

ALERT_DEF_ID (alert definition id) as part of the path.

Optional parameters:

same as described for create.

Update Example 1: Change alert duration and flags in the alert definition created in Example 1.

CURL Command, and variations:

curl -su <APIKEY>:U -H "Content-Type: application/json" -XPUT -d '{"auto_clear":false,"auto_annotate":true,"notify_on_clear":false,"duration":120}' https://api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json -H "Content-Type: application/json" -XPUT -d '{"auto_clear":false,"auto_annotate":true,"notify_on_clear":false,"duration":120}'

CURL Response:

Status Code 200, and the newly-updated Alert Definition Hash:

{
  "id":183055,
  "auto_clear":false,
  "notify_on_clear":false,
  "auto_annotate":true,
  "defn_desc":"Availability Down",
  "comp_func":"<",
  "comp_val1":["ce_probe_summary_v1","status"],
  "comp_val1_as":null,
  "comp_desc1":"Uptime",
  "comp_val2":[0.75],
  "comp_desc2":"75%",
  "duration":120,
  "kind":"ce_revealuptime",
  "match":{},
  "match_exclude":{},
  "state":"enabled",
  "created_at":1364503164,
  "updated_at":1364503614,
  "notify":{},
  "group_match":"none",
  "alert_targets":[]},
  "unit":""
}

Update Example 2: associate a Notification Profile / type with an Alert Definition:

This is the final step in creating a new Notification Profile, and linking it to one (or more) Alert Definitions. Refer to Alerts- Profiles for additional detail.

The current Alert Definition Hash with Alert Definition ID of 183830 follows:

{
 "id":183830,
 "auto_clear":true,
 "notify_on_clear":true,
 "auto_annotate":false,
 "defn_desc":"FakeHighCPU",
 "comp_func":">",
 "comp_val1":["ce_rcsummary_v1","active"],
 "comp_val1_as":null,
 "comp_desc1":"CPU Total Usage",
 "comp_val2":[0.01],
 "comp_desc2":"1%",
 "duration":60,
 "kind":"ce_revealcloud",
 "match":{"tag":["MyMac"]},
 "match_exclude":{},
 "state":"enabled",
 "created_at":1364776106,
 "updated_at":1364776106,
 "notify":{},
 "group_match":"none",
 "alert_targets":[],                  # Note that no alert_targets are defined.
 "unit":""
}

CURL Command, and variations:

curl -su <APIKEY>:U -H "Content-Type: application/json" -XPUT -d '{"auto_clear":true,"notify_on_clear":true,"auto_annotate":false,"defn_desc":"FakeHighCPU","comp_func":">","comp_val1":["ce_rcsummary_v1","active"],"comp_val1_as":null,"comp_desc1":"CPU Total Usage","comp_val2":[0.01],"comp_desc2":"1%","duration":60,"kind":"ce_revealcloud","match":{"tag":["MyMac"]},"state":"enabled","alert_targets":[{"notification_profile_id":10766,"notification_type":"Twitter"}]}' https://api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json

curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json -H "Content-Type: application/json" -XPUT -d '{"auto_clear":true,"notify_on_clear":true,"auto_annotate":false,"defn_desc":"FakeHighCPU","comp_func":">","comp_val1":["ce_rcsummary_v1","active"],"comp_val1_as":null,"comp_desc1":"CPU Total Usage","comp_val2":[0.01],"comp_desc2":"1%","duration":60,"kind":"ce_revealcloud","match":{"tag":["MyMac"]},"state":"enabled","alert_targets":[{"notification_profile_id":10766,"notification_type":"Twitter"}]}'

CURL Response:

Response is Status 200, and a newly-updated Alert Definition Hash.

{
  "id":183830,
  "auto_clear":true,
  "notify_on_clear":true,
  "auto_annotate":false,
  "defn_desc":"FakeHighCPU",
  "comp_func":">",
  "comp_val1":[
    "ce_rcsummary_v1",
    "active"
  ],
  "comp_val1_as":null,
  "comp_desc1":"CPU Total Usage",
  "comp_val2":[
    0.01
  ],
  "comp_desc2":"1%",
  "duration":60,
  "kind":"ce_revealcloud",
  "match":{
    "tag":[
      "MyMac"
    ]
  },
  "match_exclude":{},
  "state":"enabled",
  "created_at":1364776106,
  "updated_at":1364776106,
  "notify":{},
  "group_match":"none",
  "alert_targets":[
    {
      "notification_profile_id":10766,        # this hash links ALert Definition ID 183830 to notification profile id 10766;
      "notification_type":"Twitter"           # specifically the "Twitter" notification type
    },
    "unit":""
  ]
}

Destroy

Delete the specified alert definition.

Required parameter:

ALERT_DEF_ID (alert definition id) as part of the path.

CURL Command, and variations:

curl  -su <APIKEY>:U -XDELETE  https://api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json

curl -s -XDELETE https://<APIKEY>:U@api.copperegg.com/v2/alerts/definitions/<ALERT_DEF_ID>.json

CURL Response:

Response is Status 200, empty JSON:

{}