<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to cancel a timer used to daly email notification via NXSL.]]></title><description><![CDATA[<p dir="auto">Hi all</p>
<p dir="auto">We are currently running 3.8.366 and was wanting to implement a script that would supress node down and node up emails within a specified down time period, e.g., 5 minutes. I've basically sussed things out but have no idea how to cancel the timer, nodetimer_%i, used to delay the node down email. Any advice would be greatly appreciated.</p>
<pre><code>interval = 300;
nodeId = d2x($node-&gt;id,8);
a = ("timestamp_0x".nodeId);
if (ReadPersistentStorage(a) != "" ) {
	if ((time() - ReadPersistentStorage(a)) &gt; interval) return true;
	WritePersistentStorage(a, NULL);
	alarm = FindAlarmByKey("NODE_DOWN2_0x".nodeId);
	timer = ("nodetimer_0x".nodeId);
	$event-&gt;setNamedParameter(timer, "");
	alarm-&gt;resolve();
	return false;
}
</code></pre>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005735-netxms_5and6script.JPG" alt="netxms_5and6script.JPG" class="img-markdown  img-fluid" width="1884" height="652" /></p>
]]></description><link>https://forum.netxms.org/topic/7475/how-to-cancel-a-timer-used-to-daly-email-notification-via-nxsl.</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 10:31:48 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7475.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Jul 2022 00:11:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to cancel a timer used to daly email notification via NXSL. on Mon, 01 Aug 2022 22:01:57 GMT]]></title><description><![CDATA[<p dir="auto">Hi Filipp</p>
<p dir="auto">Thanks for the tip. And yes there was a space.</p>
<p dir="auto">Ross</p>
]]></description><link>https://forum.netxms.org/post/31707</link><guid isPermaLink="true">https://forum.netxms.org/post/31707</guid><dc:creator><![CDATA[nisross]]></dc:creator><pubDate>Mon, 01 Aug 2022 22:01:57 GMT</pubDate></item><item><title><![CDATA[Reply to How to cancel a timer used to daly email notification via NXSL. on Mon, 01 Aug 2022 13:58:14 GMT]]></title><description><![CDATA[<p dir="auto">It looks that there's a space in nodetimer_ %i after _ sign when setting the timer.</p>
<p dir="auto">In overall - do I understand correctly, that you want do delay node down notification and send node up notification only if node down notification was sent? If so, currently this can be achieved without scripting, by filling in "Snooze/Blocking timer key" field in recovery notification properties.</p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005742-Screenshot_at_2022-08-01_16-56-10.png" alt="Screenshot at 2022-08-01 16-56-10.png" class="img-markdown  img-fluid" width="626" height="241" /></p>
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005743-Screenshot_at_2022-08-01_16-47-44.png" alt="Screenshot at 2022-08-01 16-47-44.png" class="img-markdown  img-fluid" width="1533" height="550" /></p>
]]></description><link>https://forum.netxms.org/post/31704</link><guid isPermaLink="true">https://forum.netxms.org/post/31704</guid><dc:creator><![CDATA[Filipp Sudanov]]></dc:creator><pubDate>Mon, 01 Aug 2022 13:58:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to cancel a timer used to daly email notification via NXSL. on Tue, 26 Jul 2022 23:54:13 GMT]]></title><description><![CDATA[<p dir="auto">Hi Victor</p>
<p dir="auto">Thanks for the assistance. Modified code and EPP below. For some reason the timer cancellation doesn't get applied though, i.e., Node Down Email is still sent. %1 is expanded and sent correctly as displayed in event log, i.e., nodetimer_0x0000364. Any pointers appreciated.</p>
<p dir="auto">Regards</p>
<p dir="auto">Ross</p>
<pre><code>interval = 300;
timestamp = ExpandString("timestamp_%i",$node);
if (ReadPersistentStorage(timestamp) != "" ) {
	if ((time() - ReadPersistentStorage(timestamp)) &gt; interval) return true;
	WritePersistentStorage(timestamp, NULL);
	alarmkey = ExpandString("NODE_DOWN2_%i",$node);
	alarm = FindAlarmByKey(alarmkey);
	timer = ExpandString("nodetimer_%i",$node);
	PostEvent($node,"CANCEL_TIMER",null,timer);
	alarm-&gt;terminate();
	return false;
}
</code></pre>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005737-netxms_567script.JPG" alt="netxms_567script.JPG" class="img-markdown  img-fluid" width="1949" height="788" /></p>
]]></description><link>https://forum.netxms.org/post/31692</link><guid isPermaLink="true">https://forum.netxms.org/post/31692</guid><dc:creator><![CDATA[nisross]]></dc:creator><pubDate>Tue, 26 Jul 2022 23:54:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to cancel a timer used to daly email notification via NXSL. on Mon, 25 Jul 2022 12:45:33 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">You cannot cancel timer directly from NXSL. However, you can generate special event to cancel timer. For example, in your script you can have something like</p>
<p dir="auto">PostEvent($object, "CANCEL_TIMER", null, timer);   // Variable "timer" contains timer key</p>
<p dir="auto">and in EPP you create separate rule that handles event CANCEL_TIMER and the only action is "cancel timer" with %1 as key.</p>
<p dir="auto">Of course you also have to create event CANCEL_TIMER.</p>
<p dir="auto">Also, if you need macro string expanded within NXSL, you can use function ExpandString. In your example you can do</p>
<p dir="auto">timer = ExpandString("nodetimer_%i", $node);</p>
<p dir="auto">That way you are guaranteed to have exactly same string in NXSL as in other EPP places.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/31685</link><guid isPermaLink="true">https://forum.netxms.org/post/31685</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 25 Jul 2022 12:45:33 GMT</pubDate></item></channel></rss>