Alerts: query

Description

Retrieves open alerts for specified filters.

Request

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

Parameters

None.

Fields

An array of query objects containing the following fields:

Alert Filter Fields

Name Type Description
rules array Array of rules which produced the alerts.
metrics array Array of metric names to filter alerts.
severities array Array of severity names
minSeverity string Minimal severity name filter.
acknowledged boolean Acknowledgement status. If set, filters alerts for the specified status.

Note

tags filter is not supported.

Entity Filter Fields

Date Filter Fields

  • [Required]
  • Date conditions are applied to alert openDate.
  • Refer to date filter.

Result Filter Fields

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

Response

An array of matching alert objects containing the following fields:

Fields

Field Type Description
id integer Alert id.
acknowledged boolean Acknowledgement status.
entity string Entity name.
metric string Metric name.
rule string Rule name.
severity string Severity name.
tags object Object containing name=value pairs, for example tags: {"path": "/", "name": "sda"}
repeatCount integer Number of times when the expression evaluated to true sequentially.
textValue string Text value.
value double Last numeric value received.
openValue double First numeric value received.
openDate string Alert open date in ISO format.
lastEventDate string Date of the last received record in ISO format.

Errors

None.

Example

Request

URI

POST /api/v1/alerts/query

Payload

[
  {
    "metrics": [
      "loadavg.5m",
      "message"
    ],
    "entity": "nurswgvml007",
    "minSeverity": "MINOR",
    "startDate": "2016-05-07T04:00:00Z",
    "endDate": "2016-06-25T05:00:00Z"
  }
]

curl

curl https://atsd_hostname:8443/api/v1/alerts/query \
  -k --user {username}:{password} \
  --header "Content-Type: application/json" \
  --data '[{"metrics":["loadavg.5m","message"],"entity":"nurswgvml007","minSeverity":"CRITICAL"}]'

Response

Payload

[
    {
        "id": 13,
        "entity": "nurswgvml006",
        "tags": {
            "file_system": "/dev/sdc1",
            "mount_point": "/media/datadrive"
        },
        "repeatCount": 106,
        "textValue": "61.365",
        "metric": "disk_used_percent",
        "severity": "CRITICAL",
        "rule": "disk_low",
        "acknowledged": false,
        "openDate": "2018-05-12T13:39:37Z",
        "openValue": 61.3998,
        "lastEventDate": "2018-05-12T14:57:42Z",
        "value": 61.3651
    }
]

Additional Examples

Entity Filter

Rule Filter

Metric Filter

Multiple Queries

Time Range

Alerts Severity

Filter Status