<?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[Understanding the AgentReadList vs readAgentList]]></title><description><![CDATA[<p dir="auto">Have been using AgentReadList in different scenarios to dynamic apply template and dci instances<br />
Could need some help to get it rewritten for NXLSv3</p>
<p dir="auto">What worked in 2.2.x</p>
<p dir="auto">Scenario 1:</p>
<p dir="auto">DCI on agentless node, using a "source node" and "Instance discovery method: Script", called with</p>
<blockquote>
<p dir="auto">DW::DiscoverActiveMQ("DLQDetailsQueue")</p>
</blockquote>
<p dir="auto">DW::DiscoverActiveMQ script is:</p>
<pre><code>if ($1 == "ActiveMQ") {
  //return AgentReadList($node, "DiscoverActiveMQ(" . $targetObject-&gt;ipAddr . ")");
  return $targetObject-&gt;readAgentList("DiscoverActiveMQ(" . $targetObject-&gt;ipAddr . ")");
}
</code></pre>
<p dir="auto">ExternalList DiscoverActiveMQ do a do a call from source node to node and get a instance list to create DCI to poll info using a ExternalParameter (script on source node -&gt; node) on each instance.</p>
<p dir="auto">Scenario 2:<br />
AutoApply template if user X is within /etc/passwd.</p>
<p dir="auto">Using a script library with following code and "ExternalList = UserList:cut -d: -f1 /etc/passwd"</p>
<pre><code>sub ServiceCheck(ServiceName) {
  if ($node-&gt;isAgent &amp;&amp; $node-&gt;platformName like "Linux-*") {
    users = AgentReadList($node,"UserList");
    if ( users == null ) return null;
    foreach ( user : users ) {
      if ( user == ServiceName ) return true;
    }
  }
  return false;
}
</code></pre>
]]></description><link>https://forum.netxms.org/topic/6221/understanding-the-agentreadlist-vs-readagentlist</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 17:55:10 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/6221.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 11 Oct 2019 18:22:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Understanding the AgentReadList vs readAgentList on Mon, 14 Oct 2019 17:52:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi and thank for reply.</p>
<p dir="auto">I tried what you suggest, but it doesnt work as before:</p>
<p dir="auto">ServiceName is username within /etc/passwd catched using ExternalList on the node.</p>
<p dir="auto">Does not work:</p>
<pre><code>if ($node-&gt;isAgent &amp;&amp; $node-&gt;platformName like "Linux-*") {
    users = $node-&gt;readAgentList("UserList");
    if ( users == null ) return null;
    foreach ( user : users ) {
      if ( user == ServiceName ) return true;
    }
  }
  return false;
</code></pre>
<p dir="auto">Does work, but is not the correct way..</p>
<pre><code>if ($node-&gt;isAgent &amp;&amp; $node-&gt;platformName like "Linux-*") {
    users = AgentReadList($node,"UserList");
    if ( users == null ) return null;
    foreach ( user : users ) {
      if ( user == ServiceName ) return true;
    }
  }
  return false;
</code></pre>
<p dir="auto">However, if i add node to template first and then do "Configuration Poll" with $node-&gt;readAgentList version, it does not remove the node from template even if "Remove this template automatically when node no longer passes through filter"<br />
It does get removed/unbind if i only put "return false;" in the Automatic Apply Rules.</p>
]]></description><link>https://forum.netxms.org/post/26734</link><guid isPermaLink="true">https://forum.netxms.org/post/26734</guid><dc:creator><![CDATA[Borgso]]></dc:creator><pubDate>Mon, 14 Oct 2019 17:52:36 GMT</pubDate></item><item><title><![CDATA[Reply to Understanding the AgentReadList vs readAgentList on Mon, 14 Oct 2019 10:33:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">readAgentList is a node object method, so if you were calling</p>
<p dir="auto">AgentReadList($node, ...</p>
<p dir="auto">(read agent parameter from node pointed by $node variable) you now should use</p>
<p dir="auto">$node-&gt;readAgentList(...</p>
<p dir="auto">to read list from agent on same node.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/26731</link><guid isPermaLink="true">https://forum.netxms.org/post/26731</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 14 Oct 2019 10:33:58 GMT</pubDate></item></channel></rss>