On December 10, 2017 In Blog, Tech, Tutorials

Synology SNMP Network Monitoring with LibreNMS Docker

Synology SNMP Monitoring with LibreNMS

Tutorial for installing LibreNMS on Synology NAS via Docker to monitor SNMP enabled network devices

Update

Oct 09, 2018

  • Major change/overhaul to this tutorial with LibreNMS 1.43 & jarischaefer’s new image instructions

Aug 24, 2018

  • Portainer
    • Added “Reduce/Minimum downtime during upgrade”
  • Network troubleshooting
    • Added “Troubleshooting steps”
  • Alerting
    • LibreNMS sent to Discord eyecandy 😉

Jun 23, 2018

  • “Updating Containers”
    • Added “Portainer”

May 20, 2018

  • Docker run examples updated to match jarischaefer’s  custom PHP template
    • Added <?php on front as per jarischaefer’s instructions
  • Added “Updating Containers” section
  • Added “Networking issues & a quick 101” in the Troubleshooting section

LibreNMS v1.43

A big part of this tutorial have been changed due to changes made in LibreNMS and also jarischaefer’s image. Huge thanks to Evert Meulie for initially following my tutorial, commented about TZ and then reported back to me that the container started and stopped, which led me to try out my tutorial from scratch with a new docker container. Indeed, my tutorial stopped working as intended

As I will need more time to read up on the major changes/release notes on LibreNMS, I have temporarily typed up some commands to get you started and run a working example in the end. You can follow exactly as it is, or change the values accordingly as written out in the ## comments

Copy this block of commands into a text file and edit accordingly, especially if you are not on a Syno box, you will most definitely not have “/volume1/docker”. Note: This is a quick way of getting MariaDB and LibreNMS container started and working with default values Eg: Test environment

If you want to understand how the values/commands come about, you can read the rest of the tutorial to understand a little bit more on what these values mean

Tested on the following:

LibreNMS 1.43 – Fri Aug 31 2018 16:37:38 GMT+0800
MariaDB 10.3.10-MariaDB-1:10.3.10+maria~bionic

##### quick run and test installation of librenms
### 1 - Prepare folders
## replace folder with your docker folder
cd /volume1/docker/

mkdir mariadb
mkdir librenms
cd librenms
mkdir logs
mkdir rrd
touch config.custom.php

### 2 - mariadb docker run commands

## replace if needed to point to your docker folder -v /volume1/docker/:/var/lib/mysql \
## replace TZ values if needed
## replace MYSQL_ROOT_PASSWORD= if needed

docker run --name mariadb \
 -v /volume1/docker/mariadb:/var/lib/mysql \
 -e [email protected] \
 -e TZ=Asia/Singapore \
 -d mariadb:latest --sql-mode=''

### 3 - manually create a database called "librenms" in MariaDB container
docker exec -it mariadb mysql -u root -p

CREATE DATABASE librenms;
quit

### 4 - generate APP_KEY as per jarischaefer's instructions
## copy this APP_KEY value somewhere, includes "base64"
MY_APP_KEY=`docker run --rm jarischaefer/docker-librenms generate_key` && echo "Your LibreNMS APP Key is: $MY_APP_KEY"

### 5 - librenms docker run commands

## replace -v variables if needed to point to your docker/librenms location
## replace -e BASE_URL with your NAS IP
## replace TZ values if needed
## replace DB_PASS= if needed, same as your MariaDB password above

docker run \
 -d \
 -p 8668:80 \
 -e APP_KEY=paste_your_generated_APP_key_here \
 -e DB_HOST=db \
 -e DB_USER=root \
 -e DB_NAME=librenms \
 -e [email protected] \
 -e BASE_URL=http://NAS-IP:8668 \
 -e TZ=Asia/Singapore \
 --link mariadb:db \
 -v /volume1/docker/librenms/logs:/opt/librenms/logs \
 -v /volume1/docker/librenms/rrd:/opt/librenms/rrd \
 -v /volume1/docker/librenms/config.custom.php:/opt/librenms/conf.d/config.custom.php \
 --name librenms \
 jarischaefer/docker-librenms:latest

### 6 - initial librenms & mariadb setup database
docker exec librenms setup_database

### 7 - creates an admin user called "admin" with password "admin"
docker exec librenms create_admin

