<?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[Catching and Handling Exceptions (SNMP timeout) in NXSL instance discovery]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have developped and been using an NXSL script for interface instance discovery using SNMP for over an year now.<br />
Although it is working fine it keeps on throwing alarms for script execution errors on the server node. I am pretty sure that the cause for those errors in 99% of the cases is just SNMP timeout. I have many of the monitored nodes with slow and unreliable connection so this is expected and more or less inevitable.</p>
<p dir="auto">So now i am looking for a way to enhance my script in a such way that it catches and handles such problems and just quietly abort until the next execution. I have looked int the documents and in the forum, but couldnt find a solution.<br />
Ideas anyone?</p>
<p dir="auto">Here is my instance discovery script:</p>
<pre><code>snmp = CreateSNMPTransport($node);
ifName = SNMPGetValue(snmp, ".1.3.6.1.2.1.2.2.1.2." . $1);
ifName .= " ";
ifName .= SNMPGetValue(snmp, ".1.3.6.1.2.1.31.1.1.1.18." . $1);
if (ifName ~= "Loopback.*") {
	return %(false, $1, ifName);
} else {
	return %(true, $1, ifName);
}
</code></pre>
<p dir="auto">Screenshot of the alarms is attached.</p>
<p dir="auto">Thanks in advance!</p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000003343-netxms_script_errors.PNG" alt="netxms script errors.PNG" class="img-markdown  img-fluid" width="1402" height="151" /></p>
]]></description><link>https://forum.netxms.org/topic/4797/catching-and-handling-exceptions-snmp-timeout-in-nxsl-instance-discovery</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:40:22 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4797.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 13 Nov 2016 09:18:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Catching and Handling Exceptions (SNMP timeout) in NXSL instance discovery on Tue, 06 Dec 2016 09:27:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">yes, if script returns false instance will be deleted. Currently there is no way to stop instance discovery by aborting filter script.</p>
<p dir="auto">There is feature request for adding "grace period" for instances being deleted: <a href="https://dev.raden.solutions/issues/976" rel="nofollow ugc">https://dev.raden.solutions/issues/976</a>. I think implementing it should solve your problem.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/21445</link><guid isPermaLink="true">https://forum.netxms.org/post/21445</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 06 Dec 2016 09:27:31 GMT</pubDate></item><item><title><![CDATA[Reply to Catching and Handling Exceptions (SNMP timeout) in NXSL instance discovery on Wed, 30 Nov 2016 15:04:58 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Victor,<br />
I understand the logic.</p>
<p dir="auto">My understanding now is when the instance discovery filtering script returns False that particular instance is skipped or removed if already available. Is that true?<br />
If yes, does that mean that if there's a single SNMP error (eg Timeout) in a regular Instance discovery and the script returns False for that particular instance it will be deleted from the node DCI table? As it happens now if i really delete the interface from the router?</p>
<p dir="auto">This will be problematic, because now NetXMS immediately deletes a DCI when it detects its absense during instance discovery resulting in permanent history data loss, which is not acceptable for the bussiness. This is a feature that i have already requested in "FEature Requests" - to have the option to leave DCI's present (for example in UNSUPPORTED state) after they dissapear from instance discovery.</p>
<p dir="auto">I was thinking of somehow "breaking" the script in order to avoid any changes instead of returing False which will eventually result in deleting DCIs with their history data. Am i on the right track?</p>
]]></description><link>https://forum.netxms.org/post/21432</link><guid isPermaLink="true">https://forum.netxms.org/post/21432</guid><dc:creator><![CDATA[blazarov]]></dc:creator><pubDate>Wed, 30 Nov 2016 15:04:58 GMT</pubDate></item><item><title><![CDATA[Reply to Catching and Handling Exceptions (SNMP timeout) in NXSL instance discovery on Mon, 28 Nov 2016 11:06:14 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">just add appropriate error checking:</p>
<pre><code>snmp = CreateSNMPTransport($node);
if (snmp == null)
   return false; // node does not support SNMP or transport cannot be created
ifName = SNMPGetValue(snmp, ".1.3.6.1.2.1.2.2.1.2." . $1);
if (ifName == null)
   return false; // cannot read from node
ifXName = SNMPGetValue(snmp, ".1.3.6.1.2.1.31.1.1.1.18." . $1);
if (ifXName != null)
{
   ifName .= " " . ifXName;
}
if (ifName ~= "Loopback.*") {
	return %(false, $1, ifName);
} else {
	return %(true, $1, ifName);
}
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/21416</link><guid isPermaLink="true">https://forum.netxms.org/post/21416</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 28 Nov 2016 11:06:14 GMT</pubDate></item></channel></rss>