Alarm key SERVICE_DOWN_ => Function or operation argument is not an object
-
alarm = FindAlarmByKeyRegex("SERVICE_DOWN_.*");
works for me, but only if there are alarms that have SERVICE_DOWN_. If there aren't any, you'll get a "Function or operation argument is not an object" if you try to println alarm->message because alarm isn't an object. Alarm would be set to NULL in this case, so best to check for this:
if (alarm != NULL)
println alarm->message; -
-
But, I think this is not the right way...
a_key = %("NODE_DOWN_.*","SERVICE_DOWN_.*","IF_DOWN_.*","IF_UNEXP_UP_.*","BAD_NETMASK_.*","SCRIPT_ERR_.*","DCI_STATUS_.*","DC_THRESHOLD_.*","DCTTHR_.*","SYS_THREAD_HANG_.*","MAINTENANCE_MODE_.*","AGENT_UNREACHABLE_.*","SNMP_UNREACHABLE_.*","SYS_LDAP_SYNC_ERROR_.*","SYS_AGENT_LOG_PROBLEM_.*","SYS_AGENT_LOCAL_DATABASE_PROBLEM_.*","MAC_ADDRESS_CHANGED_.*","BAD_NETMASK_.*","ROUTING_LOOP_.*","SW_PKG_.*"); for (i = 0; i < a_key->size; i++ ) { alarm = FindAlarmByKeyRegex(a_key[i]); if (alarm != NULL) { println (alarm->key) . (alarm->message) . "\n"; } } NODE_DOWN_0x000099C6Node down SCRIPT_ERR_Template::Zone Proxy::108_Error in line 1: syntax error, unexpected $end, expecting ';'Script (Template::Zone Proxy::108) execution error: Error in line 1: syntax error, unexpected $end, expecting ';' MAC_ADDRESS_CHANGED_0x0001EDB7_1MAC address for interface unknown changed from XX:XX:XX:XX:XX:XX to XX:XX:XX:XX:XX:XX *** FINISHED *** Result:I have a lot of errors and "alarm->message" does not return all the information.
Do you know if it is possible to get about the same result in "Alarm Browser"? -
-
-
The script in your example returns only one alarm for each key. E.g. if you have several node with NODE_DOWN alarm, only one will be returned.
Can you give some information on what you are trying to achieve as the final result?
-
Hi,
I'm trying to get the logs as displayed in the "Alarm Browser" window.
As I said, this may not be the right way to do it :-[I have now gone another way, exporting the alarms when they appear using the "Event Processing Policy" and an associated "Action".
But then I'll have to manage the acknowledgements myself ... etc...BB
-
Hi,
you can access all alarms via "Entire Network" or "Infrastructure Services" objects. FOr example, the following script will print all alarm messages:
for(a : FindObject(1)->alarms) { println a->message; }Best regards,
Victor -
hi,
Thank you, this has inspired me a lot!
Now I can display the id, name and message of each alarm.
for (n : GetAllNodes()) { for(a : n->alarms) { println n->id . "\t" . n->name . "\t" . a->message; } }But I don't know how to display the date ?
Thanks for your help.
BB -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login