Hide or ignore notPresent interfaces

Started by troffasky, July 12, 2022, 05:58:24 PM

Previous topic - Next topic

troffasky

With some Cisco SB switches, if you put them in stack mode then every possible potential interface in a stack is enumerated with SNMP. For example  gi1/0/1 - gi8/0/52 [and the equivalent FastEthernet as well] even if this is a "stack" of just one switch. As an example, I am look at an SG500-28P that has nearly 1000 interfaces, of which only 28 are real physical interfaces, a few are VLANs and the rest are just "imaginary".

They all have an operation state of "notPresent" so should be straightforward enough to filter out, hide or disregard, but can I do this in NetXMS?

Alex Kirhenshtein

in Script Library there is a script call Hook::CreateInterface. You can put any code there, which will be executed when new interface is about to be created. If you return "true" (or hook is empty) - interface will be created, if false - it will be ignored.

This will not affect existing interfaces, and you'll have to delete them either by hand (filter them by name, for example, and bulk delete) or using script

for (n : GetAllNodes()) {
    println(n->name . "(" . n->id . ")");
    for (i : n->interfaces) {
        println("\t" . i->name);
        if (...) { i->delete(); }
    }
}


Check NXSL documentation for more information: https://www.netxms.org/documentation/nxsl-latest/

Victor Kirhenshtein

I think that it could be good idea to ignore notPresent interfaces by default on the server level. We will discuss that internally and likely add as configurable option. But for now hook script is a way to go.

Best regards,
Victor