Skip to main content

getAlertIds

A MoogDb v2 method that returns the total number of alerts, and a list of the alert IDs, for an alert filter and a limit.

Back to MoogDb V2 API Method Reference.

Request arguments

Method getAlertIds takes the following request arguments:

Name

Type

Required

Description

query

JSON Object

Yes

An SQL-like filter that alerts must match to be returned.

See Filter Search Data for more information on creating SQL-like filters.

limit

Number

Maximum number of alert IDs to return.

Response

Method getAlertIds returns the following response:

Type

Description

Native Object

A JSON object containing the total number of alerts and their alert IDs.

Examples

The following examples demonstrate typical use of method getAlertIds:

Request example

Example request to return the first 10 alert IDs that satisfy the filter where the type is LinkDown:

var target_alerts = moogdb.getAlertIds("type = LinkDown",10);
logger.warning("moogdb.getAlertIds result - total_alerts = " + target_alerts.total_alerts + " and alert_ids = " + target_alerts.alert_ids);

Response example

Example response returning the first 10 alert IDs:

{
     "total_alerts":10,
     "alert_ids":[4, 5, 6, 12, 14, 15, 16, 17, 18, 19]
}