Event based on resolving an alarm timeout

Started by bulwer, November 15, 2012, 11:16:31 AM

Previous topic - Next topic

bulwer

Hi,

I installed NetXMS a couple of days ago and like what I see so far. I will play with advanced stuff later but for now I just want to add all of our routers and servers across 35 sites and have it tell us when they are down. However, because a lot of our sites are linked with ADSL lines which go down quite often, I only want an email after 5 minutes of being down.

I have got this working by using the Alarm Timeout so when the Alarm Timeout kicks in after 5 minutes, we get an email and this works great. However, I am struggling to come up with a way to get it to email us when the node is back up but only if the Alarm Timeout alarm was raised. I have set it to resolve the alarm timeout when the node comes up but if I add the email at that point, it will email me every time a node comes back up so we will get emails saying a node is up when we didn't get one to say it was down as it was only down for less than 5 minutes.

Is there a way I can add an Event Policy to run when an Alarm Timeout is resolved?

Many thanks

Victor Kirhenshtein

Hi!

You can achieve this by storing timestamp of node down event and checking it on node up. You can use custom attributes and scripting for this. For example, you can create the following script in script library, named "OnNodeDown" for example:


SetCustomAttribute($node, "nodeDownTimestamp", time());


then create action "execute script" to execute "OnNodeDown" script, and add it in event processing policy to the rule processing SYS_NODE_DOWN event.

Then create separate rule for sending e-mails on SYS_NODE_UP, with additional filtering script like this:


t = GetCustomAttribute($node, "nodeDownTimestamp");
interval = time() - t;   // get interval in seconds between down and up events
return (interval >= 300);


With this filtering script, only SYS_NODE_UP events happens 5 or more minutes later then SYS_NODE_DOWN event will pass the filter.

More information about scripting you can found here: http://wiki.netxms.org/wiki/Scripting_Guide.

Best regards,
Victor

bulwer

Many thanks Victor - I have just got around to this and it works perfectly. Thanks for your help.