By clicking or navigating this website site, you agree to allow our collection of information on Scaleway to offer you an optimal user experience and to keep track of statistics through cookies. Learn more about our Cookie Policy.

Monitor Instances with LibreNMS on Ubuntu Bionic

LibreNMS Overview

LibreNMS is a fully featured network monitoring system that supports a wide range of network hardware and operating systems including Linux and Windows. As well as network equipment made by Cisco, Juniper, Foundry, and many more.

The software is based on PHP and MySQL (MariaDB) and is a community-based fork of the last GPL-licensed version of Observium.

Setting up the Cronjob and Logrotate

Cron is a job scheduler available on Linux systems. It can be used to run jobs (i.e. shell scripts) automatically at given points in time to automatize system maintenance. Logrotate is a tool to rotate log files automatically. This means to clean up log files periodically by removing old contents to ensure the disk space they occupy does not exceed a configured maximum value.

2 . To avoid that the log files of LibreNMS become too large, logrotate can rotate them out from time to time to save space. Enable it by copying the provided configuration file into /etc/logrotate.d:

cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms

Running the Web Installer

1 . Open a web browser and go to your LibreNMS instance:

https://librenms.example.com/install.php

2 . Fill in the database connection parameters and the password set during database creation:

3 . Configure a user and password for LibreNMS and complete the setup.

4 . Login to LibreNMS with the user and password created in the previous step:

Adding Localhost

Start by adding the local host as the first device to monitor:

1 . Once logged in, click on Devices, then Add Device in the pop-up menu:

2 . Enter the hostname localhost, keep SNMP on, leave the values for SNMP version and Port Association Mode as preset. Enter the configured community name in the file /etc/snmp/snmpd.conf as value for Community. Once all values are set, click on Add Device to add the device:

3 . LibreNMS starts polling the device and different graphs are created, showing the status of the device.

Adding a Remote Device

LibreNMS is capable of monitoring many different network devices. To monitor a remote cloud instance or bare metal server, the use of SNMP is widespread. SNMP stands for Simple Network Management Protocol. It is a protocol that was designed for monitoring and management purposes of network-connected devices (servers, switches, printers, routers, etc.). On Ubuntu systems a daemon called SNMPd is available to listen and reply to SNMP requests.

1 . To monitor another cloud instance or bare metal server, connect to the machine as root:

ssh root@second_cloud_instance

2 . Update the apt repository inventory:

apt update

3 . To display distribution information, download the distro script and make it executable:

Edit the file to meet your requirements, the meaning of the different lines is explained below:

com2sec readonly 123.123.123.123 RANDOMSTRINGGOESHERE - This line maps a security string to a community name. A security string is an access policy, an IP address limitation (replace 123.123.123.123 with the IP address of the LibreNMS instance) and a community name (replace RANDOMSTRINGGOESHERE with the community name configured during the installation of LibreNMS).

The line group MyROGroup v2c readonly maps a group (MyROGroup) to a security name (v2c readonly).

The line view defines a subset of which information from the MIB is visible when polling the device via SNMP

With the line access MyROGroup "" any noauth exact all none none acces rules are tied to the group set before. In this example it means that the group MyROGroup can, in any context (“”), access the data over any version of the protocol (any), without authentication (noauth), matching the exact context (exact), allowing access to all view rules (all). No write (none) or modify access (none) is permitted.

syslocation “Paris, France” is pretty self-explanatory and specifies the geographical location of the machine.

syscontact Your Name <your@email.address> defines the administrative contact for the machine.

The last line is used to communicate the distribution information collected by distro via SNMP

Edit the values in the file towards your needs before saving it and exiting the editor.

7 . Restart the SNMP service:

systemctl restart snmpd

8 . Add the device to LibreNMS by clicking on Devices, then Add Device in the pop-up menu from within the LibreNMS web interface.

9 . Enter the hostname of the device, keep SNMP on, leave the values for SNMP version and Port Association Mode as preset. Enter the community name set in the file /etc/snmp/snmpd.conf as value for Community. Once all values are set, click on Add Device to add the device.

10 . LibreNMS starts polling the device and creating different graphs showing the status of the device: