Alerts API - anodot/daria GitHub Wiki

Daria agent provides API endpoints that allow you to get triggered alerts of your Anodot account.

Contents

Get alert status by alert group name

Endpoint:

/alert/status
Parameter Type Required Description
alertName String Yes Name of an alert group
host String No Value of the host dimension of alert metrics
startTime Integer No Retrieve alerts which started after this time (epoch time), default one week

Request example:

curl -X GET http://locahost:8080/alert/status?alertName=drop_in_bps&host=us_host18

Response:

{
  "status": "OPEN"
}

If no alert was found by specified parameters the response will be { "status": "No alert" }

Get all alerts by status

Endpoint

/alerts
Parameter Type Required Description
status String Yes Get alerts wit status: OPEN, CLOSE
sort String No Sort alerts by field, possible values: startTime, updateTime, score, metrics. Default - updateTime
order String No Alerts sort order: asc, desc. Default - desc
startTime Integer No Retrieve alerts which started after this time (epoch time), default one week. Notice: this filter will be applied only for CLOSE status. In case of OPEN status all open alerts will be returned.

Request example:

curl -X GET http://locahost:8080/alerts?status=OPEN

Response:

{
  "alertGroups": [
    {
      "alerts": [
        {
          "startTime": 1623223687,
          "updateTime": 1623223687,
          "endTime": 1623223687,
          "status": "OPEN",
          "type": "anomaly",
          "metrics": [
            {
              "host": "us_host18",
              "what": "traffic_in",
              "score": 0.8723423
            }
          ]
        }
      ],
      "id": "33b5676573-80as-4k73-99ca-asdf8897afdafya",
      "name": "Drop in traffic in"
    }
  ],
"total": 1
}

Error response

In case a request contained an error in a field, or had a missing field, the response will contain "status": "Abnormal request" and a list of errors with their description.

Error response example:

{
  "status": "Abnormal request",
  "errors": {
    "alertName": ["This field is required."],
    "startTime": ["Not a valid integer value"]
  }
}

In case the agent wasn't able to send a request to Anodot, the response will contain "status": "Not connected" and a list of errors describing the connection issue.

Error response example:

{
  "status": "Not connected",
  "errors": {
    "Unauthorized": ["401 Client Error: Unauthorized for url: https://api.anodot.com/api/v2/alerts/triggered"]
  }
}