How to list not binded nodes

Started by davidfs, January 31, 2022, 09:12:58 AM

Previous topic - Next topic

davidfs

Hi, I'd like to know how to list nodes that are unbinded.
I'd like to list or filter them, so new discovered network devices can be bound easily to some Infrastructure Services.
Thanks.

Dawid Kellerman


Hi don't know if it is the right way but I always just go to agent tunnels and then order them by state brings any unbound ones to the top and you can deal with them.
Where I am internet links go up and down resulting in TLS errors and stuff on my netxms alarms but it generally sort themselves It is something I keep an eye on though.

Regards Dawid

Borgso

If you our out after binding new nodes that have not been put into other containers you can use this on a container you name ex "_NewNode"
It will only bind if the node is not part of any other container.
And if you use auto unbind it will unbind when its put into other container.

for (p : $node->parents) {
  if ( (p->type == 5 or p->type == 14)
  && ( p->name != "_NewNode") ) {
    return false;
  }
}

return true;

davidfs

Quote from: Dawid Kellerman on February 07, 2022, 10:24:16 AM

Hi don't know if it is the right way but I always just go to agent tunnels and then order them by state brings any unbound ones to the top and you can deal with them.
Where I am internet links go up and down resulting in TLS errors and stuff on my netxms alarms but it generally sort themselves It is something I keep an eye on though.

Regards Dawid

Hi, Thanks Dawid, but for the moment I'm not using agents, only snmp or status.
For the moment I'm trying a solution with custom properties. See reply to Borgso.

davidfs

Quote from: Borgso on February 08, 2022, 09:32:38 AM
If you our out after binding new nodes that have not been put into other containers you can use this on a container you name ex "_NewNode"
It will only bind if the node is not part of any other container.
And if you use auto unbind it will unbind when its put into other container.

for (p : $node->parents) {
  if ( (p->type == 5 or p->type == 14)
  && ( p->name != "_NewNode") ) {
    return false;
  }
}

return true;



Hi Borgso, your example helps me a lot. One of the things l want to do is to create list of nodes and where are binded.
However I've tried another solution to get new nodes: I add a custom atribute Binded = 0 on Entire Network and add a custom atribute Binded = 1 on Infrastrucutre Service (or whatever the contanier I llike.) if I make them inheritable, it will be applied to all nodes. If the node falls under Infrastructure Service, It will have the atribute = 1

So I make a dashboard with a query with this code:
if ($object->type != NODE)
return false;
return GetCustomAttribute($node, "Binded") == "0";


Don't know if this approach is correct, but I'm searching to get an inventory of my network (and also some monitoring), and would like to see list of nodes, and have the hability to filter them from various parameters (status, contanier, subcontainers,node types,localization, custom atributes, etc...)

If someone can recomend alternative aproaches, I'd like to hear. I'm new to netxms, and not sure how to aproach making an inventory.
Thanks.

Filipp Sudanov

Approach with custom attributes is quite OK - that way scripts can be simplified.

You can also run this script on any node (and you can even make an Object Tool that would execute this scrip):
for (n: GetAllNodes())
{
  if (!n->isParent(FindObject("Infrastructure services")))
  {
    println(n->name);
  }
}

And there's a good place - Tools->Find Object. Switch to query tab there and put the following query:
type == NODE and !$node->isParent(FindObject("Infrastructure services"))

It will find all nodes that are not present under "Infrastructure services" and it's an interactive list - you can right-click nodes and do some operations with them.

davidfs


Quote from: Filipp Sudanov on February 08, 2022, 08:10:00 PM
Approach with custom attributes is quite OK - that way scripts can be simplified.

You can also run this script on any node (and you can even make an Object Tool that would execute this scrip):
for (n: GetAllNodes())
{
  if (!n->isParent(FindObject("Infrastructure services")))
  {
    println(n->name);
  }
}

And there's a good place - Tools->Find Object. Switch to query tab there and put the following query:
type == NODE and !$node->isParent(FindObject("Infrastructure services"))

It will find all nodes that are not present under "Infrastructure services" and it's an interactive list - you can right-click nodes and do some operations with them.

Many thanks, Filipp.
Thats a very valuable information. I'll do that way too. This aproach will be useful for other tasks.