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:
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.
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
}
Retrieve all Alert Definitions at your site.
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”.
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 in-depth information about a single alert definition.
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 -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
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 a new alert definition.
You must include all of the following:
You may include any of the following:
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 ""
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%".
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"
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
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"}'
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":""
}
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"]}}'
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 an existing alert definition.
ALERT_DEF_ID (alert definition id) as part of the path.
same as described for create.
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}'
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":""
}
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 -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"}]}'
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":""
]
}
Delete the specified alert definition.
ALERT_DEF_ID (alert definition id) as part of the path.
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
Response is Status 200, empty JSON:
{}