### Tested on
### LibreNMS 1.43 – Fri Aug 31 2018 16:37:38 GMT+0800
### MariaDB 10.3.10-MariaDB-1:10.3.10+maria~bionic

The above block of commands is not a full linux script, so you can’t just copy and paste the whole thing into your terminal and expect it to work 😉

I have made some comments in it for better understanding, it should take you 8 copy-and-paste steps 🙂

  1. Prepare folders
  2. MariaDB docker run commands
  3. Manually create a database called “librenms” in MariaDB container
  4. Generate APP_KEY as per jarischaefer’s instructions
  5. LibreNMS docker run commands
  6. Initial LibreNMS & MariaDB setup database
  7. Creates an admin user called “admin” with password “admin”

If you are planning to read the rest of this tutorial, the noticeable changes/additions to the original steps are:

  • Manually creating a MariaDB SQL database named “librenms”
  • Generating APP_KEY value prior to the full “librenms docker run” command
  • The rest of the steps are somewhat similar, they may be setting changes in the config.custom.php, which you would need to read up on LibreNMS and/or jarischaefer’s documentation

Let me know in the comments if this newest step/tutorial update worked out for you! If you need help and is using Discord, you can contact me via my Discord server at the bottom of the page

Step by Step

It can be a hassle to google the web & forums for a straight-forward answer, especially IT related, where the replies you get either expect you to understand the acronyms/terms and just point you in a “vague” direction. Sure, you do get the rare samaritans that bring you along. Not everyone grew up being a tech enthusiast (Fortunately I was one…)

As with all tutorials, I can’t possibly cover all aspects, but one thing for sure, you will learn to “learn”, if possible in layman easy to understand terms and finally give you a stable and working setup/environment example in the end.

Some disclaimer: I am not a network/tech specialist, I was given a chance to deploy a medium scale WiFi on an island, all from scratch. Tutorials written on my website all came from my personal experience, so it will suit the enthusiasts that want to learn more about networking without browsing multiple forums and to learn from practical.

Requirements

The whole idea started when I bought the Synology 916+, so I will base the setup on installing in Syno NASes.

  • Main Requirement & Setup (This tutorial)
    • Synology NAS model able to run the following:
      • Package: Docker
      • DSM SSH access
    • Optional: Other SNMP enabled devices like Routers, Managed Switches, Workstations to list a few
  • My Devices
    • Synology DS916+
      • DSM 6.1.4-15217 Update 2
    • OSX – MacBook Pro
  • What you will touch on
    • DSM SSH access
    • Terminal/Putty
    • Docker

Who is this tutorial for

  • Beginners & Enthusiasts
    • Next to no experience in Linux but willing to be adventurous
  • SMB Owners, Managers, Entrepreneurs who want to understand or DIY deploy their own NMS monitoring for company devices
  • Home lab owners
  • Linux veterans; why are you here?! 😉

Summary Sections

  1. Install Docker, Enable SSH & SNMP
  2. SSH into Syno NAS
  3. Install MariaDB via Docker container
  4. Install LibreNMS via Docker container
  5. Configure LibreNMS
  6. Add your Synology & Other Devices
  7. Optionals
    • config.custom.php
    • Alerts
    • Use SVG graphs
    • myLibreNMS app via LibreNMS API
  8. Troubleshooting
    • Networking issues & a quick 101
  9. Updating Containers
  10. Afterword

Install Docker, Enable SSH & SNMP

  • Install Docker

Install the Docker app from DSM Package Center >> Search for “Docker”

This should be pretty straightforward

  • Enable SSH

Well, if you don’t know how to SSH into your DSM. Let’s begin by enabling SSH option in your Synology

Control Panel (Advanced Mode) >> Terminal & SNMP >>
Check Enable SSH service
port: 22 (default 22, change if you wish accordingly)

  • Enable SNMP

Click on the SNMP tap
Check  Enable SNMP service
Check  SNMPv1, SNMPv2c service

Community: enter-something-here

Enter in the Community field a rather difficult but not too complex phrase. This works kind of like your passphrase where the NMS will ask you for later. The default is “public” on most SNMP devices, and is highly recommended to change it to something unique.

Do not use your frequently used password as it will be seen on the DSM SNMP settings page.

