NetXMS Support Forum

English Support => General Support => Topic started by: stoffmann on May 07, 2025, 01:23:14 PM

Title: Agent Configuration depending on node name?
Post by: stoffmann on May 07, 2025, 01:23:14 PM
Hi,
I have different agent configurations for different server types. Depnding on their type also the naming of the servers is different, like db01 for DB server and vd01 for virtual desktops. Only the number change

Is it possibe to e.g. check if the node name starts with "db" in the agent configuration filter?
Maybe like:

return $node.Name like 'db*';

Or is it limited to the $1 - $5 parameters?

Best regards

Stefan
Title: Re: Agent Configuration depending on node name?
Post by: Victor Kirhenshtein on May 07, 2025, 01:45:10 PM
Agent configuration filter does not provide access to node object - because it is just a request from certain IP and not necessarily matches already known node (although probably it will be good idea to implement such lookup). However, you can implement such lookup yourself, for example (I assume version 5.x):
node = FindNodeByIPAddress($1);
return node?.name?.startsWith('db');
This script will return true if requested IP address corresponds to existing node and name of that node starts with "db".

Best regards,
Victor

Title: Re: Agent Configuration depending on node name?
Post by: stoffmann on May 07, 2025, 02:25:26 PM
Works! Thank You!