Check monitoring

Post Monitoring Check Reports

This will transmit a monitoring check report to Mackerel. Monitoring reports are restricted to hosts.

POST /api/v0/monitoring/checks/report

The implementation described in Adding monitors for script checks is used. The agent will periodically transmit the list of configured monitoring checks to the Update Host Information API and any monitoring checks not included in that list and those which do not have any open alerts will be deleted from Mackerel at that time. Posts will be ignored in the following cases:

  • When the time of monitoring time proceeds the time of posting by 6 hours or more
  • When a monitoring time has already been posted with the same name / host

Required permissions for the API key

  • Read
  • Write

Input

{
  "reports": [ <report>, <report>, … ]
}

<report> : an object that holds the following keys. Up to 100 <report> can be sent with one API request.

KEY TYPE DESCRIPTION
source source refer to the note below
name string monitor name
status string alert status of the monitor report. "OK", "CRITICAL", "WARNING", or "UNKNOWN"
message string auxiliary text attached to the alert status of the monitor report, under 1024 characters
occurredAt number unix timestamp of execution
notificationInterval number [optional] Notifications will not be re-sent if the time interval (in minutes) is omitted. If the time interval is set for less than 10 minutes, the notifications will be re-sent at an interval of 10 minutes.
maxCheckAttempts number [optional] number of consecutive Warning/Critical instances before an alert is made*1. Default setting is 1 (1-10)

source : an object that holds the following keys

KEY TYPE DESCRIPTION
type string fixed character string "host"
hostId string host ID (given by the server when the host was registered)

Response

Success

{
  "success": true
}

Error

STATUS CODE DESCRIPTION
403 when the API key doesn't have the required permissions / when accessing from outside the permitted IP address range
other than 200 any error other than the above

*1 maxCheckAttempts

If maxCheckAttempts is 2 or more, the check monitor posting interval must be within 6 hours in order to run normally.