There’s a range of great monitoring tools available to you to monitor and alert on all aspects of your network. Here we’re going to look at one of my favourite open-source packages, LibreNMS.
LibreNMS is a fork of Observium but it has a focus on presentation and usability. It’s certainly easier to get up and running with LibreNMS. With great graphs, a truck-load of notification options, including PushBullet, it’s everything you want from a network tool.
One area where LibreNMS is currently weak is in the support for custom MIB files. Whilst LibreNMS has good support for a large range of network switches and devices, it’s support for MIB files is still very experimental. This has never been an issue for me when it comes to monitoring networks as LibreNMS always seems to discover something it can monitor, but you might need to get down and dirty in terminal to get more esoteric devices up and monitoring.
For this walk-through I’m assuming that you have a Ubuntu Server 14.04 and we’re using LibreNMS version c72d8cc. I’m using Emacs as my editor of choice (it is the best, after all) but feel free to use whatever you want. I’m also assuming that LibreNMS will be the only thing running on this server and that you aren’t looking to run the MySQL functions on another server.
- First off install Emacs.
sudo apt-get install emacs
- Configure MySQL using the command line.
mysql -u root -p
- Enter the following commands in to the mysql prompt.
create database librenms;
grant all privileges on librenms.* to 'librenms'@'localhost' identified by 'password';
- Install the required software.
apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-snmp php-pear php5-curl snmp graphviz php5-mcrypt php5-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git
- Create a user account for Libre and add it to the www-data group for apache.
sudo useradd librenms -d /opt/librenms -M -r
sudo usermod -a -G librenms www-data
sudo chmod ug+w librenms
- Download the LibreNMS files using GIT, which was installed as part of the software packages in step 4.
sudo git clone https://github.com/librenms/librenms.git librenms
- Create the folders needed for RRD and assign the right permissions.
sudo mkdir rrd logs
sudo chown -R librenms:librenms /opt/librenms
sudo chmod 775 rrd
- Next create the Apache configuration file for Libre;
sudo emacs /etc/apache2/sites-available/librenms.conf
- Paste the following text in to the editor. Change “MyHostname” to match your servers hostname.
CustomLog /opt/librenms/logs/access_log combined
Require all granted
Options FollowSymLinks MultiViews
- Enable the mcrypt Apache module
sudo php5enmod mcrypt
- Tidy up and restart Apache
sudo a2ensite librenms.conf
sudo a2enmod rewrite
sudo a2dissite 000-default
sudo service apache2 restart
- Right. Now for the web based configuration. Visit the install URL in your browser to start the configuration process. Change the “MyHostname” to match your hostname.
- All being well you should see the following configuration page. Click Next.
- On the following screen enter your MySQL details. The database, username and password have to match the details used in step 4 above.
- In the next page enter the username and password for your main admin user. Don’t lose this, it will be needed for any system changes.
- Confirm you want to create the configuration file (you do after all) and hit Generate.
- All being well, you shouldn’t see any error messages. Click Finish.
- …and you are done. Congratulations. Now to quickly look at adding devices.
Now you need to configure a few more things. We’re going to add the LibreNMS box to the list of devices from the command line and then we’re going to set up regular polling of the registered devices in LibreNMS.
- Go back to your terminal window and add the local server to the list of LibreNMS devices and run a discovery of the SNMP objects available.
sudo php addhost.php localhost public v2c
sudo php discovery.php -h all
- Copy the cron file containing all the scheduled times for the discovery scripts to the right location.
sudo cp librenms.nonroot.cron /etc/cron.d/librenms
- Finally, you can add network devices. Pop back to the web interface. Click on the Devices menu then Add Device. Enter the IP of the device.
- It should be added and LibreNMS will start monitoring.
And we are done. Phew, high five people!