SNMP Device Information
Device Name: fill-in accordingly, usually NAS hostname
Device Location: optional* fill-in accordingly, a vague location will do
Contact: Email optional* useful for sending alerts from NMS, can also be changed in LibreNMS later

SSH into Syno NAS

Skip to next section if you already know this 😉

For Windows Users ; please Google on how to SSH into your NAS (putty )

OSX Users

Open “Terminal” from your Mac and type in the following commands:

ssh [email protected]

If this is your first time, you should see a warning and be asking whether you would like to add the fingerprint, choose Yes by entering ‘yes’

Enter your password and you should be greeted with the following output

Proceed to gain root access by typing

sudo -i

Enter password again and you will have root access. Now… let the fun begin!

Save your commands!!

At this point of time, it is highly recommended to create a .txt file and save any/all docker run commands for the following reasons:

  1. Test run of docker run commands
  2. Readability and substitute your values
  3. Docker container/image update **IMPORTANT**
    1. Docker by itself doesn’t update the image as its built that way. You can google and find many answers on this.
    2. Go to “Updating Containers” below for steps

Install MariaDB via Docker Container

LibreNMS requires a SQL database to work; we will choose MariaDB in this case. Choose other SQL databases if you prefer.

Prepare MariaDB Docker folders

By default, Synology docker should create a new shared folder for your docker container data. The default should be at /volume1/docker

Navigate to your docker folder

cd /volume1/docker

Next, create MariaDB folder

mkdir mariadb

Install MariaDB container

docker run --name mariadb \
 -v /volume1/docker/mariadb:/var/lib/mysql \
 -e MYSQL_ROOT_PASSWORD=generate-a-one-time-password \
 -e TZ=Asia/Singapore -d mariadb:latest --sql-mode=''

“-v /volume1/docker/mariadb:/var/lib/mysql”
Save persistent MariaDB database data onto our newly created mariadb folder under /volume1/docker

“-e MYSQL_ROOT_PASSWORD=generate-a-one-time-password”
Replace sql root password with a generated password as we won’t be using this often
or
If you have another sql database container you wish to use, replace with your sql credentials

“-e TZ=Asia/Singapore -d mariadb:latest –sql-mode=””
Replace timezone settings with your preferred timezone (TZ Timezone List )

–sql-mode=”
LibreNMS does not currently support MySQL in strict mode

** commands, outputs on my Terminal screenshots might be different from what I have posted as I already have a running LibreNMS container on my Syno NAS ** 

Run the command, and it will show that it is downloading the container image
(I already have the image on my Syno, so my screenshots might not show the download process)

I know it doesn’t mean much, MariaDB is installed. Next!

Install LibreNMS via Docker Container

Where persistent data is required, if you don’t link the Container data to a folder via the -v command, any data in the Container will be erased after a shutdown/reboot. Your level of Docker usage and understanding just levelled up 🙂

Prepare LibreNMS Docker folders

Same deal, just different names 🙂

cd /volume1/docker
mkdir librenms
cd librenms
mkdir logs
mkdir rrd
touch config.custom.php

We created librenms folder, in it folder logs, rrd and config.custom.php file to be used by LibreNMS for any custom configuration

Install LibreNMS Container using jarischaefer/docker-librenms 

docker run \
 -d \
 -p 8668:80 \
 -e DB_HOST=db \
 -e DB_NAME=librenms \
 -e DB_USER=root \
 -e DB_PASS=your-mariadb-sql-password \
 -e BASE_URL=http://your-nas-ip:8668 \
 -e POLLERS=16 \
 -e TZ=Asia/Your_TZ \
 --link mariadb:db \
 -v /volume1/docker/librenms/logs:/opt/librenms/logs \
 -v /volume1/docker/librenms/rrd:/opt/librenms/rrd \
 -v /volume1/docker/librenms/config.custom.php:/opt/librenms/conf.d/config.custom.php \
 --name librenms \
 jarischaefer/docker-librenms:latest

Please change the values accordingly to your mariadb and timezone settings

“–link mariadb:db”

We are assigning a hostname of “db” to the container named “mariadb”.

Examples

“–link your-existing-container-name:hostname”

If you did not change “–name mariadb” of our MariaDB container, the “–link mariadb:db” should remain the same. If you used a different –name for the MariaDB, please change “–link your-sql-container:db”

