Object Filter in Layer3-Maps

Started by Dani@M3T, July 06, 2015, 05:31:20 PM

Previous topic - Next topic

Dani@M3T

I have a Layer3 map where I only want nodes from container 'London'.

I tried with the following filter script but got always all nodes instead of only those in container 'London':

parents = GetNodeParents((FindObject($1));
if (parents == null) return false;
foreach(p : parents)
{
   if (p->type == 5 && p->name == "London") return true;
}
return false;



  • Do I have a typo or an error in reasoning?
  • What is the input of the filtering script? An object? An ID? (didn't found it in documentation)
  • When you temporarily disable the filter, the filtering script will be deleted (bug or feature?)

Thanks for any input!

tomaskir

#1
1) use $object variable, not $1
2) yes, its an "NetObj" class object
3) sounds like a bug, log it in bug-tracker :)

Dani@M3T

Thanks for your fast reply Tomas.

using $object instead of $1 -> Error 17 (Argument is not of string type and cannot be converted to string. So I changed to
parents = GetNodeParents($object);
-> Error 21 (Bad or incompatible object class), it's NetObj not Node class. So I tried this (most logical for me):
parents = GetObjectParents($object);
No error, but now the map is empty :-(

I registered a ticket for the disable-bug

thanks
Dani

tomaskir

This works for me:
parents = GetObjectParents($object);

foreach(p : parents)
{
   if (p->type == 5 && p->name == "Something") return true;
}
return false;


Two things to note:
1) it only takes "direct" parents of the node, its not upwards recursive, so doesnt take parents of the node's parents into account
2) CheckTrustedNodes (or equivalent security) will need to be correctly set

You can run the script directly on an object using "Execute server script" to check whats going on.
I suggest adding this into the foreach loop to make debug easier:
println("Type: " . p->type . " Name: " . p->name);

Dani@M3T

#4
when I set sever variable 'CheckTrustedNodes' to 0 (and restart the NetXMS server of course), I get the nodes on the map. But I get no connectors on the map beside VPN-connectors. Why? Connectors are no NetObj objects.... so no filtering on that. Is this the same on your installation?

I don't understand exactly why 'CheckTrustedNodes' has an influence here.
But when I set all nodes in a container to the Trusted Nodes of this container, this nodes appear on the map.

Thanks for the hint with the 'direct' parents.

tomaskir

I do not know why script security is being applied here, maybe Victor can tell us. :)

You are not getting connectors as in the links connecting the nodes on the map?
I get those when using the filtering script.

Dani@M3T

Yes maybe Victor can give an answer.

I only see one VPN connector but no other 'normal' connectors. See the attached printscreen. Strange. All nodes on the left side should be connected to one of the VPN endpoints and the two on the right side with the other. In the map without the filtering script all connectors are there

tomaskir

As I mentioned, for me it works fine with filtering scripts, but I do not show end-nodes on my map.

Victor will have to shed more light on both the issues :)

Dani@M3T

Thanks Tomas for your help.

Now I hope Victor will see this thread soon.

Dani

Victor Kirhenshtein

Hi,

links are not affected by map filter. Did you layout nodes by hand? If not, it seems as if links are there but just invisible. Just in case - check link color in map properties.

Best regards,
Victor

Dani@M3T

Hi Victor

I tried manually and automatic layout. At the moment it's automatic layout. On this map are routers, switches and end nodes.

Can you please also explain for short the trusted nodes in this situation (not in general).

thanks
Dani

Victor Kirhenshtein

currently all scripts are handled equally - so it doesn't matter if script is a network map filter or DCI transformation script for example. Reason is the same - imagine you have access only to network map object - if script do not have access checks you'll be able to access data for nodes you don't have access to. I thinking for some time already about more sophisticated access control within scripts, but don't have better solution yet.

Best regards,
Victor

Dani@M3T

ok, thanks for the explanation.

But do you have any idea why all connectors are missing on the filtered layer3 map?

Victor Kirhenshtein

Did you check connector color in map properties? By objects' locations it seems that they are connected but connectors are invisible.

Best regards,
Victor

Dani@M3T

#14
Default connection options are on default color. I also tried with manually set to black. VPN-connectors (dotted) and the 'normal' connectors always have the same color. The last printscreen was without automatic layout. Here is one with automatic layout. Here I can't see any arrangement. Everything is mixed up.