<?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[Instance Discovery using Agent Table method]]></title><description><![CDATA[<p dir="auto">I am trying to write a discovery filter script for Windows services that start with a common name and are set to auto startup. I have experimented with different things all day with no luck.</p>
<p dir="auto">Here is what I thought would work, but it does not</p>
<pre><code>name = $1-&gt;get(0);
startup =  $1-&gt;get(4);
if (name like "3CX*" &amp;&amp; startup == "Auto")
{
	return true;
}
return false;
</code></pre>
<p dir="auto">I was hoping $1 would return a row but seems it does not.</p>
<p dir="auto">In the manual it says values are returned with ~~~ between them, but I am not sure how to read those in the script.</p>
<p dir="auto">Any assistance would be appreciated.</p>
<p dir="auto">Gary</p>
]]></description><link>https://forum.netxms.org/topic/7027/instance-discovery-using-agent-table-method</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 07:21:43 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7027.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Apr 2021 21:18:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Wed, 27 Oct 2021 19:57:08 GMT]]></title><description><![CDATA[<p dir="auto">Ill add some more info to this. If someone wants a more readable status of the service poll you should under General change Data type to "String"</p>
<p dir="auto">Then you go to Transformation and paste this code:</p>
<pre><code>switch ( $1 )
{
	case "0": return "Running";
	case "1": return "Paused";
	case "2": return "Start pending";
	case "3": return "Pause pending";
	case "4": return "Continue pending";
	case "5": return "Stop pending";
	case "6": return "Stopped";
	case "255": return "Unable to get service state";
	default: return "INVALID VALUE (".$1.")";
}
</code></pre>
<p dir="auto">If you want to get notified via lets say e-mail when a service stops you will need to look at Thresholds, Event processing policy and also Actions configuration.</p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005579-Skarmavbild_2021-10-27_kl._21.47.23.png" alt="Skärmavbild 2021-10-27 kl. 21.47.23.png" class="img-markdown  img-fluid" width="796" height="634" /></p>
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005580-Skarmavbild_2021-10-27_kl._21.47.43.png" alt="Skärmavbild 2021-10-27 kl. 21.47.43.png" class="img-markdown  img-fluid" width="793" height="631" /></p>
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005581-Skarmavbild_2021-10-27_kl._21.48.00.png" alt="Skärmavbild 2021-10-27 kl. 21.48.00.png" class="img-markdown  img-fluid" width="798" height="652" /></p>
]]></description><link>https://forum.netxms.org/post/30707</link><guid isPermaLink="true">https://forum.netxms.org/post/30707</guid><dc:creator><![CDATA[Hanfelt]]></dc:creator><pubDate>Wed, 27 Oct 2021 19:57:08 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Wed, 27 Oct 2021 19:32:25 GMT]]></title><description><![CDATA[<p dir="auto">Thank you so much  <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--wink" style="height:1.4em;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
<p dir="auto">You know what i did i pasted the code in "Instance Discovery -&gt; Instance discover filter script". No wonder it didnt work  ;D</p>
<p dir="auto">Thanks again and have a great day.</p>
]]></description><link>https://forum.netxms.org/post/30706</link><guid isPermaLink="true">https://forum.netxms.org/post/30706</guid><dc:creator><![CDATA[Hanfelt]]></dc:creator><pubDate>Wed, 27 Oct 2021 19:32:25 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Wed, 27 Oct 2021 17:46:53 GMT]]></title><description><![CDATA[<p dir="auto">I created a script in the Script Library names ThreeCXServiceFilter (I changed from == "Auto" to like "Auto*" because some are "Auto (Delayed)")</p>
<pre><code>services = $node-&gt;readAgentTable("System.Services");
if (services == null)
   return null;

instances = %();
for(r : services-&gt;rows)
{
   name = r-&gt;get(0);
   startup = r-&gt;get(4);
   if (name like "3CX*" and startup like "Auto*")
      instances-&gt;append(name);
}

