You can subscribe to alert notifications by configuring the SMTP, Syslog server, and SNMP Manager.
Note: You must configure the SMTP server to receive
email alert notifications. The SMTP, Syslog server, and SNMP Manager configuration is a
one-time activity that should be performed from the Analyzer detail view UI.
Request line
POST baseURL/alertapi.do?action=subscribeAlertDef
The request payload is an array of subscription JSON objects.
Request body
[ { "alertId":, "subscription":{ "email":{ "id":[ "", "" ], "damping":"" }, "syslog":{ "server":[ "", "" ] }, "snmp":{ "manager":[ "", "" ] } } } ]
Request example
As part of the subscription, you must specify the notification settings in the notification object.
POST /alertapi.do?action=subscribeAlertDef
[ { "alertId":122131, "subscription":{ "email":{ "id":[ "xxx", "yyy" ], "damping":"no_damping" }, "syslog":{ "server":[ "hostname:portNo:TCP", "IP:portNo:UDP" ] }, "snmp":{ "manager”: [ "hostname", "IP" ] } } } } ]
You cannot modify an existing subscription, but you can replace it by sending another request which overwrites the original subscription.
Request parameters
Parameter |
Type |
Description |
---|---|---|
alertId | Integer | Alert definition ID to be subscribed. |
subscription | Object | Subscription details. |
Response structure
{ "subscribed":{ "alertId":[ 1 ] } } { "failed":[ { "alertId":, "error":"", "code":"" } ] }
Response examples
Success
{ "subscribed":{ "alertId":[ 1 ] } }
Error
{ "failed":[ { "alertId":12, "error":"Alert definition with id:[12] not found.", "code":"A5040010" } ] }
SNMP examples
{ "failed":[ { "alertId":10, "error":"SNMP Manager(s) [192.168.20.10] does not exist.", "code":"A5040010" } ] }
{ "failed":[ { "alertId":-10, "error":"SNMP Manager cannot be subscribed for system level alerts.", "code":"A5040010" } ] } { "failed":[ { "alertId":-10, "error":"SNMP Manager cannot be subscribed for system level alerts.", "code":"A5040010" } ] }
Note: This error message is received when you try to subscribe the SNMP notifications for system level alert definitions, the system level alerts do not support SNMP notifications.
Status codes
Status code |
Message |
Description |
---|---|---|
277 | PARTIAL OK | Request completed successfully with some failures. Check the response body for details. |
500 | SERVER ERROR | API operation request failed. Check the response body for details. |
Response codes
The following table lists the alert API response codes that might be generated through the standard API. If an error response is not listed, examine the HTTP status codes to determine the best method for addressing the issue.
Response code | Message | Condition |
---|---|---|
A5010005 | Invalid {emailIds} specified [yyy, abc@@gmail.com]. | Invalid email IDs are specified. |
A5010006 | Invalid {damping} specified. | Invalid damping. |
A5010006 | Invalid {alertId} specified. | Invalid alert ID. |
A5010005 | Invalid {sysLogServer} specified [hostName]. | Invalid Syslog server. |
A5040010 | Alert definition with id:[12] not found. | Alert definition ID not found. |
A5020019 | Found invalid properties [resources, unknownKey]. | Invalid key is specified. |