EPP Script to block OID's from setting alarms - Please Help

Started by LogicalNZ, March 31, 2020, 08:56:40 AM

Previous topic - Next topic

LogicalNZ

Hey all,

I'm a little lost, I need to write e EPP script to filter an OID Address.

The address range I want to filter is:

.1.3.6.1.2.1.31.1.1.1.6.[filter < 1000] and .1.3.6.1.2.1.31.1.1.1.10.[filter < 1000]

Can anyone help me with this please?

With thanks

Alan Scott

Filipp Sudanov

Can you give more details on what are you trying to achieve?
Do you have a node which has SNMP data for these OIDs?
Do you have any DCIs on that node?
What result of the filtering do you expect?

LogicalNZ

So the issue I have is when a user connects to a vpn these interfaces are created and then the monitoring starts, which is fine.

The issue is that when the user disconnects from the vpn these interfaces become in a unknown start until they drop off. Thats fine as well, but when they move into the unknown state they produce an alarm (thats what I want to stop happening).

One of the options I have have put to me is to stop monitoring tunnel interfaces in the EPP all together, the issue with this approach is that I have a number of tunnel interfaces that I do want to monitor, its just the dynamic tunnel interfaces that I don't want to monitor.

The dynamic interfaces are identified by the following OID's

.1.3.6.1.2.1.31.1.1.1.6.[greater than 1000] and .1.3.6.1.2.1.31.1.1.1.10.[greater than 1000]

So my thought to to create some type of script to look for these OID's and tell netXMS not to alert on the interface going to a unknown state.

I hope that makes it clearer :)

With thanks

Filipp Sudanov

It depends on what you want to achieve.

If you are not interested in these interfaces at all, you can prevent them from creating - modify script "Hook::CreateInterface" in scripting library. Script is executed on configuration poll for each new interface (accessible as $1, https://www.netxms.org/documentation/nxsl-latest/#class-interface) and should return true or false. If return value is false - interface will not be created.

It's possible to use $1->ifType (interface type as defined by IANA, list of interface types available here: https://github.com/netxms/netxms/blob/master/include/nms_common.h#L908, or can be seen on the object overview tab when interface is selected).
Or you can query node via SNMP to get some data.

If you want to keep interfaces in the system, but ignore status change - simplest way is to set "Expected Interface State" to IGNORE. You can do it in configuration poll hook (Hook::ConfigurationPoll).
Sample:

for (i : $node->interfaces) {
    if (i->ifType == 131) { // tunnel
        i->setExpectedState("IGNORE");
    }
}

If you want to block events in the EPP, add rule before any alarms or notifications:
Script:
    i = $node->getInterface($5);
    if (i->ifType == 131) { // or any other filter
        return true;
    }
    return false;
Action:
    stop processing

Alternatively, add script to your alarm / notification rules and return true only if it's not dynamic interface:
    i = $node->getInterface($5);
    if (i->ifType == 131) { // or any other filter
        return true;
    }
    return false;