Have been using AgentReadList in different scenarios to dynamic apply template and dci instances
Could need some help to get it rewritten for NXLSv3
What worked in 2.2.x
Scenario 1:
DCI on agentless node, using a "source node" and "Instance discovery method: Script", called with
QuoteDW::DiscoverActiveMQ("DLQDetailsQueue")
DW::DiscoverActiveMQ script is:
if ($1 == "ActiveMQ") {
  //return AgentReadList($node, "DiscoverActiveMQ(" . $targetObject->ipAddr . ")");
  return $targetObject->readAgentList("DiscoverActiveMQ(" . $targetObject->ipAddr . ")");
}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 -> node) on each instance.
Scenario 2:
AutoApply template if user X is within /etc/passwd.
Using a script library with following code and "ExternalList = UserList:cut -d: -f1 /etc/passwd"
sub ServiceCheck(ServiceName) {
  if ($node->isAgent && $node->platformName like "Linux-*") {
    users = AgentReadList($node,"UserList");
    if ( users == null ) return null;
    foreach ( user : users ) {
      if ( user == ServiceName ) return true;
    }
  }
  return false;
}
			
				Hi,
readAgentList is a node object method, so if you were calling 
AgentReadList($node, ...
(read agent parameter from node pointed by $node variable) you now should use
$node->readAgentList(...
to read list from agent on same node.
Best regards,
Victor
			
			
			
				Hi and thank for reply.
I tried what you suggest, but it doesnt work as before:
ServiceName is username within /etc/passwd catched using ExternalList on the node.
Does not work:
if ($node->isAgent && $node->platformName like "Linux-*") {
    users = $node->readAgentList("UserList");
    if ( users == null ) return null;
    foreach ( user : users ) {
      if ( user == ServiceName ) return true;
    }
  }
  return false;
Does work, but is not the correct way..
if ($node->isAgent && $node->platformName like "Linux-*") {
    users = AgentReadList($node,"UserList");
    if ( users == null ) return null;
    foreach ( user : users ) {
      if ( user == ServiceName ) return true;
    }
  }
  return false;
However, if i add node to template first and then do "Configuration Poll" with $node->readAgentList version, it does not remove the node from template even if "Remove this template automatically when node no longer passes through filter"
It does get removed/unbind if i only put "return false;" in the Automatic Apply Rules.