How to access delay timer key in NXSL?

Started by pedrong, January 15, 2019, 12:42:16 PM

Previous topic - Next topic

pedrong

Hi All, I am trying to create a filtering script to check if a delay timer key has expired or not.  Is there any NXSL Class serves such purpose?

Here is what I am trying to achieve :-

1) Delay the email alert by 180 seconds if any node/interface is down [Done]
2) When the node/interface is up and the delay timer is still within 180 seconds, no email alert. Otherwise, an email alert on the node/interface is UP.

Any help is greatly appreciated!

Pedro

token

You can configure Processing Policy like in attached image.

Note a difference between variables %i and %I. They are points to a same data - object ID but %i represent it in hex value and %I represent in decimal value. Used in script $node->id returns value in decimal, so the timer key must be generated with decimal value too.

pedrong

hi Token, thank you so much for your reply! The trick is very useful!

Filipp Sudanov

In addition - a good practice is to use expandString function, e.g.
key = $event->expandString("TIMER_DC_THRESHOLD_%I_%<dciId>");

in this case you just use the same string with macros as when specifying timer key, so there's no need to compose the key manually.

Filipp Sudanov

Also, in 3.5 there's now an ability to skip action, if a particular timer is running. So your condition should now fit into 2 EPP rules.