NetXMS Support Forum

English Support => General Support => Topic started by: pedrong on January 15, 2019, 12:42:16 PM

Title: How to access delay timer key in NXSL?
Post by: pedrong on January 15, 2019, 12:42:16 PM
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
Title: Re: How to access delay timer key in NXSL?
Post by: token on June 02, 2020, 02:14:16 PM
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.
Title: Re: How to access delay timer key in NXSL?
Post by: pedrong on June 10, 2020, 06:12:19 AM
hi Token, thank you so much for your reply! The trick is very useful!
Title: Re: How to access delay timer key in NXSL?
Post by: Filipp Sudanov on August 19, 2020, 01:12:53 PM
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.
Title: Re: How to access delay timer key in NXSL?
Post by: Filipp Sudanov on September 25, 2020, 01:35:39 PM
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.