Check your commands and proceed to install LibreNMS

Weet~ LibreNMS is up. A few more steps to go

Configure LibreNMS

Let’s run first-time installation command to configure LibreNMS and MariaDB

Run the following command:

docker exec librenms sh -c "cd /opt/librenms && php /opt/librenms/build-base.php"

This will tell LibreNMS to start creating entries into our MariaDB database.

Wait for the process to complete, which takes around 1~5mins (SSD~HDD)

Run the following command to add a user to LibreNMS

docker exec librenms php /opt/librenms/adduser.php admin password 10 [email protected]

Replace the default “password” and “[email protected]” with your preferred values

Ensure that you received “User added successfully” , if you do not see that output, try running the add user command again as it happened to me previously.

We are almost done!

Login to your LibreNMS by going to the following address in your browser:

http://your-nas-ip:8668

Log in with your created admin and password credentials

Congratulations! You have now successfully installed LibreNMS onto your Synology NAS.

Add your Synology & Other Devices

Synology Device

Proceed to add your Synology NAS to LibreNMS for monitoring

On the menu of LibreNMS, Devices >> Add Device

If you did not change your Docker network settings, your NAS IP when accessing from Docker will be as follows:

Hostname: 172.17.0.1
SNMP Version: v2c
Community: your-snmp-passphrase-created-above

LibreNMS will tell you that it has been added

Congratulations! You have now a working NMS collecting and monitoring your SNMP devices

Other Devices

Proceed to add other SNMP enabled devices with their IP address as the hostname

Wait for around 5~10mins for it to collect data and it will output your graphs

Optionals

config.custom.php

Back to the Terminal, we can set up custom settings to LibreNMS to exclude some unwanted features like Billing and Services etc

cd /volume1/docker/librenms
vi config.custom.php

How to use command “vi

Paste in the following example, change accordingly to LibreNMS’s documentation 

<?php 

$config['show_locations'] = 1; # Enable Locations on menu
$config['show_locations_dropdown'] = 1; # Enable Locations dropdown on menu
$config['show_services'] = 0; # Enable Services on menu
$config['int_customers'] = 0; # Enable Customer Port Parsing
$config['summary_errors'] = 1; # Show Errored ports in summary boxes on the dashboard
$config['int_transit'] = 0; # Enable Transit Types
$config['int_peering'] = 0; # Enable Peering Types
$config['int_core'] = 0; # Enable Core Port Types
$config['int_l2tp'] = 0; # Enable L2TP Port Types
$config['force_ip_to_sysname'] = true;
$config['enable_bgp'] = 0; # Enable BGP session collection and display
$config['enable_syslog'] = 0; # Enable Syslog
$config['enable_inventory'] = 0; # Enable Inventory
$config['enable_pseudowires'] = 0; # Enable Pseudowires
$config['enable_vrfs'] = 0; # Enable VRFs
$config['enable_sla'] = 0; # Enable Cisco SLA collection and display
$config['bad_if_regexp'][] = '/^lo.*/'; // ignore loopback interface
$config['bad_if_regexp'][] = '/^docker[\w]+$/'; // ignore docker interfaces
$config['ignore_mount_regexp'][] = "/^\/volume1\/@docker\/.*/"; // Syno-NAS ignore docker mounts
$config['ignore_mount'][] = "/dev/shm"; // Syno-NAS
$config['ignore_mount_regexp'][] = "/\/run.*/"; // Syno-NAS
$config['ignore_mount'][] = "/sys/fs/cgroup"; // Syno-NAS
$config['ignore_mount'][] = "/tmp"; // Syno-NAS

After you have edited the config.custom.php to your liking, remember to perform a restart on your docker container to reflect the new settings

docker restart librenms

Alerts

As alerting will be out of the scope of this tutorial, I’m sure you can explore around and tinker with the settings. Email alerts will be sent out via SMTP with regards to using jarischaefer/docker-librenms  container

Just to list a few alert transports (or methods if you wish in the tech world) in LibreNMS if you wish to use other transports other than email:

  • Pushover
  • Discord (free)
librenms discord alert

librenms discord alert

Alerts can be useful as it will notify you when something goes down and sends you a recovery message with elapsed downtime

