NetXMS Support Forum

English Support => General Support => Topic started by: Sorikan on July 06, 2025, 11:35:17 PM

Title: Infrastructure Container Auto Binds
Post by: Sorikan on July 06, 2025, 11:35:17 PM
I have to think that others have gotten this to work, but neither myself, CoPilot or Grok have been able to. 

'All' I want to do is bind nodes that may have, between various sites, an IP that could be in one of three subnets per site, and bind them to that specific container that has IP specific auto bind rules. 

I cannot find any examples that point me in the right direction from within the past 2-3 years that get me any where.

Does anyone have any code snippets that show this working like I am attempting to use it?

Thanks!
Title: Re: Infrastructure Container Auto Binds
Post by: Alex Kirhenshtein on July 07, 2025, 02:09:39 AM
If I understand your correctly, this should be enough:

InetAddress("10.5.3.0", 24).contains($node.ipAddress)

This autobind script will collect all 10.5.3.0/24 nodes into container.
$node.ipAddress is detected management address, if you want to do it based on the interfaces:

for (i : $node.interfaces) {
  for (addr : i.ipAddressList) {
    if (InetAddress("10.5.3.0", 24).contains(addr)) {
      return true;
    }
  }
}
return false;