How to Install LibreNMS on Your Synology NAS

How to Install LibreNMS on Your Synology NAS

LibreNMS is an auto-discovering PHP/MySQL/SNMP based network monitoring which includes support for a wide range of network hardware and operating systems including Cisco, Linux, FreeBSD, Juniper, Brocade, Foundry, HP and many more. In this step by step guide I will show you how to install LibreNMS on your Synology NAS using Docker & Portainer.

💡Note: This guide works perfectly with the latest LibreNMS v24.10.1 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 1

  • STEP 5

Now click the “Create” button. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 2

  • STEP 6

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in LibreNMS. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: librenms.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 5080

LibreNMS Synology NAS Set up 3

  • STEP 7

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Synology Proxy WebSocket

  • STEP 8

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 4

  • STEP 9

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 5

  • STEP 10

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it librenms. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

LibreNMS Synology NAS Set up 6

  • STEP 11

Now create three new folders inside the librenms folder that you have previously created at STEP 10 and name them data, db, redis. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

LibreNMS Synology NAS Set up 7

  • STEP 12

Follow my step by step guide on how to activate SMTP for your Gmail account. This step is mandatory. Note: If you don’t want to use the easiest way for SMTP with Google and you already have SMTP details from your own Mail Server, you can just skip this STEP and use your personalized email SMTP details instead.

  • STEP 13

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 14

In the Name field type in librenms. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

