Updating an alert threshold

Ops Center Analyzer Detail View REST API Reference Guide

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

You can update the threshold value for the resources and add or remove the resources from the alert definition.

Request line

For example: suppose you have created an alert on the MPB (raidMPB#12345-MPB-2MA) and you want to update this value with 40. See the following request:

update":[  
         {  
            "signature":"raidMPB#12345-MPB-2MA",
            "threshold":[  
               40
      ]
     }
   ]

After updating, the raidMPB#12345-MPB-2MA resource, an alert will be generated every time it exceeds the updated threshold value.

POST baseURL/alertapi.do?action=updateAlertDef

Request payload is an array of JSON objects.

Request body

[
  {
    "alertId":,
    "update":[
      {
        "signature":"",
        "threshold":[
          
        ]
      }
    ],
    "remove":[
      ""
    ]
  }
]

Request example

POST /alertapi.do?action=updateAlertDef
[
  {
    "alertId":1,
    "update":[
      {
        "signature":"vm#vm1",
        "threshold":[
          40
        ]
      }
    ],
    "remove":[
      "vm#vm2"
    ]
  }
]

Request parameters

Parameter Type Description
alertId Integer ID of the alert definition.
update Object[ ] Collection of resources to be added or updated to the alert definition.
update:signature String Signature of the resource.
update:threshold Float[ ] (Optional) Threshold value for a resource.

Float:

  • Maximum value = Java Float.Max value i.e., +3.4028235 E 38.
  • Minimum value = Java Float.Min value i.e., - 3.4028235 E 38.
update:threshold (for having condition String (Optional) Threshold value for having condition.

The threshold field for having condition supports alphanumeric, hyphen (-), underscore (_) , comma (,), colon (:), at (@), slash (/), dot (.), and space.

remove String[ ] Collection of resources to be removed from the alert definition.

Note: If you have created an alert definition using resource_mql, then you cannot remove the resources from the alert definition.

Note: A parameter specified as a:b indicates the b field of JSON object a.

Response examples

Success

[
  {
    "alertId":23423,
    "status":"updated"
  }
]

Error

[
  {
    "alertId":1,
    "status":"partially updated",
    "failed":[
      {
        "reason":"Failed to remove resource [vm#vm2]. It doesnot exist in alert definition with id:[1].",
        "code":"A304000B",
        "signature":"vm#vm2"
      }
    ]
  }
]

Return 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
A304000C Failed to add resource [vm#vm16], resource does not exist. An attempt to add a resource that is not available in the cache.
A304000B Failed to remove resource [vm#vm5], it does not exist in the alert definition with id:[2]. An attempt to remove a resource that has not been defined for the alert.
A3040010 Alert definition with id:[12] is not found. The alert definition is not be available for specified ID.
A3020019 Found invalid properties [resources, unknownKey]. Invalid key is specified.
A3020023 Failed to edit alert [173] using alert API as it is created from UI The UI alerts added in the Analyzer detail view v10.5.0-01 onwards cannot be edited through REST API.
A3040013 Application encountered an internal error. API server encountered an unknown error.