Anonymous_User Absent Member.
Absent Member.
1412 views

Re: Extracting aggregate data from alarms


Hi,
thank you for your answer. I implemented your suggestions and it works.
I managed to have the adapter get the metricTotal. I used
computeOnGet="true" as I need a value calculated from current alarms on
an element.
From the support team I got an interesting suggestion that I would like
to share.
When accessing alarms from javascrit, it is mandatory to first copy the
alarm array (java) to a local variable (javascript) and then working on
the copied array as every access to the alarm array causes a copy into
the javascript engine. An example will illustrate this:

// element is the current element, property is an alarm property
var n = element.alarms.length
for (var i = 0; i < n; i++) {
myProp=element.alarms.property;
}

would cause a copy of the element.alarms array into javascript n + 1
times, as every time I access element.alarms a copy is performed.

var myAlarms = element.alarms;
var n = myAlarms.length;
for (var i = 0; i < n; i++) {
myProp=myAlarms.property;
}

In the following example only one copy of element.alarms from java to
javascript is performed.
I had some 10.000 alarms open on an element, the first script would
take several hours, the second only a few minutes.


--
ebomitali
------------------------------------------------------------------------
ebomitali's Profile: http://forums.novell.com/member.php?userid=75412
View this thread: http://forums.novell.com/showthread.php?t=441835

Labels (1)
0 Likes
12 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


Since alarms can open and close (and update) while you are walking
through the array of alarms, it is good idea to make a copy, I probably
would have tried...

myAlarms = elements.alarms /* grab all of them */

Then walk through the myAlarms array, I wonder if that might speed
things up further for you.


--
tisenberg
------------------------------------------------------------------------
tisenberg's Profile: http://forums.novell.com/member.php?userid=56548
View this thread: http://forums.novell.com/showthread.php?t=441835

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


I need to do something similar, I think. I've got automations set to
trigger on "Element at Critical condition", which runs a predefined
script that opens a ticket in ServiceNow. I would like to be able to
pull in the detailed message (AgentMsgshort or AgentMsglong) from the
alarm that caused the element to go critical so that I can put this
information into the ticket. Is this possible?

Thanks.

Steve


--
csssl
------------------------------------------------------------------------
csssl's Profile: https://forums.netiq.com/member.php?userid=6773
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


Have you tried....

formula.log.info( "Msgshort: " + alarm.AgentMsgshort )
formula.log.info( "Msglong: " + alarm.AgentMsglong )

If that doesn't work, you will need to turn on the debugger for the
automation script, remember, the automation debugger will start on the
actual NOC server. You can log at the alarm object and see what
properties are on it, it may be named slightly different or have a
different case. Put the following as your first line of your java
script...

// @debug on


--
tisenberg
------------------------------------------------------------------------
tisenberg's Profile: https://forums.netiq.com/member.php?userid=1851
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


I am not familiar with the running the server-side debugger. I've tried
setting our current debugger's Operation Definition to "Server script".
I also set the logging category Automation.Script to debug. I also tried
the debugger under Automation -> Scripts. formula.trc errors with "ERROR
Script - Can't open debugger".


--
csssl
------------------------------------------------------------------------
csssl's Profile: https://forums.netiq.com/member.php?userid=6773
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


For server based scripts to launch in the debugger, the NOC process must
have proper permissions to open up a new GUI based window which may not
be simple when NOC is running via a Service. On your development
system try starting NOC by hand (IE: noc\bin\mosdaemon).

Also, I think all you need to do after that is add the following line as
the first line of your automation script...

// @debug on


--
tisenberg
------------------------------------------------------------------------
tisenberg's Profile: https://forums.netiq.com/member.php?userid=1851
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


My previous response assumed you are running NOC on a windows server, if
you are running on Unix, then it needs a valid head (ie: X Server) to
start the debugger. Set the X display to a valid/real head prior to
starting NOC. When the automation fires, the debugger window will be
displayed on that console.

If you are still unable to get it working, please reach out to support
to assist you in getting the debugger working.

Regardless, please update this forum port to give us an update.


--
tisenberg
------------------------------------------------------------------------
tisenberg's Profile: https://forums.netiq.com/member.php?userid=1851
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


Thanks. I've got the debugger working. Are there any tricks to finding
the right variable? A search function would be helpful.


--
csssl
------------------------------------------------------------------------
csssl's Profile: https://forums.netiq.com/member.php?userid=6773
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


Once you script launches in the debugger, if you look in the bottom left
there is a list of objects/variables. If you expand "alarm" you can see
the methods/functions available. What you are looking for is the actual
property so something like:

I looked in the debugger in a clientscript context which will be
slightly different.

-alarm
AgentMsgLong

If you find something and what to see it, on the right side, switch from
Watch to Evaluate and type in

alarm.AgentMsgLong

Hit enter and see the contents. A blank like means empty.

Again, depending on the automation type you select, you might be dealing
with alarm or alarms. Alarms is an array of alarms and you would expand
alarms then where n is a number representing the array position.
Once you expand , it is pretty much the same. Only difference in the
Evaulate tab would be...

alarms[0].AgentMsglong

Let me know if that helps... or caused more problems 🙂


--
tisenberg
------------------------------------------------------------------------
tisenberg's Profile: https://forums.netiq.com/member.php?userid=1851
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


I’ve tried exploring in the server-side debugger, but I don’t really
know where to begin. There are no “alarm” properties other than
alarmChannels, alarmColumnInfo, etc. All of which require even more
exploring by hand. If I could dump all this information to a file and
then search it, that would be fine. Is there a way to do that?
Here are screenshots of what I am looking at:

200
201


+----------------------------------------------------------------------+
|Filename: ss2.png |
|Download: https://forums.netiq.com/attachment.php?attachmentid=201 |
+----------------------------------------------------------------------+

--
csssl
------------------------------------------------------------------------
csssl's Profile: https://forums.netiq.com/member.php?userid=6773
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


Please provide a screen shot of the automation that is set up so I can
see the type of filter, action, etc


--
tisenberg
------------------------------------------------------------------------
tisenberg's Profile: https://forums.netiq.com/member.php?userid=1851
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


As requested...

202


+----------------------------------------------------------------------+
|Filename: ss3.PNG |
|Download: https://forums.netiq.com/attachment.php?attachmentid=202 |
+----------------------------------------------------------------------+

--
csssl
------------------------------------------------------------------------
csssl's Profile: https://forums.netiq.com/member.php?userid=6773
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Extracting aggregate data from alarms


Sorry, I was telling you to look at an alarm when your automation is
based on an element. Is the property you are looking for a property on
the element or within an alarm?

ie: if you right-click on an element, choose properties, is the thing
you looking for on one of the tabs? If you double click on an alarm, is
the property on one of the tabs?

If you are on an element, and the property is in an alarm. You would
have to walk element.alarms.... which alarm would you use to pull the
property? What if the value is different on some of the alarms?

sorry, just trying to run through several possible options since
assistance via the forum may not be very expedient. 🙂


--
tisenberg
------------------------------------------------------------------------
tisenberg's Profile: https://forums.netiq.com/member.php?userid=1851
View this thread: https://forums.netiq.com/showthread.php?t=1159

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.