services:
  db:
    image: mariadb:11.4-noble #LTS Long Time Support Until May 29, 2029.
    container_name: LibreNMS-DB
    command:
      - mariadbd
      - --innodb-file-per-table=1
      - --lower-case-table-names=0
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
    volumes:
      - /volume1/docker/librenms/db:/var/lib/mysql:rw
    environment:
      TZ: Europe/Bucharest
      MARIADB_RANDOM_ROOT_PASSWORD: yes
      MARIADB_DATABASE: librenms
      MARIADB_USER: librenmsuser
      MARIADB_PASSWORD: librenmspass
    restart: on-failure:5

  redis:
    image: redis:7.2-alpine
    container_name: LibreNMS_REDIS
    healthcheck:
     test: ["CMD-SHELL", "redis-cli ping || exit 1"]
    volumes:
      - /volume1/docker/librenms/redis:/data:rw
    environment:
      TZ: Europe/Bucharest
    restart: on-failure:5

  msmtpd:
    image: crazymax/msmtpd:latest
    container_name: LibreNMS_MSMTPD
    environment:
      SMTP_HOST: smtp.gmail.com
      SMTP_PORT: 587
      SMTP_TLS: on
      SMTP_STARTTLS: on
      SMTP_TLS_CHECKCERT: on
      SMTP_AUTH: on
      SMTP_USER: Your-own-gmail-address
      SMTP_PASSWORD: Your-own-app-password
      SMTP_FROM: Your-own-gmail-address
    restart: on-failure:5

  librenms:
    image: librenms/librenms:latest
    container_name: LibreNMS
    healthcheck:
      test: ["CMD-SHELL", "nc -z 127.0.0.1 8000 || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    hostname: librenms
    cap_add:
      - NET_ADMIN
      - NET_RAW
    ports:
      - target: 8000
        published: 5080
        protocol: tcp
    depends_on:
      - db
      - redis
      - msmtpd
    volumes:
      - /volume1/docker/librenms/data:/data:rw
    environment:
      TZ: Europe/Bucharest
      PUID: 1026
      PGID: 100
      SESSION_SECURE_COOKIE: true
      DB_HOST: db
      DB_NAME: librenms
      DB_USER: librenmsuser
      DB_PASSWORD: librenmspass
      DB_TIMEOUT: 120
      MEMORY_LIMIT: 512M
      MAX_INPUT_VARS: 1000
      UPLOAD_MAX_SIZE: 128M
      OPCACHE_MEM_SIZE: 128
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      LOG_IP_VAR: remote_addr
      CACHE_DRIVER: redis
      SESSION_DRIVER: redis
      REDIS_HOST: redis
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: false
      LIBRENMS_WEATHERMAP_SCHEDULE: "0 0 */2 * * *" # Schedule WeatherMAP every 2 hours
    restart: on-failure:5

  dispatcher:
    image: librenms/librenms:latest
    container_name: LibreNMS-DISPATCHER
    hostname: librenms-dispatcher
    cap_add:
      - NET_ADMIN
      - NET_RAW
    depends_on:
      - librenms
      - redis
    volumes:
      - /volume1/docker/librenms/data:/data:rw
    environment:
      TZ: Europe/Bucharest
      PUID: 1026
      PGID: 100
      DB_HOST: db
      DB_NAME: librenms
      DB_USER: librenmsuser
      DB_PASSWORD: librenmspass
      DB_TIMEOUT: 120
      DISPATCHER_NODE_ID: dispatcher1
      SIDECAR_DISPATCHER: 1
      MEMORY_LIMIT: 512M
      MAX_INPUT_VARS: 1000
      UPLOAD_MAX_SIZE: 128M
      OPCACHE_MEM_SIZE: 128
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      LOG_IP_VAR: remote_addr
      CACHE_DRIVER: redis
      SESSION_DRIVER: redis
      REDIS_HOST: redis
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: false
      LIBRENMS_WEATHERMAP_SCHEDULE: "0 0 */2 * * *" # Schedule WeatherMAP every 2 hours
    restart: on-failure:5
    
  syslogng:
    image: librenms/librenms:latest
    container_name: LibreNMS_SYSLOGNG
    hostname: librenms-syslogng
    healthcheck:
      test: ["CMD-SHELL", "nc -z 127.0.0.1 514 || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    cap_add:
      - NET_ADMIN
      - NET_RAW
    depends_on:
      - librenms
      - redis
    ports:
      - target: 514
        published: 514
        protocol: tcp
      - target: 514
        published: 514
        protocol: udp
    volumes:
      - /volume1/docker/librenms/data:/data:rw
    environment:
      TZ: Europe/Bucharest
      PUID: 1026
      PGID: 100
      DB_HOST: db
      DB_NAME: librenms
      DB_USER: librenmsuser
      DB_PASSWORD: librenmspass
      DB_TIMEOUT: 120
      SIDECAR_SYSLOGNG: 1
      MEMORY_LIMIT: 512M
      MAX_INPUT_VARS: 1000
      UPLOAD_MAX_SIZE: 128M
      OPCACHE_MEM_SIZE: 128
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      LOG_IP_VAR: remote_addr
      CACHE_DRIVER: redis
      SESSION_DRIVER: redis
      REDIS_HOST: redis
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: false
      LIBRENMS_WEATHERMAP_SCHEDULE: "0 0 */2 * * *" # Schedule WeatherMAP every 2 hours
    restart: on-failure:5

  snmptrapd:
    image: librenms/librenms:latest
    container_name: LibreNMS_SNMPTRAPD
    healthcheck:
      test: ["CMD-SHELL", "nc -z 127.0.0.1 162 || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    hostname: librenms-snmptrapd
    cap_add:
      - NET_ADMIN
      - NET_RAW
    depends_on:
      - librenms
      - redis
    ports:
      - target: 162
        published: 162
        protocol: tcp
      - target: 162
        published: 162
        protocol: udp
    volumes:
      - /volume1/docker/librenms/data:/data:rw
    environment:
      TZ: Europe/Bucharest
      PUID: 1026
      PGID: 100
      DB_HOST: db
      DB_NAME: librenms
      DB_USER: librenmsuser
      DB_PASSWORD: librenmspass
      DB_TIMEOUT: 120
      SIDECAR_SNMPTRAPD: 1
      MEMORY_LIMIT: 512M
      MAX_INPUT_VARS: 1000
      UPLOAD_MAX_SIZE: 128M
      OPCACHE_MEM_SIZE: 128
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      LOG_IP_VAR: remote_addr
      CACHE_DRIVER: redis
      SESSION_DRIVER: redis
      REDIS_HOST: redis
      LIBRENMS_SNMP_COMMUNITY: librenmsdocker
      LIBRENMS_WEATHERMAP: false
      LIBRENMS_WEATHERMAP_SCHEDULE: "0 0 */2 * * *" # Schedule WeatherMAP every 2 hours
    restart: on-failure:5

Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value for SMTP_USER and type in your own Gmail address. Refer to STEP 12.
Note: Before you paste the code above in the Web editor area below, change the value for SMTP_PASSWORD and type in your own Gmail app password. Refer to STEP 12.
Note: Before you paste the code above in the Web editor area below, change the value for SMTP_FROM and type in your own Gmail address. Refer to STEP 12.
Note: Before you paste the code above in the Web editor area below, change the value numbers for PUID and PGID with your own values. (Follow my step by step guide on how to do this.)

LibreNMS Synology NAS Set up 8

  • STEP 15

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

LibreNMS Synology NAS Set up 9

  • STEP 16

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

LibreNMS Synology NAS Set up 10

  • STEP 17

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 18

Please wait approximately 10 minutes or you will get a blank synology error page if you try to connect too soon. Now open your browser and type in your HTTPS/SSL certificate like this https://librenms.yourname.synology.me that you have previously created at STEP 6. In my case it’s https://librenms.mariushosting.synology.me If everything goes right, you will see the LibreNMS installation page. Type in your own Admin User details, then click Add User. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 11

  • STEP 19

Click the OK icon. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 12

  • STEP 20

Choose your favorite theme, then click Finish Install. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 13

  • STEP 21

Click Dashboard. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 14

  • STEP 22

You will be prompted to type in your own username and password that you have previously created at STEP 18. Click Login. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 15

  • STEP 23

At the top right of the page, click on the gear icon, then Global Settings. Click on the System tab. In the Specific URL area, type in your own synology.me DDNS with https:// at the beginning that you have previously created at STEP 6. Follow the instructions in the image below.

LibreNMS Synology NAS Set up 16

  • STEP 24

Your LibreNMS dashboard at a glance!

LibreNMS Synology NAS Set up 17

  • STEP 25

Monitor your Synology NAS via LibreNMS.

Go to Control Panel / Terminal & SNMP / Click on the SNMP tab.

Select Enable SNMP service.
Select SNMPv3 service.

Type in a Username in the SNMPv3 area. You will need this username later at STEP 28.
Protocol select SHA. You will need this parameter later at STEP 28.
Type in a Password. You will need this password later at STEP 28.
Click Apply. Follow the instructions in the image below.

LibreNMS Synology SNMP 1

  • STEP 26

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 27

Adjust your Synology Firewall in Control Panel / Security / Firewall. Allow the SNMP service on port 161.

  • STEP 28

Open LibreNMS. Click the Devices tab, then +Add Device. Type in the following parameters:

Hostname or IP: 172.17.0.1
SNMP: ON
SNMP Version: v3
Port: 161
Protocol: udp

Auth Level: authNoPrv
Auth User Name: Your own username that you have previously added at STEP 25.
Auth Password: Your own password that you have previously added at STEP 25.
Auth Algorithm: SHA. This is the Protocol that you have previously chosen at STEP 25.

Click Add Device.

LibreNMS Synology SNMP 2

  • STEP 29

The device will be added in a couple of seconds. If you experience any issue when adding your Synology NAS device, this means you forgot STEP 27.

LibreNMS Synology SNMP 3

  • STEP 30

Click Device, then All Devices then Storage. Follow the instructions in the image below.

LibreNMS Synology SNMP 4

  • STEP 31

Click on your NAS name. Follow the instructions in the image below.

LibreNMS Synology SNMP 5

  • STEP 32

Very important STEP. Your graphs and data need a minimum of 15-20 minutes before they are displayed without issues in LibreNMS. If you don’t wait and are in a hurry, you will get several errors in the graphs, like images not being displayed etc. You need to wait almost 15 minutes for the data from your NAS to synchronize in LibreNMS.

  • STEP 33

Your Magical Graphs at a glance! Click Graphs!

LibreNMS Synology SNMP 6

Enjoy LibreNMS!

🆘TROUBLESHOOTING

If you encounter issues by using this container, make sure to check out the Common Docker issues article.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the LibreNMS container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Tuesday / November 12th, 2024 at 1:02 AM