Device groups - PHP exceptions

Tags: #<Tag:0x00007f849f45b1d8>

Hello all,

I wanted to create a “Device group” with dynamic assignment based on IP range. I’ve create the group, added rule and now I can’t access “Device groups” in the webui - I am getting PHP exceptions.

Output of validate.php:

[email protected]:/opt/librenms# ./validate.php 
Component | Version
--------- | -------
LibreNMS  | 1.55-22-g120e513f1
DB Schema | 2019_07_09_150217_update_users_widgets_settings (140)
PHP       | 7.2.19-0ubuntu0.18.04.1
MySQL     | 10.1.40-MariaDB-0ubuntu0.18.04.1
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.7.3

[OK]    Composer Version: 1.9.0
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[FAIL]  Some devices have not completed their polling run in 5 minutes, this will create gaps in data.
	Check your poll log and see:

The exceptions traceback:

Not sure if I hit some bug or did I something wrong?

Thank you in advance!

A little of both, maybe? The thing to remember here is that your basically writing the underlying SQL statement. From what I can tell you did a rule for ipv4_addresses.ipv4_address IN but SQL doesn’t really do subnet maths so that produces an error. You would need to match it like a string, maybe something like ipv4_addresses.ipv4_address regex 10.101.[0-9]{1,3}.[0-9]{1,3}

That said it’s a shame the query parser wasn’t able to detect the error before inserting it into the database.

You’re probably going to have to manually remove the bad entry from the device_groups table to restore access the device groups page. Report back if you need help with that.

1 Like

Thank you very much. That was it!

1 Like