LibreNMS – A Fully Featured Network Monitoring Tool for Linux

LibreNMS is an open source, powerful and feature-rich auto-discovering PHP based network monitoring system which uses the SNMP protocol. It supports a broad range of operating systems including Linux, FreeBSD, as well as network devices including Cisco, Juniper, Brocade, Foundry, HP and many more.

LibreNMS Features:

It auto-discovers a whole network using these protocols: CDP, FDP, LLDP, OSPF, BGP, SNMP and ARP.

2. Once all the packages are installed, nginx, php-fpm, mariadb and snmp services will be started and enabled to auto-start at boot time (this is normally the case with Ubuntu), otherwise, you can run the commands below to start and enable them.

Step 2: Install LibreNMS Monitoring Tool

3. Next, create a system user called librenms, with the useradd command; where the -M flag disables creation of user’s home directory, and -r enables creating of a system account. Then add the librenms user to the group www-data (on Ubuntu) or nginx (on CentOS) as follows.

Step 3: Create LibreNMS Database

5. Before you can start using the MariaDB server, you need to secure your installation, run the security script provided in the binary package. It will ask you set a root password, remove anonymous users, disable root login remotely and remove test database.

You can launch the script by issuing the below command and answer all questions with yes/y.

Step 8: Access LibreNMS Web Installer

22. Next, use the following URL to access the web installer and follow the on-screen instructions.

http://librenms.tecmint.lan/install.php

For this address to work on a local machine, you need to setup a local DNS using the hosts file (/etc/hosts), for local domain resolution or testing purposes before going live.

192.168.43.31 tecmint.lan
192.168.43.31 librenms.tecmint.lan

Setup Local DNS for Domain

23. You will see the installation welcome page as shown in the following screenshot, click Next Stage to continue.

LibreNMS Web Installer

24. Then enter the settings (database host, port, username and user password) for the LibreNMS database and click Next Stage to proceed.

LibreNMS Database Settings

25. The web installer will now start importing the MySQL database, this will take some time. Note that the process will try to pause at certain points, simple click on Retry to continue with the importation process.

LibreNMS Database Importing

26. Once the database importation is complete, you should see the message “Database is up to date!”, as shown in the screenshot below. Then click on Goto Add User to proceed.

LibreNMS Database Updated

27. Next, add a LibreNMS user, specify username, password and email, then click on Add User to effect the changes.

Add LibreNMS User

28. Now click on create the LibreNMS configuration for your system, by clicking Generate Config.

Generate Librenms Config

LibreNMS Configuration

29. Once the config is generated, as shown in the previous screenhot, copy it and save it in the root directory of your installation, in a file called /opt/librenms/config.php.

# vi /opt/librenms/config.php

LibreNMS Configuration

<?php
## Have a look in defaults.inc.php for examples of settings you can set here. DO NOT EDIT defaults.inc.php!
### Database config
$config['db_host'] = 'localhost';
$config['db_port'] = '3306';
$config['db_user'] = 'librenms';
$config['db_pass'] = '[email protected]!#@%$libre';
$config['db_name'] = 'librenms';
$config['db_socket'] = '';
// This is the user LibreNMS will run as
//Please ensure this user is created and has the correct permissions to your install
$config['user'] = 'librenms';
### Locations - it is recommended to keep the default
#$config['install_dir'] = "/opt/librenms";
### This should *only* be set if you want to *force* a particular hostname/port
### It will prevent the web interface being usable form any other hostname
#$config['base_url'] = "http://librenms.company.com";
### Enable this to use rrdcached. Be sure rrd_dir is within the rrdcached dir
### and that your web server has permission to talk to rrdcached.
#$config['rrdcached'] = "unix:/var/run/rrdcached.sock";
### Default community
$config['snmp']['community'] = array("public");
### Authentication Model
$config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth
#$config['http_auth_guest'] = "guest"; # remember to configure this user if you use http-auth
### List of RFC1918 networks to allow scanning-based discovery
#$config['nets'][] = "10.0.0.0/8";
#$config['nets'][] = "172.16.0.0/12";
#$config['nets'][] = "192.168.0.0/16";
# Update configuration
#$config['update_channel'] = 'release'; # uncomment to follow the monthly release channel
#$config['update'] = 0; # uncomment to completely disable updates

30. Save and close the file. Then return to the web installer to continue with the installation process, by clicking Finish Install.

Finish LibreNMS Installation

31. Now your LibreNMS installation is complete, you can click on “validate your install and fix any issues”, the login page should appear.

Validate LibreNMS Install

32. Next, enter your user credentials to access the validation page.

LibreNMS Login Page

33. From the installation validation process, LibreNMS has discovered two issues, one is that devices have not been added (this is a warning for now), and secondly, we have not set the appropriate permission on the config file (/opt/librenms/config.php) which was manually added, as shown in the screen shot below.

LibreNMS Permission Issues

Now run the following command to set the correct permission on the config file.

$ sudo chown -R librenms:librenms /opt/librenms/config.php

34. To add devices, go to: http://librenms.tecmint.lan/addhost. After adding devices, you can go to the home page and add various dashboards.

LibreNMS Dashboard

That’s It! You can find more information, including installation and setup on the LibreNMS Documentation at https://docs.librenms.org/.

LibreNMS is a fully featured network monitoring system that supports a variety of network hardware. We hope that this was a lucid installation guide, if you have any questions, reach us via the feedback form below.

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Correct, this depends on your PHP version. If you have PHP 7.2, then use fastcgi_pass unix:/var/run/php-fpm/php7.2-fpm.sock; or if you have PHP 7.0, use fastcgi_pass unix:/var/run/php-fpm/php7.0-fpm.sock; and so on. Many thanks for sharing this.

Please revisit the nginx configuration area while looking at the files in a current version of CentOS 7 as so much in your how-to is different to current files in CentOS 7 that I cannot work out what to do.