NetXMS deletes interface and recreates it and sends notifications

Started by johnny, November 07, 2018, 03:07:43 PM

Previous topic - Next topic

johnny

Hello all,
I'm facing a problem, on a pc that has tunnel interfaces for VPN connections. After the interface get up/down then it deletes the interface and recreates it, and it also gives it an expected state up so I get notifications and email warnings.
I've done delete the interface, obviously doesn't helped. On interfaces I've done unmanage and exclude this interface from network topology with expected state ignore. Nothing of that helps.
Is there another way to disable all other interfaces except the ethernet interface, or at least make for that specific node(pc) default expected state for new interfaces to be ignonre?
here is a part of event log of that node:

ID Time Source DCI Event Sevirety Message Root ID
591861 06.11.2018 12:25:32 PC 0 SYS_IF_UP Normal Interface "tun1" changed state to UP (IP Addr: 10.0.1.6/32) 0
591895 06.11.2018 13:15:34 PC 0 SYS_IF_DOWN Minor Interface "tun1" changed state to DOWN (IP Addr: 10.0.1.6/32) 0
591916 06.11.2018 13:24:17 PC 0 SYS_IF_ADDED Normal Interface "tun1" added (IP Addr: 10.0.1.6/32, IfIndex: 36) 0
591915 06.11.2018 13:24:17 PC 0 SYS_IF_DELETED Normal Interface "tun1" deleted (IP Addr: 10.0.1.6/32, IfIndex: 35) 0
591917 06.11.2018 13:24:47 PC 0 SYS_IF_EXPECTED_STATE_UP Normal Expected state for interface "tun1" set to UP 0
591918 06.11.2018 13:25:52 PC 0 SYS_IF_UP Normal Interface "tun1" changed state to UP (IP Addr: 10.0.1.6/32) 0
592005 06.11.2018 14:54:23 PC 0 SYS_IF_EXPECTED_STATE_IGNORE Normal Expected state for interface "tun1" set to IGNORE 0
592078 06.11.2018 16:24:32 PC 0 SYS_IF_ADDED Normal Interface "tun1" added (IP Addr: 10.0.1.6/32, IfIndex: 37) 0
592079 06.11.2018 16:24:42 PC 0 SYS_IF_EXPECTED_STATE_UP Normal Expected state for interface "tun1" set to UP 0
592080 06.11.2018 16:25:47 PC 0 SYS_IF_UP Normal Interface "tun1" changed state to UP (IP Addr: 10.0.1.6/32) 0

Tursiops

You can write a Hook:CreateInterface script to prevent interfaces from being created that you don't care about.
You can also create a Hook:ConfigurationPoll script to automatically check all node interfaces, then set the interface expected state to IGNORE on interfaces you don't want to be alerted on. I wouldn't think you can do that inside the CreateInterface Hook, as the interface doesn't get created until after the script has run, but I could be wrong.

For example the following Hook:ConfigurationPoll will set any network interface on a device detected as a printer to Ignore:
interfaces = GetNodeInterfaces($node);
foreach (interface : interfaces)
{
if ( $node->isPrinter == TRUE ) SetInterfaceExpectedState(interface, "IGNORE");
}


Hope that helps.

gdodd

Here is the Hook:CreateInterface script in the script library that I use to give you an idea:

if ($1->name ~= "(?i).*Teredo.*|.*isatap.*|.*Loopback.*|.*Bluetooth.*|Local Area Connection\* 12|Local Area Connection\* 11|Local Area Connection\* 9|Local Area Connection\* 8|Local Area Connection\* 2|6TO4 Adapter|sit0") {
   return false;
} else {
   return true;
}


You could add in tun1 to that list or whatever names you do not want to create.

johnny

Great thank you guys.
I got it working very helpful information.
I also filter the nodes with $node variable.

but why is it that when interface is down and do a status poll it says cannot poll from that interface, and when interface is back on it still says it cannot poll data from that interface?
also if I do a configuration poll when interface is down (even restart the interface) netxms deletes that interface.

johnny

Finally I've done it with Hook:ConfigurationPoll and I check for both "node name" and "Interface name" as well.
If it matches both of them then I set Interface Expected State to Ignore

interfaces = GetNodeInterfaces($node);
foreach (interface : interfaces)
{
if ( $node->name ~="(?i)Node1Name" && interface->name ~= "(?i)tun.*" ){
SetInterfaceExpectedState(interface, "IGNORE");
}else if ( $node->name ~="(?i)Node2Name" && interface->name ~= "(?i)tun.*|vmnet.*|docker.*|docker_gwbridge|vboxnet.*" ){
SetInterfaceExpectedState(interface, "IGNORE");}
}