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


Aug 30, 2019

  • Tutorial updated to latest working steps and versions
    • DSM 6.2.2-24922 Update 2
    • LibreNMS – 1.54
    • MariaDB – 10.4.7-MariaDB-1:10.4.7+maria~bionic
  • Updated screenshots
  • Re-arranged/deleted some old bloggy content
  • Post split up to three pages as it gets rather long trying to scroll down to the comments section
    • Page 1
      • The main setup and installation
    • Page 2
      • Optional(s) and Troubleshooting
    • Page 3
      • Archives
  • Less layman, tiny bit more technical 🙂

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
    • 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 user-with-admin-rights@your-nas-ip

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 \

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


Use the latest mariadb image


Run MariaDB without any strict modes


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:

docker run -v /volume1/docker/mariadb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root_password -e TZ=Asia/Singapore --name mariadb -d mariadb:latest --sql-mode=''

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

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 

docker run \
-p 8668:80 \
-e DB_HOST=db \
-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:db \
-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:db

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


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

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

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
Setup Database and Admin User

Setup Database and Admin User

We are almost done!

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

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:

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

LibreNMS will tell you that it has been added

A quick command to check your current Docker network (bridge) is to run the following in Synology Terminal/Console (not in the Container’s bash)

docker inspect bridge | grep 'Gateway'


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

Notable Replies

  1. If you found this tutorial to be useful, your comments or :orange_heart: are most appreciated!
    Stuck and need help/pointers with this tutorial? Comment in the forum powered by Discourse

  2. Just came back ONCE AGAIN to use your Guide, as i’ve been getting a dozen of customer’s on my own consulting company, where i do network, but dont understand databases.
    now your Librenms/MariaDB guide just gave me a little something xtra to use when it comes to monitoring.
    im not relying on the tool as im a sole beginner on this platform, so im using it and the Dessert when it comes to monitoring customer’s device health :slight_smile:
    Thank you so much for using this guide.!

    once AGAIN im thanking you

  3. Hi Jason. Not yet… ive been so busy i havent had the time yet to take a look at it.
    since im not a great Docker/librenms expert i need several hours available before i can dive into it so i can learn :wink: But if you wanna take a quick look and make a little buck, let me know :wink:

    ive started hosting a lot of server this week for customer so i might as well get those added to Librenms too, but right now im doing it on an IP address level, which will get confusing once i get added a ton of devices :slight_smile: the host synology can ping dns names without a sweat but apparantly the bridge thing here is messing with me again :slight_smile:

    Hope youre enjoying the weekend man.

  4. Hi @alrodgir and welcome to the forums :slight_smile:

    What is your setup like?

    Check/Allow firewall going out for smtp port 587 on the host that you installed LibreNMS on

  5. Oh, sorry for being so concise :sweat_smile:
    My set up is so simply:
    Synology NAS with Librenms docker.
    The Synology firewall is off.
    Moikrotik router.
    All output traffic it’s allowed.

    Maybe I can try with the Google SMTP server :thinking:

    When I click the test I obtain this Captura3
    But, if I configure a printer to alert directly, with the same config, the printer alert correctly.

Add your comments/discussion at forums.jasonloong.com

32 more replies


Scroll Up