Monitor Your Synology With Grafana and Prometheus Dashboard

Monitor Your Synology With Grafana and Prometheus Dashboard

Do you want to monitor your Synology NAS in an easy and professional way? This guide walks you through the steps to create a dashboard in Grafana to display system metrics for your Synology NAS server, monitored by Prometheus. The people that have contributed to this guide are Lyxon from the Synology Discord Group and me, Marius from mariushosting.com

If you want to add more NAS devices metrics to your Grafana dashboard installed on your main NAS, you need to follow my second guide: Grafana and Prometheus Dashboard Part 2.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Text Editor via Synology “Package Center”. (Mandatory STEP.) If you already have Text Editor installed on your Synology NAS, skip this STEP.

Synology Install Text Editor 2023

  • STEP 3

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 4

Firewall Setup: If your Synology NAS Firewall is deactivated, Skip the guide from STEP 4 to STEP 12. If your Synology NAS Firewall is activated, go to Control Panel / Security / Firewall tab then click Edit Rules on your current Firewall profile. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 1

  • STEP 5

A new window will open click Create. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 2

  • STEP 6

After you click Create at STEP 5 a new window will open. Choose “Select from a list of built-in applications” then click Select. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 3

  • STEP 7

From the Built-in Applications check SNMP service then click OK. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 4

  • STEP 8

After you click OK at STEP 7, choose “Specific IP” then click Select. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 5

  • STEP 9

Choose IP range. Add From: 192.168.49.0 To: 192.168.52.0 then click OK. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 6

  • STEP 10

Click OK. Follow the instructions in the image below

Synology Grafana Prometheus Dashboard 7

  • STEP 11

Your new Docker Firewall rule will be ABOVE the Deny rule. Move it from the last position to the third position or any position above the Deny rule. Click OK to save the Firewall Settings. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 8

  • STEP 12

Click OK. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 9

  • STEP 13

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

Synology Grafana Prometheus Dashboard 10

  • STEP 14

Now create three new folders inside the grafana folder that you created at STEP 13 and name them data, prometheus, snmp. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Synology Grafana Prometheus Dashboard 11

  • STEP 15

Download (click on the blue link below) then upload the prometheus.yml file below in the grafana folder that you have previously created at STEP 13. Follow the instructions in the image below.

Download prometheus.yml

Synology Grafana Prometheus Dashboard 12

  • STEP 16

Make sure you have installed Synology Text Editor as per the instructions at STEP 2. Double click on the prometheus.yml file then type in your own local NAS IP instead of 192.168.1.18 which is my own local NAS IP. Click X to save the file. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 13

  • STEP 17

Click Save to save the file. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 14

  • STEP 18

Download (click on the blue link below) then upload the snmp.yml file below in the snmp folder that you have previously created at STEP 14. Follow the instructions in the image below.

Download snmp.yml

Synology Grafana Prometheus Dashboard 15

  • STEP 19

Make sure you have installed Synology Text Editor as per the instructions at STEP 2. Double click on the snmp.yml file that you have previously uploaded at STEP 18.
Go to Control Panel / Terminal & SNMP / SNMP tab / Check Enable SNMP service. Check SNMPv3 service. Check Enable SNMP privacy. Copy paste the username and passwords from the snmp.yml file in the SNMP fields, then click Apply. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 16

  • STEP 20

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 21

In the Name field type in synology-dashboard. Follow the instructions in the image below.

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

