LibreNMS update to Python 3

You may get the following alert in LibreNMS. Basically you need to install python 3 to keep things up to date.

Python 3 is required to run LibreNMS as of May, 2020. You need to install Python 3 to continue to receive updates. If you do not install Python 3 and required packages, LibreNMS will continue to function but stop receiving bug fixes and updates.

Install Python 3

Install Python 3 with yum, or apt if you are on a Debian based distro.

sudo yum install python3
sudo pip3 install -r /opt/librenms/requirements.txt

Verify LibreNMS is updated and working

Run the following commands to make sure that LibreNMS is working correctly and is up to date.

cd /opt/librenms
sudo ./validate.php
sudo ./

LibreNMS – failed

All the following commands are run from the “/opt/librenms” directory

$ sudo ./ 
Re-running /opt/librenms/ as librenms user
Updating to latest codebase                        FAIL
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.

Checking with validate.php shows that you can run githup-remove to fix it

$ sudo ./validate.php
[WARN]  Your install is over 24 hours out of date, last update: Mon, 23 Feb 2020 05:43:12 +0000
         Make sure your cron is running and run ./ by hand to see if there are any errors.
 [WARN]  Your local git contains modified files, this could prevent automatic updates.
         You can fix this with ./scripts/github-remove
         Modified Files:

Run “sudo ./scripts/github-remove -d”

$ sudo ./scripts/github-remove -d
Are you sure you want to delete all modified and untracked files? [y/N] y

You should also be able to remove the files individually if the above command does not work.

Run validate again to make sure it checks out good.

Now run ./

Manually create graph of device in LibreNMS

In LibreNMS, you can hit the “Show RRD Command” to give you the command to manually create a graph.  Copy the command.

In the command below, the path shows the IP address of the device to generate the graph from.  Theoretically you can change that to a different IP to generate graphs from other devices.

SSH into server server and run the command, change /tmp/randomtext to something like /root/mikrotik_092619.png or whatever you want.  You can also adjust the size, color etc of the graph.

 rrdtool graph /tmp/randomtext --alt-y-grid --alt-autoscale-max --rigid -E --start 1515946500 --end 1516551300 --width 1712.7 --height 483 -c BACK#EEEEEE00 -c SHADEA
#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:DejaVuSansMono --font AXIS:7:DejaVuSansMono -
-font-render-mode normal COMMENT:'Volts Cur Min Max\n' DEF:sensor495=/opt/librenms/rrd/ LINE1:sensor495#CC0000:'Voltage 0
 ' GPRINT:sensor495:LAST:%5.1lfV GPRINT:sensor495:MIN:%5.1lfV GPRINT:sensor495:MAX:%5.1lfV\l

Install Oxidized on LibreNMS

Install Oxidized

Install Instructions from here

Install prerequisites

sudo yum -y install make cmake which sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++

Install Ruby Gems

gem install oxidized
gem install oxidized-script oxidized-web

If you run into issues with installing the oxidized-web gem because of a ruby version, try installing ruby 2.6.1 via rvm the docs say install 2.1.2, but was having issues with it. 2.6.1 seems fine.

Install Oxidized

gem install oxidized 
gem install oxidized-script
gem install oxidized-web

Run Oxidized twice to generate the config


If you have issues running oxidized due to an invalid or self signed ssl cert, you can either fix the cert or ignore it in the oxidized config.

Modify the Oxidized config file in “/root/.config/oxidized/config” to look like this.

Modify the http portion of the config file to look like the following.

url: https://localhost/api/v0/oxidized
scheme: https
secure: false

Setup Config

vi .config/oxidized/config

Setup the config, Basic config below, edit as needed

