AIOps

AIOps

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#ITAutomation
#AIOps
#CloudPakforAIOps
#AIOps

 View Only

Cloud Pak for AIOps 4 tips: create a right-click tool to update an alert

By Zane Bray posted 27 days ago

  
image

People familiar with Netcool/OMNIbus will also be familiar with the process of creating a right-click SQL tool that updates the selected event. This blog outlines how to achieve the same thing in IBM Cloud Pak for AIOps (AIOps).

ISSUE RESOLUTION API

AIOps includes a number of APIs that enable interaction with it from internal and external sources in approved ways. One of the APIs available is called the Issue resolution API which enables actions against events, alerts, and incidents. In this blog, we will use the alerts API to patch a selected alert, which is the method needed to update it. The patch operation takes the id of an alert and the payload of the patch operation is simply the attributes and new values we want the patched alert to have.

image

CREATE AN ACTION

In AIOps, Actions are used by both right-click tooling and Runbook Automation (RBA). Unlike Netcool/OMNIbus, AIOps does not have the notion of an SQL tool; instead it enables all equivalent actions via APIs. The HTTP Action type in the AIOps UI provides you with a convenient way to directly access the Issue resolution API. The other API options are "Runbook Automation API", and "Custom API" for anything else.

Use these steps to create the new Action:

  • Log in to AIOps as an administrator
  • Click on the hamburger menu > Automation > Actions > Create action
  • Choose HTTP type and give your Action a name: eg. "Close alert"
  • Create a Parameter of type string and call it "id" to hold the alert id value
  • Expand the "Action HTTP request" section
  • Click on "API endpoint" and select "Cloud Pak for AIOps Issue resolution API"
  • Append alerts/$id to the path
  • Select PATCH as the Method, since we will be updating the alert
  • Add some JSON to the Body section which contains the update - eg. set the "state" attribute to "closed" in this case
  • Add application/json to the "Content-Type" section

Your Action should now look something like the following:

image

NOTE: the Action doesn't require any authentication headers as it automatically uses the token of the logged-in user.

TEST YOUR ACTION

Next we will test our newly created action. Open an Alert viewer in another tab, select an alert, and copy the value of the id property:

image

Go back to your Action creation window and click on the "Test" button. Paste the copied id value into the Parameter box and click Run. The Action will do a test run using the supplied parameter and will give you the result in the output window:

image

Go back to your Alerts viewer in the other tab and refresh the alert view. You should see the selected alert move to a "Closed" state:

image

If your new Action works correctly, go back to your Action creation tab and click the "Edit action" button to go back to the Action configuration window, then click on the "Publish" button to save your new Action and make it available for use.

ADD A RIGHT-CLICK TOOL

The final step is to add your newly created Action to a right-click tool in the Alerts viewer. Go back to your Alerts viewer, click on the "Settings" cogwheel in the top-right corner, and select "Configure alerts contextual menu".

In the tool configuration page, click on the "Add menu item" button in the top-right corner of the screen. Create a new menu item as follows:

  • Give your menu item a name under "Menu item label" - eg. "Close alert"
  • Select who can use, edit and manage this menu item - eg. choose "Everyone"
  • Leave the default "Use this menu item" for now
  • Select an action - choose your newly created Action "Close alert"
  • Under "Map action parameters" choose where the tool should get the input parameter id from
  • Select "Choose from alert" and select alert.id from the drop-down menu

You should now have something that looks like the following:

image

Click on the "Save" button to save your new menu item, then click "Save" again to save your menu configuration. You will be returned to the Alert viewer screen and should now have access to the new right-click tool via the right-click menu that allows you to close alerts at-will.

0 comments
20 views

Permalink