But, please do keep this in mind, if you are planning to monitor devices that often have downtime, it will make sense to have the LibreNMS installed on a location that is 24hours online with a stable Internet connection

Cause: if your LibreNMS server or Network goes down, how will it be able to send an alert to you?

My scenario with LibreNMS is that I have two LibreNMS instances installed at two different physical locations

One of the locations suffers from electrical power blackouts and unstable Internet connection, while the other location is located in a city with 24hrs electricity and no Internet downtime

The stable LibreNMS is used to monitor the Router of the unstable location and sends alerts when necessary

While not everyone has access to two or more physical locations, your only choice would be to set up a hosted server Eg: DigitalOcean 

Use SVG graphs

LibreNMS can output SVG graphs which has better clarity than png

Settings (Gear icon beside Search bar) >> Global Settings >> Webui Settings >> Graph settings >> graph type

myLibreNMS app via LibreNMS API

View your LibreNMS from your mobile device, great for road warriors and VPN users

iOS: myLibreNMS 

Android: myLibreNMS 

First, create an API token in LibreNMS

Settings (Gear Icon) >> API >> API Settings >> Create API access token

After your access token has been created, you can click on the QR code blue icon to create a QR image which will be read by your iOS LibreNMS app

Download the iOS LibreNMS app

Ensure when entering URL of your LibreNMS server in the iOS app, it contains the full URL eg “http://ip-or-hostname:port”

Tap on the square box (marked by a yellow arrow on the screenshot), to scan your generated QR code in LibreNMS

Troubleshooting

I have run the above commands multiple times previously when I was still testing LibreNMS and configuration, so this should work as intended on a Synology NAS

If you come across any errors, it does not hurt to remove the Docker container, check the docker run command and run it again as it can be confusing with many docker variables

Some quick helpful docker commands

List all containers / Or view them in your DSM Docker app

  • docker ps

Check your current Docker gateway (your NAS IP when access from inside Docker)

  • docker inspect bridge

Start container from terminal

  • docker start container-name

Stop container from terminal

  • docker stop container-name

Remove container from terminal

  • docker rm container-name

Start a docker bash from terminal

  • docker exec -it container-name bash

If you decide to remove any of the MariaDB or LibreNMS containers, remember to also remove the existing data from the persistent data folder eg: /volume1/docker/mariadb , /volume1/docker/librenms

  • rm -r foldername/

Be careful when running rm -r with root privileges, ensure you are deleting correct folders.
Eg: rm -r /volume1/ will delete your whole volume1 folder!!! Always make sure you are in the correct folder while running commands. If in doubt, go back to DSM >> File Station and delete folders/files the GUI way 

  • # List files in directory
    ls
  • rm -r mariadb/
  • rm -r librenms/

Networking issues & a quick 101

Ensure your systems can communicate with each other before you proceed (eg: ping)

From your Syno terminal, ensure your Syno NAS can communicate with other devices. If your NAS is able to communicate with the devices, there are usually no problems with your docker commands as the docker network interface is bridged to your NAS. This usually boils down to device firewall that is blocking UDP port 161

Check your Synology & device firewalls, static routes, router settings etc to allow UDP port 161 SNMP protocol, especially true for remote polling of devices

Router level Site-to-Site VPN users, most of the case the routes are automatically added for you by your Router. If you are using a 3rd party VPN connection on your Syno, please add the relevant static routing for more advanced networks (eg: multiple local subnets)

If you suspect your container is having problems, you can troubleshoot further by running a docker bash terminal (docker exec -it librenms bash), and try to ping your devices and/or perform a snmpwalk

Troubleshooting steps

Aug 24, 2018 Update

  1. Open a LibreNMS container bash
    1. via Synology GUI
    2. via Portainer GUI >> Console
    3. Manually
    4. docker exec -it librenms bash
  2. Ping the device you wish to poll from the container bash
    Eg: 192.168.1.20

    1. ping 192.168.1.20
    2. librenms bash troubleshoot ping

      librenms bash troubleshoot ping

    3. If ping is successful, means your Synology is able to see the device. A big part of your network issue have been fixed. If you are unable to ping your device, you will need to check your Synology, router & device firewalls. Some device firewall by default will block ICMP ping too
  3. Anyhow, proceed to the next step to test your SNMP udp port 161
    1. Ensure device SNMP is enabled, check community passphrase, check which snmp protocol, v1, v2c, v3 is in use, and perform a snmpwalk on it
      Eg: 192.168.1.20 using v2c
    2. snmpwalk -v 2c -c your-community-passphrase 192.168.1.20
    3. librenms bash troubleshoot snmpwalk

      librenms bash troubleshoot snmpwalk

    4. If it is successful, you will see a bunch of numbers
    5. If it is unsuccessful, you will see a timeout
      1. Check device snmpd configuration eg: /etc/snmp/snmpd.conf or Windows’s snmpd service and ensure it is allowing connections from certain IPs or set to allow all
      2. Check device firewall configuration is accepting/allowing port udp 161
      3. Enable and Restart snmpd service
      4. Restart device

