'bad_if_regexp' ports still going to be added in database


#1

Hello. Have some problems with polling ignored ports. Here are the rules in config.php:

$config['bad_if_regexp'][] = "/^veth[0-9a-f]{7}$/";                 
$config['bad_if_regexp'][] = "/^docker0$/";                                   
$config['bad_if_regexp'][] = "/^br-[0-9a-f]{12}$/";

The first discover and polling are ok:

dev:/opt/librenms# ./discovery.php -h host.my -m ports
LibreNMS Discovery
host.my 2 linux 

#### Load disco module core ####

>> Runtime for discovery module 'core': 0.0880 seconds with 9608 bytes
>> SNMP: [2/0.03s] MySQL: [8/0.18s] RRD: [0/0.00s]
#### Unload disco module core ####


#### Load disco module ports ####
Adding: lo(1)(69)Adding: eth0(2)(70)Adding: eth1(3)(71)Adding: altdocker-sys(5)(72)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

>> Runtime for discovery module 'ports': 0.1580 seconds with 49824 bytes
>> SNMP: [4/0.04s] MySQL: [9/0.11s] RRD: [0/0.00s]
#### Unload disco module ports ####

Discovered in 1.389 seconds

SNMP [6/0.07s]: Get[2/0.03s] Getnext[0/0.00s] Walk[4/0.04s]
MySQL [20/0.33s]: Cell[0/0.00s] Row[6/0.01s] Rows[3/0.00s] Column[0/0.00s] Update[2/0.04s] Insert[9/0.28s] Delete[0/0.00s]
RRD [0/0.00s]: Update[0/0.00s] Create [0/0.00s] Other[0/0.00s]
dev:/opt/librenms# ./poller.php -h host.my -m ports
LibreNMS Poller
Starting polling run:

Hostname: host.my
Device ID: 2
OS: linux (unix)

Created directory : /data/rrd/host.my/

#### Load poller module core ####
Uptime: 52 days, 10h 30m 32s

>> Runtime for poller module 'core': 0.0640 seconds with 365152 bytes
>> SNMP: [2/0.02s] MySQL: [2/0.03s] RRD: [3/0.00s]
#### Unload poller module core ####


#### Load poller module ports ####
Caching Oids: Full ports polling ifDescr ifAdminStatus ifOperStatus ifLastChange ifType ifPhysAddress ifMtu ifInErrors ifOutErrors ifInDiscards ifOutDiscards dot3StatsDuplexStatus
Port lo: lo (1 / #69) VLAN =  ifAdminStatus ifOperStatus ifMtu ifSpeed ifHighSpeed ifPromiscuousMode ifConnectorPresent lobps(0 bps/0 bps)bytes(0 B/0 B)pkts(0 pps/0 pps)
Port eth0: eth0 (2 / #70) VLAN =  ifAdminStatus ifOperStatus ifMtu ifSpeed ifHighSpeed ifPhysAddress ifPromiscuousMode ifConnectorPresent eth0bps(0 bps/0 bps)bytes(0 B/0 B)pkts(0 pps/0 pps)
Port eth1: eth1 (3 / #71) VLAN =  ifAdminStatus ifOperStatus ifMtu ifSpeed ifHighSpeed ifPhysAddress ifPromiscuousMode ifConnectorPresent eth1bps(0 bps/0 bps)bytes(0 B/0 B)pkts(0 pps/0 pps)
Port altdocker-sys: altdocker-sys (5 / #72) VLAN =  ifAdminStatus ifOperStatus ifMtu ifHighSpeed ifPromiscuousMode ifConnectorPresent altdocker-sysbps(0 bps/0 bps)bytes(0 B/0 B)pkts(0 pps/0 pps)

>> Runtime for poller module 'ports': 1.1039 seconds with 21792 bytes
>> SNMP: [14/0.19s] MySQL: [43/0.89s] RRD: [15/0.00s]
#### Unload poller module ports ####


Polled in 2.408 seconds
#### Start Alerts ####
#### End Alerts ####
SNMP [17/0.23s]: Get[3/0.04s] Getnext[0/0.00s] Walk[14/0.19s]
MySQL [54/1.17s]: Cell[2/0.00s] Row[-2/-0.00s] Rows[3/0.00s] Column[2/0.00s] Update[11/0.21s] Insert[38/0.95s] Delete[0/0.00s]
RRD [27/0.00s]: Update[9/0.00s] Create [9/0.00s] Other[9/0.00s]

But ‘bad_if_regexp’ ports are appeared in db in a few minutes:

mysql> select count(*) from ports where ifDescr like 'veth%' and device_id=2;
+----------+
| count(*) |
+----------+
|       54 |
+----------+

My validate:

dev:/opt/librenms# ./validate.php 
====================================
Component | Version
--------- | -------
LibreNMS  | 1.47
DB Schema | 275
PHP       | 7.2.13
MySQL     | 5.6.42
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 1.8.4
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct

How can I solve this problem?
Thank you in advance.


#2

Do you have multiple pollers? Have you set bad_if_regexp on all pollers or in the database?


#3

No, I use default poller.php. Nothing more.

What do you mean? As I see, I just need to add rules in config.php (https://docs.librenms.org/Support/Configuration/). Should I change something in db?


#4

Moreover, I see db updates where this ports are marked as deleted, BUT the filed ‘deleted’ is still 0 in db:

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",58] 23.99ms] 
-X
ignored by ifDescr: br-f88fbeb9381d (matched: /^br-[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",59] 23.83ms] 
-X
ignored by ifDescr: vethe070481 (matched: /^veth[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",60] 19.58ms] 
-X
ignored by ifDescr: veth3557b56 (matched: /^veth[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",61] 17.99ms] 
-X
ignored by ifDescr: veth9f8c0e7 (matched: /^veth[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",62] 18.06ms] 
-X
ignored by ifDescr: vetha6c79b5 (matched: /^veth[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",63] 17.88ms] 
-X
ignored by ifDescr: veth86e98f6 (matched: /^veth[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",64] 17.84ms] 
-X
ignored by ifDescr: veth42ee65f (matched: /^veth[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",65] 17.71ms] 
-X
ignored by ifDescr: veth6e548bc (matched: /^veth[0-9a-f]*$/)

SQL[UPDATE `ports` set `deleted`=? WHERE `port_id` = ? ["1",66] 17.96ms] 
-X
+---------+-------------+---------+
| port_id | ifDescr     | deleted |
+---------+-------------+---------+
|      60 | vethe070481 |       0 |
|      61 | veth3557b56 |       0 |
|      62 | veth9f8c0e7 |       0 |
|      63 | vetha6c79b5 |       0 |
|      64 | veth86e98f6 |       0 |
|      65 | veth42ee65f |       0 |
|      66 | veth6e548bc |       0 |
+---------+-------------+---------+
7 rows in set (0.00 sec)