Alerts API
GET /api/2/organizations/:organization_id/projects/:project_id/alerts
Example Response
[
{
"id": 1,
"project_id": 2,
"name": "test alert",
"expression": "disk.available < 50",
"duration": 60,
"alert_emails": "me@example.com",
"alert_phones": "",
"alert_endpoint": "",
"playbook": "",
"enabled": true,
"created_at": "2016-01-29T21:35:42.371Z",
"updated_at": "2016-01-29T21:35:42.371Z",
"lock_version"": 0
},
{
"id": 2,
"project_id": 2,
"name": "Important Alert",
"expression": "queue.size > 100",
"duration": 60,
"alert_emails": "oncalldev@example.com",
"alert_phones": "",
"alert_endpoint": "",
"playbook": "",
"enabled": true,
"created_at": "2016-01-29T21:36:22.608Z",
"updated_at": "2016-01-29T21:36:22.608Z",
"lock_version": 0
}
]
GET /api/2/organizations/:organization_id/projects/:project_id/alerts/:alert_id
Example Response
{
"id": 2,
"project_id": 2,
"name": "Important Alert",
"expression": "queue.size > 100",
"duration": 60,
"alert_emails": "oncalldev@example.com",
"alert_phones": "",
"alert_endpoint": "",
"playbook": "",
"enabled": true,
"created_at": "2016-01-29T21:36:22.608Z",
"updated_at": "2016-01-29T21:36:22.608Z",
"lock_version": 0
}
POST /api/2/organizations/:organization_id/projects/:project_id/alerts/
Required Parameters
Optional Parameters
duration
integer, defaults to 60, length of period to check in seconds (i.e. check the last minute of data)
alert_emails
string, comma separated list of email addresses to notify
alert_phones
string, comma separated list of phone numbers to text
alert_endpoint
string, url to call when alert fires
playbook
text, markdown describing how to handle this alert
enabled
boolean, designating whether or not the alert should be evaluated
Example Post Body
{
"name": "Disk Space",
"expression": "disk.available < 10",
"alert_endpoint": "http://example.com/alert_handling_endpoint"
}
Example Response
{
"id": 3,
"project_id": 2,
"name": "Disk Space",
"expression": "disk.available < 10",
"duration": 60,
"alert_emails": null,
"alert_phones": null,
"alert_endpoint": "http://example.com/alert_handling_endpoint",
"playbook": "",
"enabled": true,
"created_at": "2016-01-29T21:51:03.289Z",
"updated_at": "2016-01-29T21:51:03.289Z",
"lock_version": 0
}
PATCH /api/2/organizations/:organization_id/projects/:project_id/alerts/:alert_id
Optional Parameters
name
string, limit 255
expression
string, see Instrumental Query Language for valid expressions
duration
integer, defaults to 60, length of period to check in seconds (i.e. check the last minute of data)
alert_emails
string, comma separated list of email addresses to notify
alert_phones
string, comma separated list of phone numbers to text
alert_endpoint
string, url to call when alert fires
playbook
text, markdown describing how to handle this alert
enabled
boolean, designating whether or not the alert should be evaluated
Example Post Body
{
"expression": "disk.available < 20"
}
Example Post Body
{
"id": 3,
"project_id": 2,
"name": "Disk Space",
"expression": "disk.available < 20",
"duration": 60,
"alert_emails": null,
"alert_phones": null,
"alert_endpoint": "http://example.com/alert_handling_endpoint",
"playbook": "",
"enabled": true,
"created_at": "2016-01-29T21:51:03.289Z",
"updated_at": "2016-01-29T21:52:06.349Z",
"lock_version": 0
}
DELETE /api/2/organizations/:organization_id/projects/:project_id/alerts/:alert_id
Example Response