return instances;
</code></pre>
<p dir="auto">In my template I added a Data Collection Configuration. See the screenshots for that configuration.</p>
<p dir="auto">Let me know if you need anything else.</p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005577-dcc_general.png" alt="dcc_general.png" class="img-markdown  img-fluid" width="784" height="612" /></p>
<p dir="auto"><img src="/assets/uploads/files/smf/0000000005578-dcc_id.png" alt="dcc_id.png" class="img-markdown  img-fluid" width="783" height="610" /></p>
]]></description><link>https://forum.netxms.org/post/30705</link><guid isPermaLink="true">https://forum.netxms.org/post/30705</guid><dc:creator><![CDATA[gdodd]]></dc:creator><pubDate>Wed, 27 Oct 2021 17:46:53 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Wed, 27 Oct 2021 17:16:48 GMT]]></title><description><![CDATA[<p dir="auto">Can you guys in this thread please show me with a couple of screenshots how you configured this. It seems im missing something out in my data collection configuration / template.</p>
]]></description><link>https://forum.netxms.org/post/30704</link><guid isPermaLink="true">https://forum.netxms.org/post/30704</guid><dc:creator><![CDATA[Hanfelt]]></dc:creator><pubDate>Wed, 27 Oct 2021 17:16:48 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Mon, 07 Jun 2021 15:45:38 GMT]]></title><description><![CDATA[<p dir="auto">Wait, what? I just tested it again and it works...  :-[</p>
<p dir="auto">You shouldn't change too much in a script at the same time. I tried to return an array of arrays in the script to work with the individual array in the filter script, but it seems you only can return an array of strings.</p>
]]></description><link>https://forum.netxms.org/post/30114</link><guid isPermaLink="true">https://forum.netxms.org/post/30114</guid><dc:creator><![CDATA[2b2bff]]></dc:creator><pubDate>Mon, 07 Jun 2021 15:45:38 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Mon, 07 Jun 2021 15:19:52 GMT]]></title><description><![CDATA[<p dir="auto">I am running 3.8.382. I just tested the script as written in this post and it finished successfully. So I do not think it is a bug.</p>
<p dir="auto">Can you post your script and any error messages?</p>
<p dir="auto">Gary</p>
]]></description><link>https://forum.netxms.org/post/30113</link><guid isPermaLink="true">https://forum.netxms.org/post/30113</guid><dc:creator><![CDATA[gdodd]]></dc:creator><pubDate>Mon, 07 Jun 2021 15:19:52 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Mon, 07 Jun 2021 14:52:58 GMT]]></title><description><![CDATA[<p dir="auto">Just tried to use this as a starting point, but</p>
<pre><code>$node-&gt;readAgentTable("System.Services");
</code></pre>
<p dir="auto">does not work. However the older syntax</p>
<pre><code>AgentReadTable($node, "System.Services");
</code></pre>
<p dir="auto">does work.</p>
<p dir="auto">What do I miss? A bug in 3.8.382?</p>
]]></description><link>https://forum.netxms.org/post/30112</link><guid isPermaLink="true">https://forum.netxms.org/post/30112</guid><dc:creator><![CDATA[2b2bff]]></dc:creator><pubDate>Mon, 07 Jun 2021 14:52:58 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Tue, 20 Apr 2021 13:15:20 GMT]]></title><description><![CDATA[<p dir="auto">Works perfectly. Thank you!!</p>
]]></description><link>https://forum.netxms.org/post/29892</link><guid isPermaLink="true">https://forum.netxms.org/post/29892</guid><dc:creator><![CDATA[gdodd]]></dc:creator><pubDate>Tue, 20 Apr 2021 13:15:20 GMT</pubDate></item><item><title><![CDATA[Reply to Instance Discovery using Agent Table method on Tue, 20 Apr 2021 08:27:57 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">when using agent table for instance discovery instance names are taken from instance column in the table, in case of System.Services it will be service name. So $1 in filter script is always instance, you have no access to actual table row. I suggest to use script as instance discovery method instead of agent table, and process table i that script instead. It could looks like following:</p>
<pre><code>services = $node-&gt;readAgentTable("System.Services");
if (services == null)
   return null;

instances = %();
for(r : services-&gt;rows)
{
   name = r-&gt;get(0);
   startup = r-&gt;get(4);
   if (name like "3CX*" and startup == "Auto")
      instances-&gt;append(name);
}

return instances;
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/29890</link><guid isPermaLink="true">https://forum.netxms.org/post/29890</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 20 Apr 2021 08:27:57 GMT</pubDate></item></channel></rss>