Operations Center sample code - how to read alarm comment using formula script

  • 7012624
  • 18-Jun-2013
  • 18-Jun-2013


NetIQ Operations Center


NOC users can add custom comments to alarms, once they arrive, using an option built-in NOC Java client. Java client also displays these comments when requested. This way administrators can communicate and share extra knowledge. So far so good.
Sometimes, however, it would also be useful to have the possibility reading these comments from automated formula scripts. For example, administrator can attach special comment to the selected alarm, marking it for special automated handling, and regular automation can then later do the requested job. The question is then how these alarm comments can be accessed and read from formula script code?


Here is the server-side sample code which shows how alarm comments can be read:

//@debug off
var comments = "";
comments = element.getAnnotationHistory(alarms[0].persistentId,"MinimalHTMLForPortlet");
session.sendMessage("Alarm.id=" + alarms[0].persistentId + ", comments = " + comments);

First parameter passed to the function element.getAnnotationHistory() is the persistent ID of the given alarm. The second parameter is the way the output should be formatted. Function always returns the comment formatted in HTML, either for the client, or for the portlet usage, and the second parameter can only be one of following strings:
- "HTMLForClientDialog"
- "MinimalHTMLForPortlet"  

For testing can the code above be triggered for example from the right-mouse-click menu (right-click over selected alarm), using following operations.ini extension:
[Read alarm comment]
description=Read alarm comment