Quick 101 for network beginners

Context: Default Synology docker networking settings

LibreNMS Docker Behind Synology Network Topology

LibreNMS Docker Behind Synology Network Topology

local-syno-subnet eg: 192.168.1.0/24

syno communicate with other devices

syno: 192.168.1.10
devices: 192.168.1.20~

docker subnet 172.17.0.0/24

Communicating between docker containers can be done via their IPs or “–link” (which is depreciated in docker but is easier to setup and understand in this tutorial)

syno-docker: 172.17.0.1 (bridge gateway)
external-ip(your syno ip): 192.168.1.10
container1: 172.17.0.2 exposed-port: 1234 internal-port: 88 (eg: -p 1234:88)
container2: 172.17.0.3 exposed-port: 4567 internal-port: 99 (eg: -p 4567:99)

Devices subnet to communicate with docker containers

device: 192.168.1.20
device to container1 in syno: 192.168.1.10:1234 >> 172.17.0.2:88
device to container2 in syno: 192.168.1.10:4567 >> 172.17.0.3:99

note that you are still using syno’s ip address instead of the 172.17.0.0 subnet

In layman’s terms, the docker network is running inside your Syno NAS, which only your NAS can “see”. External devices do not know that the docker network 172.17.0.1 exists. When external devices contact the relevant ports on your Syno NAS (1234, 4567), it will forward to the respective docker container IP and ports (88, 99)

Updating Containers

To update containers, there are three methods:

Synology

  1. Go to your Docker GUI in DSM
  2. Under the “Registry” tab, search for your image (in this case, jarischaefer)
  3. Click on “Download” and choose your tag (eg: latest)
  4. Wait for the download to complete, a notification will appear in your DSM
  5. Under “Container” tab, stop your current running LibreNMS container. (Right-click or click on the switch)
  6. Right-click on Container >> Action >> Clear
  7. Start LibreNMS container again
  8. The container will be updated with the newly downloaded image with previous “docker run” settings

Portainer

Portainer.io is a great lightweight docker management UI. There’s nothing against Synology’s own GUI docker management environment (sluggish at times…), but I prefer Portainer’s environment as it has more details.

Portainer also has the ability to open a bash console in your containers, all from the web UI!

When you explore through the different sections, you will find that you have many unused images created when you were testing with containers. You can use Portainer to remove the unused images and free some disk space. Moreover, when you see such details, you start to understand more about how Docker works

  1. Install portainer in docker
    • Create the necessary portainer folder in your docker directory eg: /volume1/docker/portainer
    • docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /volume1/docker/portainer:/data --name portainer portainer/portainer
  2. Login and setup admin user during first install, choose local environment eg: /var/run/docker.sock
  3. Go to the “Containers” section, choose the container you wish to update eg: librenms , and click on “Recreate”
    portainer-recreate

    portainer-recreate

  4. A popup will appear with an option to pull the latest image during recreation
    portainer-recreate-pull-latest

    Ensure “Pull latest image” is turned on

Note: If your container/image is not being updated, please make sure your container’s image is using the “latest” tag. Eg: jarischaefer/docker-librenms:latest

Reduce/Minimum downtime during upgrade

Aug 24, 2018 Update

I realize that if you were to “Recreate” via Portainer’s GUI, you will experience longer downtime as Portainer will stop the container, and then pull the image. This is not ideal if the image is large or your WAN is not fast enough

