Alerts

Getting Alerts

This will get a list of the alerts.

GET /api/v0/alerts

Required permissions for 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 id of the specified alert are retrieved.

Response

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

Alerts will be in chronological order of when they were generated from newest to oldest. A list of up to 100 items is retrieved. nextId is retrieved when there are 101 or more alerts.

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

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

Closing Alerts

The designated alert will be closed.

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

Required permissions for 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>,
  "opendAt": <opendAt>,
  "closedAt": <closedAt>
}

This is the same as the <alert> object in Getting Alerts. reason and closedAt exist.

Error

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