Bulk disabling modules in LibreNMS

So I was in the process of adding in a large quantity of devices into LibreNMS but noticed a few days later the discovery and polling times were getting longer. Not really to be unexpected as there was more devices but some devices took an abnormally amount of time to finish the SNMP scans. Below is an example how to bulk disable attributes under LibreNMS (likely to work on Observium as well).

Outside of globally disabling different modules we will need to talk directly to the MySQL database in order to accomplish what we are looking for.

In the below example I’m looking at disabling the discover_arp-table on all Windows hosts.

select device_id,hostname from devices where OS = 'windows';

Then copy and paste the results into your favorite editor (I generally use excel for data like this).

="insert into devices_attribs (device_id,attrib_type,attrib_value) values ("""&A2&""",""discover_arp-table"",""0"");"

In the above the “A” column contains all the device_id’s I wish to adjust.

This will generate MySQL insert statements like the below

insert into devices_attribs (device_id,attrib_type,attrib_value) values ("4","discover_arp-table","0");

At this point all you need to do is run the generated MySQL statements against the LibreNMS database to disable the given module in bulk.

Leave a comment

Your email address will not be published. Required fields are marked *