Filtering MikroTik Devices by IP Address Instead of Vendor
-
-
$node.ipAddr (string)
or $node.ipAddress (instance of InetAddress): https://netxms.org/documentation/nxsl-latest/#class-inetaddress
-
-
First of all two first lines should end with ; char.
There is no isInSubnet() method on InetAddress class, but there is contains() method on subnet, so we should go opposite way and check it on the subnet, there's an example here: https://netxms.org/documentation/nxsl-latest/#_instance_methods_18
So, modifying your code:subnetObject = InetAddress("192.168.56.0", 24); if (subnetObject.contains($node.ipAddress)) { return 1; // match } else { return 0; // no match } -
And just for completeness, script above can be simplified to
return InetAddress("192.168.56.0", 24).contains($node.ipAddress);
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login