Alerts: history query

Description

Retrieves a list of closed alerts matching specified fields.

Request

Method Path Content-Type Header
POST /api/v1/alerts/history/query application/json

Parameters

None.

Fields

An array of query objects containing the following filtering fields:

Alert Filter Fields

Name Type Description
rule string Rule name.
rules array An array of rule names.
metric string Metric name.

Entity Filter Fields

Date Filter Fields

Result Filter Fields

Name Type Description
limit integer Maximum number of records to be returned. Default: 1000.
Limit is not applied if the parameter value <= 0.

Response

An array of matching alert objects containing the following fields:

Fields

Field Type Description
entity string Entity name.
metric string Metric name.
rule string Rule name.
ruleExpression string Rule expression.
ruleFilter string Rule filter.
severity string Severity code.
tags string Concatenated name=value pairs, for example file_system=/dev/sda1;mount_point=/
repeatCount integer Number of times when the expression evaluated to true sequentially.
alert string Alert message.
window string Window length.
value double Last numeric value received.
type string Alert state when closed: OPEN, CANCEL, REPEAT
date string ISO date.
alertOpenDate string Alert open date in ISO format.
alertDuration number Time in milliseconds for alert in OPEN or REPEAT state.
receivedDate string Last value received date in ISO format.

Errors

Status Code Message
404 Metric ${metric_name} not found

Example

Request

URI

POST /api/v1/alerts/history/query

Payload

[{
    "metric":"nmon.cpu_total.busy%",
    "startDate": "2016-05-27T18:00:00Z",
    "endDate": "2016-05-27T18:15:00Z",
    "limit": 5
}]

curl

curl https://atsd_hostname:8443/api/v1/alerts/history \
  -k --user {username}:{password} \
  --header "Content-Type: application/json" \
  --data @file.json

Response

[{
  "date": "2016-05-27T18:08:29Z",
  "entity": "nurswgvml201",
  "metric": "nmon.cpu_total.busy%",
  "type": "CANCEL",
  "value": 12.2,
  "alert": "Cancel alert for nurswgvml201, nmon.cpu_total.busy%, {}",
  "severity": 0,
  "rule": "nmon_cpu",
  "ruleExpression": "avg() > 85 OR avg() > 30 AND entity != 'nurswgvml006'",
  "repeatCount": 6,
  "alertDuration": 420096,
  "alertOpenDate": "2016-05-27T18:01:29Z",
  "receivedDate": "2016-05-27T18:08:29Z"
}]

Additional Examples

Entity Filter

Rule Filter

Metric Filter

Multiple Queries

Date Filter

Control Fields