To minimise downtime, you can pull the image in advance, and then proceed to “Recreate” via the GUI with the “Pull latest image” switch turned on. This step will be similar to the Manual steps below where the image is pulled in advance rather than stopping the container first. This way, your only downtime is the restart of the container

  1. Navigate to “Images” section, choose your LibreNMS container ID
    portainer - librenms image list

    portainer – librenms image list

  2. Ensure the tag you wish to update to and proceed to pull the image
    portainer pull image first

    portainer pull image first

  3. Wait for the pull to complete, and proceed to “Recreate” the image as described previously 😉

Manual

Jun 23, 2018 Update – Highly recommend using Portainer management UI as above. Copying/Pasting commands can be a hassle if you run more than 5 containers.

Remember those docker run commands I told you to save earlier?

Applicable to Synology users and other systems (eg: Linux)

  1. SSH into your device
  2. Update the image
    • docker pull jarischaefer/docker-librenms:latest
  3. Stop and remove the current running container
    • docker stop librenms
      docker rm librenms
  4. Paste your previous docker run commands
    • docker run ... ...

Afterword

Thank you for reading!

Hope this tutorial was helpful to anyone looking to deploying an NMS to monitor devices, be it for personal home or business use

As of current, I have a production LibreNMS installed precisely as written in this tutorial, ready to alert our telco’s NOC department when a monitored business line is suffering from downtime

Share or leave a comment if this article helped you or you run into problems

What follows are my thoughts and experiences

Planning & Setting ahead

If you are new to all of this and just starting out (which we all do at some point 😉 ), it is very important that you take some time to plan ahead and also know what to expect

Networking

Get your server/NAS properly communicating with other devices first!

Local Networks

Home / Homelab environments are usually local networks. If you have VLANs on them, ensure you’ve properly configured Inter-VLAN routing between them. Complicated word, just means configure your firewall to allow packets from one VLAN to another VLAN. Period. (The usual firewall ruling apply)

Remote & VPNs & Routers

Usually recommended to setup VPN in the router level, so that your devices behind the router can communicate with a remote server via VPN without setting up a VPN client

Home / Testing Use

If you want to see what LibreNMS or SNMP, in general, has to offer, following this tutorial as written with minimum hardware will most definitely work

  • Hardware
    • A server (or NAS with docker capabilities)
  • Device to monitor
    • The server itself that runs LibreNMS (or docker container)
    • Other SNMP capable/enabled Device(s)

Production Use

“Production”? Just means for serious, non-testing, stable working environments. However you want to use this for home or business, it doesn’t matter. You will need to properly set up your systems and already have a basic/firm knowledge of networking. As written in the post, most problems happen with networking itself, not the installation of LibreNMS via Docker, with containers being easy to deploy

Some tips & hints

  • Resist the need to upgrade every time! Read the changelog for major changes/updates that are relevant to your system/setup before upgrading
  • Use a fixed version image on your containers to prevent any problems due to update. If a hardware failure happens, your saved Docker run commands will most definitely work again.
    But if you were to use the latest tag, your previous Docker run commands, configurations/settings might not be compatible with the latest image, as compared to your initial configuration (say, 6months to a year ago)

    • Eg: Use a stable fixed tag MySQL/MariaDB image rather than the latest tag

Set, Analyze & Forget

During my initial successful setup, it became a daily routine to check LibreNMS by opening the mobile myLibreNMS app. It can be fun, cool, nerdy at first, but in the end, it is just a monitoring tool. Setup your notifications/alerts properly, and you won’t need to visit the LibreNMS GUI as much (or maybe deep down I want something to happen…?)

Other than waiting on the graphs to fill and producing some eye candy, monitoring my devices did help me in the following:

  • Alert when a device goes down
    • When one of the APs at home goes down due to someone switching it off and forgetting to turn it back on, resulting in poor home Wi-Fi reception
      • Alert/notification kicks in, and provided instructions to family members to switch on the AP… all while I’m overseas
  • Alert when a business line goes down
    • Mentioned above. Whenever a business line is down for 30minutes, an email gets sent automatically to the NOC department, with an internal company email sent to notify staffs about the imminent downtime. Recovery email gets sent to notify NOC and staffs that the line is back up
  • Alert when your storage is almost full
    • For those sensitive Linux systems before havoc sets in
  • Re-evaluate whether your device is having a rough time
    • Temperatures
    • CPU, RAM, Storage
    • UPS load
Scroll Up