NetXMS Support Forum

Please login or register.

Login with username, password and session length

Author Topic: Understanding the AgentReadList vs readAgentList  (Read 58 times)

Borgso

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Understanding the AgentReadList vs readAgentList
« on: October 11, 2019, 09:22:30 pm »

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
Quote
DW::DiscoverActiveMQ("DLQDetailsQueue")

DW::DiscoverActiveMQ script is:
Code: [Select]
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"
Code: [Select]
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;
}
Logged