LibreNMS

Campus Network Design Workshop

You are going to run LibreNMS in docker containers on your “srv2” virtual machine. Once this is complete, it will be reachable under a separate URL for each campus:

1 Installing LibreNMS on srv2

One of the people in your group should do this task - the others watch.

Open an SSH connection to srv2 in your campus.

The configuration files you need to run the docker containers are already preset. Run the following commands to select the correct directory and then update them:

cd /usr/local/src/nmm-docker-compose
sudo git pull

Next, you are going to start “traefik” which is a HTTP proxy that allows inbound web connections to be routed to the correct container.

cd traefik
docker compose up -d
cd ..

You should see a series of files being downloaded, ending up something like this:

[+] Running 5/5
 :: reverse-proxy Pulled                                         3.2s
   :: 9621f1afde84 Pull complete                                 0.4s
   :: f62b4fe8af5e Pull complete                                 0.7s
   :: ba654a766834 Pull complete                                 2.1s
   :: 55d4785f2007 Pull complete                                 2.2s
[+] Running 2/2
 :: Network traefik_proxy              Created                   0.1s
 :: Container traefik-reverse-proxy-1  Started                   0.5s

(Don’t forget the cd .. step after this!)

Now repeat for LibreNMS:

cd librenms
docker compose up -d
cd ..

You should see something similar, although with a larger number of downloads and a larger set of containers running.

If you have any problem, talk to your instructor.

1.1 About docker compose

“docker compose” (which was known as “docker-compose” in older versions of docker) reads in a configuration file called docker-compose.yml. This tells it how to start up one or more software containers, and connect them together.

The -d flag which you gave to docker compose up means “detach”: that is, once the containers are started, they will continue to run in the background and you are returned to the shell.

Try the following commands to monitor your docker setup:

docker compose ls      # shows all the "docker compose" projects running
docker ps              # shows all the individual docker containers running
docker stats           # shows the memory and CPU use of each container
                       # (continuous stream; use ctrl-C to exit)

1.2 Create LibreNMS admin account

Now go to the LibreNMS web interface, which is reachable via the virtual training platform web interface under Campus X > Web > librenms, or as http://librenms.campusY.ws.nsrc.org for in-person training.

The first time you connect, it will ask you to create an admin account. Enter the following:

Then click the tick, then “Finish install”, then “Dashboard”, which will bring you back to a login screen.

Congratulations, LibreNMS is ready to use! Move onto the next exercise.

2 Reference: Installing LibreNMS at home

To install LibreNMS in your own network, then you should follow the instructions in the documentation site.

There are three options:

3 Tuning LibreNMS

There are some tuning steps to improve the performance of LibreNMS. These have already been done in the lab.

3.1 Use rrdcached

rrdcached allows LibreNMS to write information about devices to memory instead of directly to disk. LibreNMS is a resource-intensive tool and adding memory cache support to LibreNMS will lessen the load on your server.

See https://docs.librenms.org/Extensions/RRDCached/.

3.2 Tuning Mysql / MariaDB

The following settings can go in /etc/mysql/mariadb.conf.d/99-librenms.cnf to override defaults:

[mysqld]
innodb_file_per_table=1
lower_case_table_names=0
innodb_flush_log_at_trx_commit = 2

Some systems and/or older versions of LibreNMS may also require sql-mode="".

See: