alerts
Creates, updates, deletes, gets or lists an alerts
resource.
Overview
Name | alerts |
Type | Resource |
Id | digitalocean.monitoring.alerts |
Fields
The following fields are returned by SELECT
queries:
- uptime_get_alert
- uptime_list_alerts
The response will be a JSON object with a key called alert
. The value of this will be an object that contains the standard attributes associated with an uptime alert.
Name | Datatype | Description |
---|---|---|
id | string (uuid) | A unique ID that can be used to identify and reference the alert. (example: 5a4981aa-9653-4bd1-bef5-d6bff52042e4) |
name | string | A human-friendly display name. (example: Landing page degraded performance) |
comparison | string | The comparison operator used against the alert's threshold. (example: greater_than) |
notifications | object | The notification settings for a trigger alert. |
period | string | Period of time the threshold must be exceeded to trigger the alert. (example: 2m) |
threshold | integer | The threshold at which the alert will enter a trigger state. The specific threshold is dependent on the alert type. |
type | string | The type of alert. (example: latency) |
The response will be a JSON object with a key called alerts
. This will be set to an array of objects, each of which will contain the standard attributes associated with an uptime alert.
Name | Datatype | Description |
---|---|---|
id | string (uuid) | A unique ID that can be used to identify and reference the alert. (example: 5a4981aa-9653-4bd1-bef5-d6bff52042e4) |
name | string | A human-friendly display name. (example: Landing page degraded performance) |
comparison | string | The comparison operator used against the alert's threshold. (example: greater_than) |
notifications | object | The notification settings for a trigger alert. |
period | string | Period of time the threshold must be exceeded to trigger the alert. (example: 2m) |
threshold | integer | The threshold at which the alert will enter a trigger state. The specific threshold is dependent on the alert type. |
type | string | The type of alert. (example: latency) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
uptime_get_alert | select | check_id , alert_id | To show information about an existing alert, send a GET request to /v2/uptime/checks/$CHECK_ID/alerts/$ALERT_ID . | |
uptime_list_alerts | select | check_id | per_page , page | To list all of the alerts for an Uptime check, send a GET request to /v2/uptime/checks/$CHECK_ID/alerts . |
uptime_create_alert | insert | check_id , data__name , data__type , data__notifications , data__period | To create an Uptime alert, send a POST request to /v2/uptime/checks/$CHECK_ID/alerts specifying the attributesin the table below in the JSON body. | |
uptime_update_alert | replace | check_id , alert_id , data__name , data__type , data__notifications , data__period | To update the settings of an Uptime alert, send a PUT request to /v2/uptime/checks/$CHECK_ID/alerts/$ALERT_ID . | |
uptime_delete_alert | delete | check_id , alert_id | To delete an Uptime alert, send a DELETE request to /v2/uptime/checks/$CHECK_ID/alerts/$ALERT_ID . A 204 statuscode with no body will be returned in response to a successful request. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
alert_id | string (uuid) | A unique identifier for an alert. (example: 17f0f0ae-b7e5-4ef6-86e3-aa569db58284) |
check_id | string (uuid) | A unique identifier for a check. (example: 4de7ac8b-495b-4884-9a69-1050c6793cd6) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
SELECT
examples
- uptime_get_alert
- uptime_list_alerts
To show information about an existing alert, send a GET request to /v2/uptime/checks/$CHECK_ID/alerts/$ALERT_ID
.
SELECT
id,
name,
comparison,
notifications,
period,
threshold,
type
FROM digitalocean.monitoring.alerts
WHERE check_id = '{{ check_id }}' -- required
AND alert_id = '{{ alert_id }}' -- required;
To list all of the alerts for an Uptime check, send a GET request to /v2/uptime/checks/$CHECK_ID/alerts
.
SELECT
id,
name,
comparison,
notifications,
period,
threshold,
type
FROM digitalocean.monitoring.alerts
WHERE check_id = '{{ check_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}';
INSERT
examples
- uptime_create_alert
- Manifest
To create an Uptime alert, send a POST request to /v2/uptime/checks/$CHECK_ID/alerts
specifying the attributes
in the table below in the JSON body.
INSERT INTO digitalocean.monitoring.alerts (
data__name,
data__type,
data__threshold,
data__comparison,
data__notifications,
data__period,
check_id
)
SELECT
'{{ name }}' --required,
'{{ type }}' --required,
{{ threshold }},
'{{ comparison }}',
'{{ notifications }}' --required,
'{{ period }}' --required,
'{{ check_id }}'
RETURNING
alert
;
# Description fields are for documentation purposes
- name: alerts
props:
- name: check_id
value: string (uuid)
description: Required parameter for the alerts resource.
- name: name
value: string
description: >
A human-friendly display name.
- name: type
value: string
description: >
The type of alert.
valid_values: ['latency', 'down', 'down_global', 'ssl_expiry']
- name: threshold
value: integer
description: >
The threshold at which the alert will enter a trigger state. The specific threshold is dependent on the alert type.
- name: comparison
value: string
description: >
The comparison operator used against the alert's threshold.
valid_values: ['greater_than', 'less_than']
- name: notifications
value: object
description: >
The notification settings for a trigger alert.
- name: period
value: string
description: >
Period of time the threshold must be exceeded to trigger the alert.
valid_values: ['2m', '3m', '5m', '10m', '15m', '30m', '1h']
REPLACE
examples
- uptime_update_alert
To update the settings of an Uptime alert, send a PUT request to /v2/uptime/checks/$CHECK_ID/alerts/$ALERT_ID
.
REPLACE digitalocean.monitoring.alerts
SET
data__name = '{{ name }}',
data__type = '{{ type }}',
data__threshold = {{ threshold }},
data__comparison = '{{ comparison }}',
data__notifications = '{{ notifications }}',
data__period = '{{ period }}'
WHERE
check_id = '{{ check_id }}' --required
AND alert_id = '{{ alert_id }}' --required
AND data__name = '{{ name }}' --required
AND data__type = '{{ type }}' --required
AND data__notifications = '{{ notifications }}' --required
AND data__period = '{{ period }}' --required
RETURNING
alert;
DELETE
examples
- uptime_delete_alert
To delete an Uptime alert, send a DELETE request to /v2/uptime/checks/$CHECK_ID/alerts/$ALERT_ID
. A 204 status
code with no body will be returned in response to a successful request.
DELETE FROM digitalocean.monitoring.alerts
WHERE check_id = '{{ check_id }}' --required
AND alert_id = '{{ alert_id }}' --required;