Synology SNMP Monitoring with LibreNMS

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


Apr 20, 2021

  • Added single quotes ‘ ‘ on example code to help escape generated passwords that might contain “!” or other special characters which will break a docker run command
  • Tutorial revisited again due to Theme change
  • Archived myLibreNMS app from page 2 into page 3
  • Added a more inform-ed SMB/Enterprise deployment on page 3

Jul 23, 2020

Tutorial fully working again 🙂

Credits to Jari Schäfer jarischaefer for pointing me in the right direction. Details @

  • Changelog
    • Choosing a different hostname alias other than “db” when linking MariaDB container to LibreNMS container
    • SQL database options as per official LibrerNMS documentation
  • Synology DSM 6.2.3-25426
    • Version 1.65.1 – Sat Jul 11 2020 03:56:16 GMT+0800
      Database Schema 2020_06_23_00522_alter_availability_perc_column (170)
      Web Server nginx/1.15.8
      PHP 7.4.7
      Python 3.6.9
      MySQL 10.4.12-MariaDB-1:10.4.12+maria~bionic
      Laravel 6.18.20
      RRDtool 1.7.0
  • Ubuntu 18.04.4 LTS (VM)
    • Version 1.65.1 – Sat Jul 11 2020 03:56:16 GMT+0800
      Database Schema 2020_06_23_00522_alter_availability_perc_column (170)
      Web Server nginx/1.15.8
      PHP 7.4.7
      Python 3.6.9
      MySQL 10.5.4-MariaDB-1:10.5.4+maria~focal
      Laravel 6.18.20
      RRDtool 1.7.0

Step by Step

It can be time-consuming 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

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. 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


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.2.2-24922 Update 2 (as of first writing)
    • 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

  • This Page – Main Setup
    1. Install Docker, Enable SSH & SNMP
    2. SSH into Syno NAS
    3. MariaDB Setup
    4. LibreNMS Setup
    5. Configure LibreNMS
    6. Add your Synology & Other Devices
  • Page 2 – Optional(s) and Troubleshooting
    1. Optional(s)
      1. custom.config.php
      2. Alerts
      3. Use SVG graphs
      4. myLibreNMS app via LibreNMS API
    2. Troubleshooting
    3. Synology & Docker Network 101
    4. Updating Containers
  • Page 3
    1. Afterword
    2. Archive

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 tab
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, which 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 save any/all docker run commands for the following reasons:

  1. Test run of docker run commands
  2. Readability, ease of editing and substitute your values
  3. Docker container/image update **IMPORTANT**
    1. Docker by itself doesn’t update the image as it’s built that way. You can google and find many answers on this.
    2. Go to Page 2 for Upgrading steps

Testing Purposes


Beginners following this tutorial should just copy/paste the commands that I’ve posted on this page as is to minimise any errors/conflict due to existing configurations, typos or if you are not very fluent in Linux

Get it to work in a testing environment first, then recreate the changes accordingly like passwords, mounts and your own customizations to secure your install further before using it for production (long-term, real-use)

Veterans / Homelabbers

I am currently using a distributed poller whereby my DigitalOcean droplet hosts the main LibreNMS poller and connected via OpenVPN to the local subnet pollers that I am currently monitoring

If you want to take it further by using a reverse proxy like nginx or traefik, this tutorial does not cover that. I don’t intend to put LibreNMS behind a reverse proxy, as it complicates security with public-facing subdomain and configuration. Although recently I started experimenting with nginx… … for now I’m KISSing it 🙂

MariaDB Setup

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 \
-v /volume1/docker/mariadb:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD='root_password' \
-e TZ=Asia/Singapore \
--name mariadb \
-d \
--restart always \
mariadb:latest \
--innodb_file_per_table=1 \

** Outputs on my screenshots will be different from what was posted as I already have a running LibreNMS container on my Syno NAS
Note: I am using mariadb-test and librenms-test, with port 8669 instead of 8668 for this tutorial **

Installing MariaDB on Synology

Installing MariaDB on Synology


-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='root_password'

Replace SQL root_password with a generated password as we won’t be using this often

-e TZ=Asia/Singapore

Replace timezone settings with your preferred timezone (TZ Timezone List )

--name mariadb

We name the container as “mariadb”. Without this, Docker will randomly pick a name for your container


Run the container in daemon/background

--restart always

Always restart the container. This docker container will restart itself if you were to reboot your Synology NAS. More options @ Docker’s documentation

mariadb:latest \

Use the latest mariadb image

--innodb_file_per_table=1 \

Run MariaDB with options as per official LibreNMS documentation


Indicate a newline, which makes it easier to read, you can also docker run commands without the newline, the above command will look like this one-liner without “\”:

