Getting information about alert condition violations

Ops Center Analyzer Detail View REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA004-11

You can obtain information about alert condition violations in a single request.

When you create an alert definition, the time (in GMT format) is recorded on the Analyzer detail view and is attached to the matching resources. The alert definition is then attached to the matching resources. If you create an alert definition when there is a delay in the data import, then the violation computation occurs only after the import time reaches the alert creation time.

The following table shows the behavior of getAlerts API function in different scenarios.

Alert definition creation time Data import time Time window Violation computation getAlerts API output Remark
8:00 AM 6:00:00 AM (delay in the data import) 6 AM – 7:59 AM No No Alert definition does not exist in a given time window.
8 AM – 10 AM Yes Yes Returns violation from 8:00 AM to 10:00 AM.
7 AM – 9 AM Yes (8 AM - 9 AM) Yes (8 AM - 9 AM) Alert definition does not exist for the time window 7:00 AM to 8:00 AM. Returns violation from 8:00 AM to 9:00 AM.

This same behavior is applicable while updating the alert violation threshold.

Request line

baseURL/alertapi.do?action=getAlerts&from=<from>&to=<to>

Request parameters

Parameter Type Description
from String Start of the specified time period in yyyyMMdd_HHmmss. The default time period is in the UTC time zone, unless the utcOffset parameter is specified.
to String End of the specified time period in yyyyMMdd_HHmmss. The default time period is in the UTC time zone, unless the utcOffset parameter is specified.
utcOffset String (Optional)

UTC offset for the from and to time period.

The valid UTC offset string example UTC+05:30, UTC-08:00

If requested, the time period in the response message uses the UTC time zone format.

alertIds Integer[ ] (Optional)

Gets violations for the specific alerts.

For HTTP-GET, list of comma separated alertIds.

For HTTP-POST, array of alertId strings.

If not requested, the API returns alert violation data for alertIds present in the specified time window.

resources String[ ] (Optional) Gets violations for specified resources.

For HTTP-POST, array of resource signature strings.

This parameter cannot be specified using the HTTP-GET request.

severity String (Optional) Severity of alert definition: critical or warning.

Request examples

The following request returns all violations generated in a given time period:

GET /alertapi.do?action=getAlerts&from=20151201_203000&to=20151201_223000
POST /alertapi.do?action=getAlerts
{  
   "from":"20151201_203000",
   "to":"20151201_223000"
}

The following request returns all violations for a particular ID generated in a given time period:

GET /alertapi.do?action=getAlerts&from=20151201_203000&to=20151201_223000&alertIds=123231
POST /alertapi.do?action=getAlerts
{  
   "from":"20151201_203000",
   "to":"20151201_223000"
   "alertIds":[123231]
}

The following request returns all violations for a particular severity generated in a given time period:

GET /alertapi.do?action=getAlerts&from=20151201_203000&to=20151201_223000&severity=critical
POST /alertapi.do?action=getAlerts
{  
   "from":"20151201_203000",
   "to":"20151201_223000",
   "severity":"critical"
}

Response body

[
  {
    "alertId":"",
    "name":"",
    "severity":"",
    "violations":{
      "XXX":[
        "",
        "",
        ""
      ],
      "YYY":[
        "",
        "",
        ""
      ]
    }
  }
]
Note: The violations object in the response message indicates when the violation occurred. The Key in this object is the resource signature, and the value is an array of time period in YYYYMMDD_HHMMSS format. The default time is in the UTC time zone. However, if the utcOffset parameter is specified as input then the time is shown is the same time zone and utcOffset key specifies the time zone in the output.

Response example

[
  {
    "alertId":"123213",
    "name":"Production VMs High CPU Usage",
    "severity":"critical",
    "violations":{
      "XXX":[
        "20151201_203000",
        "20151201_203300",
        "20151201_203400"
      ],
      "YYY":[
        "20151201_203200",
        "20151201_203300",
        "20151201_203400"
      ]
    }
  }
]

Status codes

Status code

Message

Description

400 BAD REQUEST Request URL or request body validation failed. Check the response body for details.

For a list of alert API response codes, see Alert API response error codes and messages.