Bulk overide sysLocation based on group or IP

Most of my devices are ping only and I would like to bulk change their location … In a perfect world by their group but IP will work as well. I am assuming I will need to do a sql statement in order to achieve this. Any thoughts?

Thanks so much.

Yes sql statement

:slight_smile: any idea where it is in the DB?

Hi,
Have a look at devices.location_id which refers to the locations table:

MariaDB [librenms]> select * from locations limit 1;
+----+----------+-----+-----+-----------+
| id | location | lat | lng | timestamp |
+----+----------+-----+-----+-----------+

PipoCanaja

1 Like

Thanks. So it looks like I will need to change 2 things. override_sysLocation to 1 and then based on other parameters, the location_id to match locations

My sql skills blow but this does work for those interested. Backup your DB first and do this with caution.

log into librenms DB as librenms user.

First find your locations
SELECT * FROM locations LIMIT 5;

Next maker sure the devices are setup for syslocation override or else anything with snmp will possibly overwrite it. (my hostnames are the ip of the devices… not sure why but the IP column isn’t populated in my db)

UPDATE devices
SET override_sysLocation = 1
WHERE hostname LIKE ‘10.0.1.%’ ;

Finally update to match(in my case these devices belong to location_id 10 found from step 1)

UPDATE devices
SET location_id = 10
WHERE hostname LIKE ‘10.0.1.%’

1 Like