version: "3.9"
services:
  grafana:
    image: grafana/grafana:latest
    container_name: Grafana
    hostname: grafana
    networks:
      - grafana-net
    mem_limit: 512m
    cpu_shares: 512
    security_opt:
      - no-new-privileges:true
    user: 1026:100
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1
    ports:
      - 3340:3000
    volumes:
      - /volume1/docker/grafana/data:/var/lib/grafana:rw
    environment:
      TZ: Europe/Bucharest
      GF_INSTALL_PLUGINS: grafana-clock-panel,grafana-simple-json-datasource,natel-discrete-panel,grafana-piechart-panel
    restart: on-failure:5

  prometheus:
    image: prom/prometheus:v2.41.0
    command:
      - '--storage.tsdb.retention.time=60d'
      - '--config.file=/etc/prometheus/prometheus.yml'
    container_name: Prometheus
    hostname: prometheus-server
    networks:
      - grafana-net
      - prometheus-net
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges=true
    user: 1026:100
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:9090/ || exit 1
    volumes:
      - /volume1/docker/grafana/prometheus:/prometheus:rw
      - /volume1/docker/grafana/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    restart: on-failure:5

  node-exporter:
    image: prom/node-exporter:latest
    command:
      - --collector.disable-defaults
      - --collector.stat
      - --collector.time
      - --collector.cpu
      - --collector.loadavg
      - --collector.hwmon
      - --collector.meminfo
      - --collector.diskstats
    container_name: Prometheus-Node
    hostname: prometheus-node
    networks:
      - prometheus-net
    mem_limit: 256m
    mem_reservation: 64m
    cpu_shares: 512
    security_opt:
      - no-new-privileges=true
    read_only: true
    user: 1026:100
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:9100/
    restart: on-failure:5

  snmp-exporter:
    image: prom/snmp-exporter:latest
    command:
      - '--config.file=/etc/snmp_exporter/snmp.yml'
    container_name: Prometheus-SNMP
    hostname: prometheus-snmp
    networks:
      - prometheus-net
    mem_limit: 256m
    mem_reservation: 64m
    cpu_shares: 512
    security_opt:
      - no-new-privileges:true
    read_only: true
    user: 1026:100
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:9116/ || exit 1
    volumes:
      - /volume1/docker/grafana/snmp:/etc/snmp_exporter/:ro
    restart: on-failure:5

  cadvisor:
    image: gcr.io/cadvisor/cadvisor:latest
    command:
      - '--docker_only=true'
    container_name: Prometheus-cAdvisor
    hostname: prometheus-cadvisor
    networks:
      - prometheus-net
    mem_limit: 256m
    mem_reservation: 64m
    cpu_shares: 512
    security_opt:
      - no-new-privileges=true
    read_only: true
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:ro
      - /sys:/sys:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: on-failure:5

networks:
  grafana-net:
    name: grafana-net
    ipam:
      config:
        - subnet: 192.168.50.0/24
  prometheus-net:
    name: prometheus-net
    ipam:
      config:
        - subnet: 192.168.51.0/24

Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.) 1026 is my personal UID value and 100 is my personal GID value. You have to type in your own values.
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.)

Synology Grafana Prometheus Dashboard 17

  • STEP 22

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.

Synology Grafana Prometheus Dashboard 18

  • STEP 23

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

Synology Grafana Prometheus Dashboard 19

  • STEP 24

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

  • STEP 25

The installation process can take up to a few seconds/minutes. It will depend on your Internet speed connection. Now open your browser and type in http://Synology-ip-address:3340 Type in the default username and password, then click Log in.

Warning: the default username is admin and the default password is admin

Synology Grafana Prometheus Dashboard 20

  • STEP 26

After you click Log in on STEP 25, you will be prompted to change the password. Choose your favorite password, then click Submit. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 21

  • STEP 27

On the left sidebar click on the Settings icon then Configuration. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 22

  • STEP 28

Click Add data source. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 23

  • STEP 29

Click on Prometheus. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 24

  • STEP 30

On the URL area type in http://prometheus-server:9090 instead of http://localhost:9090 then scroll down the page a little bit. Also, you can change the name Prometheus and use your NAS name instead. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 25

  • STEP 31

Click Save & test. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 26

  • STEP 32

Click on the Dashboards icon then click + Import. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 27

  • STEP 33

Download (click on the blue link below) the Synology_Dashboard.json file.

Synology_Dashboard.json

  • STEP 34

Click Upload JSON file and upload your Synology_Dashboard.json file that you have previously downloaded at STEP 33. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 28

  • STEP 35

Click Import. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 29

  • STEP 36

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

  • STEP 37

After you click Import, your Synology Dashboard will be ready! Note: Where you see No data, it means you don’t have Watchtower installed on your NAS. This space is reserved for monitoring containers updates in real time.

Synology Grafana Prometheus Dashboard 30 new

  • STEP 38

On the left sidebar, click on the Settings icon. Go to the Preferences tab then select your Synology Dashboard as the Home Dashboard. Click Save. Follow the instructions in the image below.

Synology Grafana Prometheus Dashboard 31 new

Your Synology Dashboard at a glance!

Synology Grafana Prometheus Dashboard 32 new

  • STEP 39

How to add more NAS devices metrics to your Grafana dashboard installed on your main NAS.

Enjoy your awesome Synology Dashboard powered by Grafana and Prometheus!

Note: If you want to run the Grafana container over HTTPS, check out my guide on How to Run Docker Containers Over HTTPS.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: Find out how to update the Grafana and Prometheus containers 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 Sunday / February 5th, 2023 at 2:19 AM