Moogsoft Docs

getAlertActions

A MoogDb v2 method that returns the actions for one or more alerts or for a time period.

Back to MoogDb V2 API Method Reference.

Request arguments

Method getAlertActions takes the following request arguments:

Name

Type

Required

Description

alert_ids

JSON Array of Numbers

No

List of alert IDs.

start

Number

Yes

Starting row from which data should be included.

limit

Number

Yes

Maximum number of actions you want to return.

actions

Array of Numbers

No

List of action codes. If no action codes are specified, all action codes are returned. See Alert Action Codes for a list of action codes and their descriptions. Only action codes 8 (Alert Resolved) and 9 (Alert Closed) are valid.

from

Number

No

Start time of the period you want to retrieve alert actions for. This is in Unix epoch time in seconds.

to

Number

No

End time of the period you want to retrieve alert actions for. This is in Unix epoch time in seconds.

Response

Method getAlertActions returns the following response:

Type

Description

Native Object

A JSON object containing the alert action information.

API behavior in active and historic databases

The behavior of this method depends on whether the relevant alert or Situation is open, closed and still in the active database, or closed and archived to the historic database. This method updates or returns information about the alert or Situation as follows:

See API Update Behavior for more information on Situation statuses.

Examples

The following examples demonstrate typical use of method getAlertActions:

Request examples

Example request to return alert actions:

var actions = moogdb.getAlertActions(request);

Example request object to return the first 100 actions for alert IDs 1 and 2 for action codes 8 and 9:

{
  “alert_ids” : [1, 2],
  “start”: 0 ,
  “limit” : 100,
  “actions” : [8, 9]
}

Example request object to return the first 100 actions for alert IDs 1 and 2 for action codes 8 and 9 between the Unix epoch times 1553861746 and 1553872546:

{
           "alert_ids" : [1, 2],
           "limit" : 100,
           "actions" : [8, 9],
           "from" : 1553861746,
           "to" : 1553872546 
}

Response example

Example response returning alert actions with action codes 8 (Alert Resolved) and 9 (Alert Closed):

[{
    "uid": 49,
    "action_code": 8,
    "description": "Alert Resolved",
    "details": {},
    "alert_id": 1,
    "timed_at": 1557504393
    }, {
    "uid": 49,
    "action_code": 9,
    "description": "Alert Closed",
    "details": {},
    "alert_id": 1,
    "timed_at": 1557504912
    }
}]