Alerts

Getting Alerts

This will get the list of alerts.

GET /api/v0/alerts

Required permissions for the API key

  • Read

Input (Query parameters)

You can filter alerts with the following parameters. If withClosed is not specified, only open alerts are returned. If nextId is not specified, alerts will be returned in order of latest occurrence time.

PARAM TYPE DESCRIPTION
withClosed boolean [optional] Whether or not to get resolved alerts. If true, resolved alerts as well as open alerts are retrieved.
nextId string [optional] If nextId is specified, alerts older than the alert with the specified id are retrieved.
limit number [optional] The maximum number of alerts to retrieve. When omitted, up to 100 cases are retrieved. The most that can be specified is 100.

Response

{
  "alerts": [<alert>, <alert>, ...],
  "nextId": xxx
}

Alerts will be returned in chronological order of when they were generated from newest to oldest. The nextId field is returned only when there are more alerts existing.

<alert>: an object that holds the following keys.

KEY TYPE DESCRIPTION
id string the alert's ID
status string the alert's current status: "OK", "CRITICAL", "WARNING", or "UNKNOWN"
monitorId string the ID of the monitor that generated the alert
type string the type of the monitor: connectivity ("connectivity"), host metric ("host"), service metric ("service"), external monitor ("external"), check monitor ("check"), expression monitor ("expression"), or anomaly detection for roles ("anomalyDetection")
hostId string [optional] the associated host ID. only exists when the type of the monitor is either "connectivity", "host", "check", or "anomalyDetection"
value number [optional] the value of the monitoring target. only exists when the type of the monitor is "host", or "service" or when there is a reponse time configuration in "external"
message string [optional] the monitoring target's message. only exists when the type of the monitor is either "check" or "external"
reason string [optional] the reason the alert closed. does not exist if the alert is unresolved.
openedAt number the timestamp of when the alert was generated (Unix time)
closedAt number [optional] the timestamp of when the alert was resolved (Unix time). only exists if the alert is already resolved

Error

STATUS CODE DESCRIPTION
400 when `limit` value is larger than the maximum allowed value (100)

Closing Alerts

The designated alert will be closed.

POST /api/v0/alerts/<alertId>/close

Required permissions for the API key

  • Read
  • Write

Input

{
  "reason": "<text>"
}

Any text can be appended in the reason field. This field is a required item.

Response

Success

A post-update alert will be returned.

{
  "id": "<alertId>",
  "status": "OK",
  ...
  "reason": "<reason>",
  "openedAt": <openedAt>,
  "closedAt": <closedAt>
}

The response object includes the same keys as the <alert> object in Getting Alerts. Here, the reason and closedAt fields are not optional, they will always exist.

Error

STATUS CODE DESCRIPTION
404 when the alert with the corresponding <alertId> can't be found
403 when the API key doesn't have the required permissions / when accessing from outside the permitted IP address range