NetXMS Support Forum

English Support => General Support => Topic started by: tomaskir on August 06, 2014, 06:10:41 PM

Title: Bound / Unbound nodes
Post by: tomaskir on August 06, 2014, 06:10:41 PM
Hey guys,

Is there an easy way to see a list of unbound nodes? (nodes being in "Entire Network", but not in "Infrastrucure services")?

I did a network discovery, which added all my nodes, but now I need to bind them to "Infrastrucure services".
I want to make sure I dont miss a node. Also, if I keep discovery running, and a node is added, I want an easy way to see which nodes are unbound.

Is this possible?

Thanks!
Title: Re: Bound / Unbound nodes
Post by: Victor Kirhenshtein on August 06, 2014, 11:41:40 PM
Hi!

This can be done using scripts. For example, the following script will return true if node has only subnets a parents:


result = true;
parents = GetNodeParents($node);
foreach(p : parents)
{
   if (p->type != 1)   // Type 1 = subnet
   {
      result = false;
      break;
   }
}


You can create separate container with autobind script which will bind nodes not located in any container. For example, if you call this container "NewNodes", autobind script could be like this:


parents = GetNodeParents($node);
foreach(p : parents)
{
   if ((p->type != 1) && (p->name != "NewNodes"))   // Type 1 = subnet, also ignore "NewNodes" container itself
   {
      return false;
   }
}
return true;


Best regards,
Victor
Title: Re: Bound / Unbound nodes
Post by: tomaskir on August 07, 2014, 12:47:50 AM
Awesome, thank you very much :)
Title: Re: Bound / Unbound nodes
Post by: tomaskir on August 11, 2014, 01:21:38 PM
Is there a list of numeric values to type names somewhere?

I wanted to modify the script a bit, but I cant find this list, and dont know what numeric value the "Template" type is.

Thanks!
Title: Re: Bound / Unbound nodes
Post by: Alex Kirhenshtein on August 11, 2014, 01:27:24 PM
Check nxclapi.h for complete list: http://git.netxms.org/public/netxms.git/blob/HEAD:/include/nxclapi.h?js=1#l132
Title: Re: Bound / Unbound nodes
Post by: tomaskir on August 11, 2014, 01:33:28 PM
Thanks!