username: admin
password: password
model: airos
resolve_dns: true
interval: 3600
use_syslog: false
debug: false
threads: 30
timeout: 20
retries: 3
prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/
next_adds_job: false
vars: {}
username: ubnt
password: ubnt
username: admin
ssh_port: 2222
models: {}
pid: /home/incredigeek/.config/oxidized/pid
directory: /home/incredigeek/.config/oxidized/crashes
hostnames: false
history_size: 10
default: ssh, telnet
debug: false
secure: false
passive: true
utf8_encoded: true
default: file
directory: /home/incredigeek/.config/oxidized/configs
default: http
debug: false
secure: false
scheme: https
url: https://localhost/api/v0/oxidized
name: hostname
model: os
group: group
X-Auth-Token: '3wq2b87fj4e6fb5987b5812t6ej9709g'
cisco: ios
juniper: junos
mikrotik: routeros

Setup as system service

Find the “oxidized.service” file, should be in


and copy it to


Edit it and change the user and try to launch it

systemctl start oxidized

If it fails, you may need to substitute the ExecStart= variable to the following more info


Change the ruby number if yours is different.

Enable the service on system boot up and start

systemctl enable --now oxidized

Check that oxidized is running

systemctl status oxidized

LibreNMS config

Add the following to your /opt/librenms/config.php config file.

# Oxidized configuration
$config['oxidized']['enabled'] = TRUE;
$config['oxidized']['url'] = '';
$config['oxidized']['features']['versioning'] = true;
$config['oxidized']['group_support'] = true;
$config['oxidized']['default_group'] = 'default';
$config['oxidized']['reload_nodes'] = true;# Oxidized configuration
$config['oxidized']['enabled'] = TRUE;
$config['oxidized']['url'] = '';
$config['oxidized']['features']['versioning'] = true;
$config['oxidized']['group_support'] = true;
$config['oxidized']['default_group'] = 'default';
$config['oxidized']['reload_nodes'] = true;
$config['oxidized']['ignore_os'] = array('linux','windows');
$config['oxidized']['ignore_types'] = array('server','power');

LibreNMS should now feed Oxidized the devices.

You can check in the LibreNMS interface to see if it is getting the configs. https://librenms/oxidized

where librenms is your LibreNMS servers ip/hostname.

LibreNMS enable RRDCached on CentOS 7

Commands from

Create System Service

sudo vi /etc/systemd/system/rrdcached.service
Description=Data caching daemon for rrdtool
ExecStart=/usr/bin/rrdcached -w 1800 -z 1800 -f 3600 -s librenms -U librenms -G librenms -B -R -j /var/tmp -l unix:/run/rrdcached.sock -t 4 -F -b /opt/librenms/rrd/

Save with esc + :wq

Enable rrdcached service on boot up and start the service now

systemctl enable --now rrdcached.service

Enable RRDcached in librenms config

vi /opt/librenms/config.php

add/edit the following line. If it is commented out, uncomment it

$config['rrdcached'] = "unix:/run/rrdcached.sock";

Save with esc + :wq

Check the disk IO after a little bit to see if it went down.

LibreNMS manually clean up MySQL Syslog Database

Adding the following option to the config.php file is supposed to delete anything over 30 days.

$config['syslog_purge']                                 = 30;

You can also manually delete the entries out of the MySQL database by logging into MySQL, selecting the librenms database, and running the command below.

The command deletes all entries older than 12/9/2018 at 08:00. Change the date and time as needed.

DELETE FROM syslog WHERE timestamp < '2018-12-9 08:00:00';

The following link has some more clean up options.

LibreNMS bulk delete

There is a php script in /opt/librenms/ that lets you delete a host from the command line.

sudo /opt/librenms/delhost.php

Replace with the hostname/ip address of the host you want to delete.

Delete Multiple Hosts

First you’ll need to get a list of devices you want to remove.  You can do this by viewing the devices in the LibreNMS MySQL database;


$ mysql -u librenms -p librenms
MariaDB [librenms]> select hostname from devices;
| hostname |
| |
| |
| |
| |
4 rows in set (0.00 sec)
MariaDB [librenms]> exit

Put all the IP addresses you want to remove into a file and run the following for loop.  Replace “remove_ip.lst” with the name of your ip list file.

for i in `cat ~/remove_ip.lst`; do sudo /opt/librenms/delhost.php $i; done