Environment
NetIQ Operations Center
Situation
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?
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?
Resolution
Here is the server-side sample code which shows how alarm comments can be read:
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]
command=null
context=alarm
description=Read alarm comment
operation=operation=load("support/readAlarmComment")
permission=view
target=namematch:.*
type=serverscript
----------------------------------------
//@debug off // var comments = ""; comments = element.getAnnotationHistory(alarms[0].persistentId,"MinimalHTMLForPortlet"); formula.log.info(comments); 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]
command=null
context=alarm
description=Read alarm comment
operation=operation=load("support/readAlarmComment")
permission=view
target=namematch:.*
type=serverscript
----------------------------------------