docker run -v /volume1/docker/mariadb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD='root_password' -e TZ=Asia/Singapore --name mariadb -d mariadb:latest --innodb_file_per_table=1 --lower_case_table_names=0

Setup MariaDB LibreNMS Database and User

Now that MariaDB has been installed, time to configure the database for use with LibreNMS

Run the following command to log in to the SQL Console

docker exec -it mariadb mysql -u root

If you see a fancy 2002 Error, wait for a few seconds/moments and try the above command again. Or it asks you for a password, run the command below with “-p” option

For Debian/VM users, run with -p

docker exec -it mariadb mysql -u root -p

Next, we will create a LibreNMS user to read/write to the SQL database, enter the following commands to create “librenms” database and also the user

Change ‘libre_password’ to your preferred password

CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'%' IDENTIFIED BY 'libre_password';
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'libre_password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'%';

Now that MariaDB has been configured, issue a restart to the MariaDB container

docker restart mariadb
Create and Prepare MariaDB for LibreNMS

Create and Prepare MariaDB for LibreNMS

LibreNMS Setup

Prepare LibreNMS Docker folders

Same deal, just different names 🙂

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

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

Generate an App Key

First, as per jarischaefer’s instructions, we will generate an APP_KEY value to be used for our docker run command

Run the following to generate a base64 key

docker run --rm jarischaefer/docker-librenms generate_key

Copy the base64 key somewhere and continue to customizing our LibreNMS container and its variables

Install LibreNMS Container using jarischaefer/docker-librenms

If you’ve followed this tutorial before Jul, 23 2020, breaking change is to NOT use “db” as the hostname alias to link back to MariaDB container. Latest tutorial uses “libredb” as the hostname alias

docker run \
-p 8668:80 \
-e DB_HOST=libredb \
-e DB_NAME=librenms \
-e DB_USER=librenms \
-e DB_PASS='libre_password' \
-e BASE_URL=http://YOUR_NAS_IP:8668 \
-e TZ=Asia/Singapore \
--link mariadb:libredb \
-v /volume1/docker/librenms/logs:/opt/librenms/logs \
-v /volume1/docker/librenms/rrd:/opt/librenms/rrd \
-v /volume1/docker/librenms/custom.config.php:/opt/librenms/conf.d/custom.config.php:ro \
--name librenms \
-d \
--restart always \
Installing LibreNMS

Installing LibreNMS


-p 8668:80

Expose port 8668 which will be bound to the container’s port 80

You can ignore this for now if you don’t know what that means, head over to Page 2’s Synology & Docker Network 101 Section to understand more

-e DB_X=

DB_X values point to your MariaDB container created above, substitute them with the correct values


Paste in the generated key from the initial docker run command, includes ‘base64:’

-e BASE_URL=http://YOUR_NAS_IP:8668

Replace YOUR_NAS_IP with your Synology/Server IP address

--link mariadb:libredb

We are assigning a hostname alias of ‘libredb’ to the container named ‘mariadb’ which we have just created above. DB_HOST is set to ‘libredb’


--link your-existing-container-name:hostname-alias

Configure LibreNMS Database & User Creation

Preparing LibreNMS Database

Now that MariaDB and LibreNMS containers have been set up and ready, let’s instruct LibreNMS container to prepare (more like the ol’ Setup/Install?) the Database for use

Run the following command

docker exec librenms setup_database

Setup Database and Admin User

Setup Database and Admin User

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

Admin User Creation

Run the following command to add an admin to LibreNMS

docker exec librenms create_admin

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


Log in with:

Username: admin
Password: admin


Add your Synology & Other Devices

Synology Device

Proceed to add your Synology NAS to LibreNMS for monitoring

Before we add your Synology device, let’s find its IP when accessing from Docker

Run the following in Synology Terminal/Console (not the Container’s bash)

docker inspect bridge | grep 'Gateway'

Most installs return 172.17.x.x, there are cases which you might have a different subnet like 172.18.x.x

On the menu of LibreNMS, Devices >> Add Device

Substitute your above IP as the Hostname for the Device to add to LibreNMS for monitoring

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


You have a working NMS collecting and monitoring your SNMP enabled 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

Ongoing Updates depends on you

Let me know in the comments if this tutorial helped or, especially if it didn’t!

You can reach me either by commenting on this post or by joining my Discord server (link at bottom of page) where notifications are sent straight to my Mobile if you prefer a faster reply timeline

Continue to Page 2

  • Page 2 – Optional(s) and Troubleshooting
    1. Optional(s)
      1. custom.config.php
      2. Alerts
      3. Use SVG graphs
      4. myLibreNMS app via LibreNMS API
    2. Troubleshooting
    3. Synology & Docker Network 101
    4. Updating Containers