Filtering MikroTik Devices by IP Address Instead of Vendor

Started by nichky, March 11, 2026, 07:08:32 AM

Previous topic - Next topic

nichky

Hi

I'm currently using the following condition to collect all MikroTik devices:

return $node->vendor == "MikroTik";

Is there any way to perform this per IP address instead?

Alex Kirhenshtein

#1
$node.ipAddr (string)

or $node.ipAddress (instance of InetAddress): https://netxms.org/documentation/nxsl-latest/#class-inetaddress

nichky

$subnet = InetAddress("x.y.z.0")
$mask = 24

if ($node.ipAddress.isInSubnet($subnet, $mask)) {
    return 1;  // match
} else {
    return 0;  // no match
}



I got this, but it's not working. Can you please modify it?