Dynamic Groups don't show all devices

Hi,

====================================

Component Version
LibreNMS 1.66-20-g54e5dc3df
DB Schema 2020_07_29_143221_add_device_perf_index (172)
PHP 7.2.24-0ubuntu0.18.04.6
Python 3.6.9
MySQL 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3
====================================

I’ve got an issue with dynamic groups.
The rule is : devices.type = “network” AND ipv4_addresses.ipv4_address LIKE ‘10.1.%’
In the GUI group shows me 31 devices and the missing devices are not grouped, when mysql show me 37 devices
This happens for all my groups built like that : network + ip starts with …


MariaDB [librenms]> select count() from devices where type=‘network’ and INET6_NTOA(ip) like ‘10.1%’;
±---------+
| count(
) |
±---------+
| 37 |
±---------+
1 row in set (0.00 sec)

Any idea ?
Thanks by advance for you help :slight_smile:

Hi,

In your direct query, you search for 10.1% while in your group is 10.1.%

Could be that the difference?

Hi,

Indeed this could be a problem, but not in our case because the second byte represents the location, and I’m willing to group my switchs by location

MariaDB [librenms]> select count(*) from devices where type='network' and INET6_NTOA(ip) like '10.1.%';
+----------+
| count(*) |
+----------+
|       37 |
+----------+
1 row in set (0.00 sec)

Any other idea dudes ?

OK I think I’ve found the reason of the difference.
The IP address used is not the address stored in the device table, but the address attached to the ports of the device.
In my case all the IP are NULL for the devices not attached to the group.
example with 2 devices : 28 is OK, 411 is not shown in the group

MariaDB [librenms]> select a.port_id,a.device_id,ipv4_address 
from ports a 
left join ipv4_addresses b 
on a.port_id=b.port_id 
where (a.device_id=28 or a.device_id=411) and ipv4_address is not NULL;
+---------+-----------+--------------+
| port_id | device_id | ipv4_address |
+---------+-----------+--------------+
|     827 |        28 | 127.0.0.1    |
|     830 |        28 | 10.1.192.30  |
+---------+-----------+--------------+
2 rows in set (0.00 sec)

Now I need to figure WHY there is no IP seen for the ports…
An SNMP issue ?
The IP of the #411 is 10.1.192.27

Here is the snmpwalk and we can see this IP inside : https://p.libren.ms/view/a23061d3

OK, let me continue my monologue …
The problem is that the VLAN Interface ports are not created in the ports table.
This was due to :
$config[‘bad_if_regexp’][] = ‘/(^dsc|^lo\d|^tap|^gre|^ipip|^pime|^pimd|^mtun|^me\d|^bme\d|^vlan|^regist|^Null|^inLo|^register-T)/i’
I took this idea from : https://github.com/librenms/librenms/issues/2945 to reduce the polling time …
bad idea in fact because it prevented Librenms to create the VlanInterfaces which hold the switch IP

I’ll find the right regexp :wink:

Thanks anyway for reading

1 Like