Monitoring Synology with Prometheus and Grafana

In this article, we will discuss “Monitoring Synology with Prometheus and Grafana”. We will be utilizing Portainer which is a lightweight/open-source management solution designed to simplify working with Docker containers instead of working with the Container Manager on Synology itself. Please see How to use Prometheus for Monitoring, how to Install Grafana on Windows and Windows Server, and Force BitLocker Recovery: Perform BitLocker Recovery via the Self-Service Portal and Helpdesk.
Table of contents
Note: Synology has replaced the Docker package with Container Manager in DSM 7.0 and later versions. Please, see how to download and update Synology DiskStation NAS to DSM 7.3.
Portainer provides a graphical user interface (GUI) for managing and monitoring Docker environments. Thereby making it easier for users to handle tasks that would otherwise require command-line interaction.
Creating Docker containers on a Synology DS923+ NAS involves installing a container manager on Synology from the Package Center. Please follow the steps below to install and use Container Manager to run Grafana and Prometheus on your Synology NAS.
Install Container Manager
Launch the Package Center on your Synology NAS, and search for Container Manager. You will have to install it as shown below.

Container Manager is currently being installed.

As you can see below, the Container Manager has been installed and is running successfully.
Note: Now that the Container Manager is running, you can as well open it and navigate to the Image tab, select the Prometheus image and click Launch. You will have to give the container a name, add a folder and choose
/docker/prometheusetc. You will also have to do the same for Grafana. But like I said above, we will be using Portainer as it simplifies Docker management..

Also, see How to install Grafana on Ubuntu Linux, how to Install and configure Prometheus for Monitoring on a Linux, and How to Install a Windows Server Container Host.
Create Folder for Portainer
As mentioned above, we will be working with Portainer as it simplifies Docker management for both beginner and experienced users. This makes it an essential tool for those working with containerized applications.
Under the Docker Folder, we will create a directory that will be used to store the configuration and data for Persistent Storage.

We have created our folder for Portainer as shown below.

Install Partainer
This step involves installing Portainer via the “Task Scheduler” via a custom script. Therefore, we will have to login to the Synology DSM (DiskStation Manager), and launch the Control Panel. Then click on “Task Scheduler”.

Click on Create and select Scheduled Task and then on “User-defined script“.

Under General, ensure the User is set to root and uncheck the “Enabled” option

Under schedule, select Run on the following date then select “Do not repeat“.

On the task settings tab, check “Send run details by email“, and enter your email. Below is an alternative script that you can utilze.
#!/bin/bash
# from Christian TechDirectArchive
# Pull the latest Portainer image
docker pull portainer/portainer-ce:latest
# Create Portainer container and bind it to port 9000
docker run -d \
--name=portainer \
--restart=always \
-p 8000:8000 \
-p 9000:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce
Do not forget to enter the user-defined script as shown in the image below. Then click OK.

docker pull portainer/portainer-ce:latest: Pulls the latest version of Portainer.docker run -d: Starts the container in detached mode.
--name=portainer: Names the container portainer.
--restart=always: Ensures the container restarts automatically if it crashes or if the Synology NAS reboots.
-p 8000:8000 -p 9000:9000: Exposes the container's ports 8000 (for the agent) and 9000 (for the Portainer UI).
-v /var/run/docker.sock:/var/run/docker.sock: Mounts the Docker socket to allow Portainer to manage Docker on the host.
-v portainer_data:/data: Creates a volume for Portainer's persistent data.
On the prompt, click on Ok

You will be required to enter your password to proceed. When done, click on submit.

Click on Apply

On the “Run Task” wizard, click on OK.

Click on OK

Do not forget to click on Save to save the changes.

Shortly, the script will run on time as defined

Create an Administrator Account for Portainer
Launch the web-browser by typing http://<synology-IP-address>:9000. The administrator account must be created (performed) within five (5) minutes. Else, you will run into issues.
To fix this issue, you will have to stop the Container Manager and start it again to fix this issue. You can read more here on why the issue was prompted.

Enter a username and password and do not forget to re-enter the password in the “confirm password field” as shown below.

Update Portainer Enviroment
Click on the “Get Started with the local environment Portainer is running on”. This refers to setting up and managing Docker containers on your local system where Portainer is installed literally instead of connecting to other environments.

We need to modify the Environments. Please see How to Install Docker Portainer on Linux.

Enter the Synology NAS IP address as show below. Then click on Update Environment.

As you can see below, the environment has been updated successfully.

Add Portainer Registries
Portainer registries are external sources where Docker images are stored such as Docker Hub or private container image registries. In a nutshell, a registry is a repository where Docker images are hosted thereby allowing Portainer to pull images for container deployment.
You can add custom or private registries, including Docker Trusted Registry (DTR) or other third-party container registries (e.g., Quay.io, AWS ECR, Google Container Registry). To do this, click on Registries from the Portainer Dashbaord.

Click + Add registry

In the Name field area type in GHCR and in the Registry URL area type in ghcr.io and then click Add registry to save the settings.
Note: The ghcr.io registry is required if you wish to update Docker containers via Portainer that are served via ghcr.io registry.

We will do the same by clicking on “+ Add Registry”.

At the custom registry details, enter the Name field area type in CODEBERG and in the Registry URL area type in codeberg.org. To save changes, click on “Add Registry”.

We will add a third registry type.

At the Name field area type in Quay.io and in the Registry URL area type in quay.io and do not forget to click on the “Add registry” to save the settings.

Below are the the registries we have successfully added to Portainer.
Note: If you would like to remove the “Upgrade to Business Edition“. You will need to have add blocker installed on your browser. Then right click on “Upgrade to Business Edition” and have it blocked by the adblocker.

Install a Text Editor
Applications on Synology such as Docker, Prometheus, and Grafana require you to edit the configuration files in formats such as YAML etc. Installing a text editor on your Synology NAS is useful when you wish to modify these files directly from the NAS without needing to transfer them to another machine
We will need the editor to modify prometheus.yml and snmp.yml with correct IP addresses, ports, and configurations. To do this, launch the Package Center and search for Text Editor and install it.

When installed, you can start using the Text Editor as you wish.

Modify Synology Firewall Rules
For this particular post, I have decided not to enable firewall as I am yet to correctly define the IP ranges that are needed to connected to my Synology NAS remotely.
Note: If the firewall is enabled, ensure that you permit the IP addresses of the Prometheus and Grafana containers (CTs) by adding them to the allowed Source IP list on your Synology. Additionally, verify that the SNMP service is enabled.
But if you decide to enable Firewall, click on Edit Rules for the Firewall profile as shown below and populate the rules. In a different post, I will show you how to enable firewall rules on Synology.

Here is a guide on how to manage User Permission on Synology with Active Directory [Part 1], and how to configure Synology DS923+ NAS for File Sharing [Part 2].
Create Docker Volumes for Persistent Storage
We will have to launch the “File Station” on your Synology NAS and have the Folders (directories) for Grafana and Prometheus created.
/docker/grafana/docker/prometheus
These directories will be used to store the configuration and data for Grafana and Prometheus.

Create Sub Folder Under Grafana
We will be creating directories like data, prometheus, and snmp in File Station under Grafana on the Synology NAS. This is useful for organizing and managing persistent data for Docker containers
The data directory is used for storing generic data required by various applications such as Grafana and Portainer. Grafana use this folder to store configuration files, dashboards, and other critical data that must persist even if the container is restarted or deleted.
By creating a dedicated data directory, you ensure that this information is saved outside the container.

This directory stores Prometheus data, including time-series metrics, configuration files, and other operational information.
Note: Prometheus needs to store a large amount of time-series data (metrics), which should be persisted to avoid losing historical data if the container is stopped or restarted. By creating a prometheus folder, you can map this directory as a persistent volume in Docker, ensuring Prometheus data survives container lifecycle events.

The snmp directory stores configuration files for the SNMP exporter or other SNMP-related data. By mapping the snmp directory to a Docker container, you can keep these configurations persistent and easily editable. It also helps maintain consistency if you need to update SNMP settings or review logs.

Please, see Integrate Active Directory with IPMI for Out-of-Band Management, how to Migrate Microsoft Enterprise Root Certification Authority and Forest Domain to Azure, and Unveiling OOTBI Mini and New Features for v1.7 from Object First.
Upload Pometheus.yml configuration file to Grafana Folder
For a complete Docker stack to run a Grafana Dashboard etc on a Synology NAS, please visit the GitHub link for more information. Here you will find the required snmp.yml, pometheus.yml, synology-dashboard.json file already created.
You can also vist Marius website for similar resources but you will have to pay to support his work and when you run into issues, he will offer great support to you.
Save the pometheus.yml file you have downloaded from any of the sources above and ensure you edit the target with your own Synology NAS IP Address. You can basically leave other parameters without modification.

9116 will be displayed in green, indicating that Prometheus is correctly parsing the file). You can check the Pometheus log also for more information on this.Upload snmp.yml configuration file to SNMP Folder
The Simple Network Management Protocol (SNMP) allows you to monitor and control network devices like routers, switches, firewalls, printers, and NAS appliances. Over time, SNMP has evolved, with SNMPv3 offering support for authentication and data encryption.
SNMP operates at the application layer of the OSI model. The protocol uses a connectionless approach via UDP ports:
- UDP 161: Used to query agents.
- UDP 162: Traps (automatic messages) are sent to managers when agents display unusual behavior.
Upon downloading the snmp.yml file, we will also modify some basic parameters as set in the Synology NAS below. We will be using SNMPv3 with the username “snmp-exporter”, protocol “MD5′ and a password of our choice.
Also, for the SNMP privacy, I will be using DES and will set a similar or different password as I wish.

Now you will have to edit the snmp.yml file and replace the parameters for as defined in the image above.
auths:
snmpv3:
version: 3
security_level: authPriv
auth_protocol: MD5
username: snmp-exporter
password: #Enter5yourownpasswordhere2345!
priv_protocol: DES
priv_password: ##Enter4yourownpasswordhere456!
modules:
synology:
walk:
- 1.3.6.1.2.1.2 # network
- 1.3.6.1.2.1.31.1.1 # The total number received/transmitted of the interface
- 1.3.6.1.4.1.2021.10.1.2
After modification, do not forget to save your snmp.yml file.
Note: This should be saved to the SNMP Folder. Else, you will have issues with the Prometheus Scrape Configuration. This will result in the SNMP job exporter status to be down.

The image below is just showing clarity and comparing how the configuration should be.

As mentioned already, ensure this file is saved to the right location. Else, you will spend days troubleshooting this issue.

Setting Up a Docker-Based Monitoring Stack with Prometheus, Grafana, and Exporters on Synology
This section involves creating a Docker Compose file that defines a stack of services, each running in its own container. This file help set up a monitoring environment using Grafana, Prometheus, and associated exporters (e.g., SNMP exporter, Node exporter etc). It also defines the network configurations that connect these containers.
To do this, navigate to the Portainer dashboard and click on Stacks and then “Add Stack’.

Select Web Editor and enter the Stack name as shown below. Also, enter the Docker compose file here.

Please copy and paste this script. To re-use this script, kindly reference this blog link.
# By Christian (TechDirectArchive)
version: '3.8' # Updated Compose version for features and compatibility
services:
my-grafana:
image: grafana/grafana:latest
container_name: My_Grafana
hostname: grafana-server
networks:
- monitoring-network
mem_limit: 512m
cpu_shares: 512
security_opt:
- no-new-privileges:true
user: "1026:100"
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"]
ports:
- 3350:3000 # Changed the port to avoid conflicts
volumes:
- /volume1/docker/my-monitoring/grafana/data:/var/lib/grafana:rw
environment:
TZ: Europe/Berlin
GF_INSTALL_PLUGINS: grafana-clock-panel,grafana-simple-json-datasource,natel-discrete-panel,grafana-piechart-panel
restart: always # Ensures container will always restart, not just on failure
my-prometheus:
image: prom/prometheus:latest
command:
- '--storage.tsdb.retention.time=30d' # Adjusted retention period for space management
- '--config.file=/etc/prometheus/prometheus.yml'
container_name: My_Prometheus
hostname: prometheus-monitor
networks:
- monitoring-network
mem_limit: 1g
cpu_shares: 768
security_opt:
- no-new-privileges=true
user: "1026:100"
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:9090/ || exit 1"]
volumes:
- /volume1/docker/my-monitoring/prometheus:/prometheus:rw
- /volume1/docker/my-monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
restart: always
system-node-exporter:
image: prom/node-exporter:latest
command:
- '--collector.cpu'
- '--collector.diskstats'
- '--collector.loadavg'
- '--collector.meminfo'
- '--collector.stat'
container_name: My_Node_Exporter
hostname: node-metrics
networks:
- monitoring-network
mem_limit: 256m
mem_reservation: 128m # Slightly adjusted memory reservation for smoother operation
cpu_shares: 512
security_opt:
- no-new-privileges=true
read_only: true
user: "1026:100"
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:9100/ || exit 1"]
restart: always
snmp-monitor-exporter:
image: prom/snmp-exporter:latest
command:
- '--config.file=/etc/snmp_exporter/snmp.yml'
container_name: My_SNMP_Exporter
hostname: snmp-monitor
networks:
- monitoring-network
mem_limit: 256m
mem_reservation: 128m
cpu_shares: 512
security_opt:
- no-new-privileges:true
read_only: true
user: "1026:100"
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:9116/ || exit 1"]
volumes:
- /volume1/docker/my-monitoring/snmp:/etc/snmp_exporter/:ro
restart: always
container-advisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: My_cAdvisor
hostname: cadvisor-monitor
networks:
- monitoring-network
mem_limit: 256m
mem_reservation: 128m
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: always
networks:
monitoring-network:
name: monitoring-net
driver: bridge
ipam:
config:
- subnet: 192.168.60.0/24 # subnet (feel free to enter yours)
Having entered the Docker compose file, Click on “Deploy Stack” as shown below.

If successfully deployed, you will see a message, “success, stack successfully deployed”.

Do not panic when you see the Grafana Container displays “unhealthy”. Just wait for few mins as it will turn healthy again.

You can also see from the Container Manager that have been deployed.

Accessing Grafana and Prometheus
To access Grafana, launch a browser and go to nasipaddress:3000. You should see the Grafana login page
To access Prometheus, launch a browser and go to NASIP:9090. You should see the Prometheus UI.
Grafana Data Connection
Adding a connection on Grafana is essential to pull data from external sources such as Prometheus or other data sources. Grafana itself does not store or collect data. It acts as a visualization and analytics tool.
To visualize metrics, logs, or data, you need to connect Grafana to a data source (e.g., Prometheus, InfluxDB, Elasticsearch). Without this connection, Grafana has no data to display.
Upon login to Grafana. By the way, here is the default credentials (admin / admin).

Here you will be required to change (update your password). When done, click on submit.

Next, click on “Add new connection”.

Search for Prometheus

Click on Prometheus as shown below.

Set Up Grafana Data Source
Now click on “Add new data source”

Enter the Prometheus server URL <xxxx://prometheus-server:9090>.
Now save and test connection. As you can see below, we have successfully queried the Prometheus API.

Please, see Integrate Active Directory with IPMI for Out-of-Band Management, how to Migrate Microsoft Enterprise Root Certification Authority and Forest Domain to Azure, and Unveiling OOTBI Mini and New Features for v1.7 from Object First.
Create Grafana Dashboards
Once connected, you can create custom dashboards and visualizations based on the data being collected. You can also build dashboards to show metrics from SNMP exporters, node exporters, or cAdvisor.
Since I have a preconfigured Synology dashboard, I will import this instead of creating a new one on the fly. Use the attached GitHub link above to download the synology-dashboard.json file.

Now click on import

Upload the Synology_Dashboard.json file. Enter the Name and click import as shown below.

Connecting to data sources like Prometheus allows Grafana to display real-time data and trends from various services, including CPU usage, memory consumption, network traffic, and more as shown below. This helps in monitoring the health and performance of your Synology NAS.





Add the Synology Dashboard to the Grafana homepage. To do this, click the star icon to add it to favorite

For “J series Synology NAS devices” that cannot run Docker. Please take a look at this link. This does not require conatners such as “Cadvisor” or “Node_Exporter”.
Since Docker isn’t supported on these models, you might want to explore other monitoring tools that don’t rely on containers such as Nagios and Zabbix.
Also, see monitoring services using Zabbix, and how to Monitor Windows Hosts via Nagios.
DS Manager Pro
DS Manager Pro allows you to easily supervise your Synology NAS (DSM) by controlling network traffic and connections, system health, storage health and capacity, logs, tasks, backups and many more. There is Wake On LAN and System status widget to help you take control over your NAS even more.

Conclusion
Grafana serves as a single pane of glass for monitoring multiple systems, services, and metrics. By connecting to different data sources, you can visualize all metrics in one place.
In the next article, I will show you how to setup Docker to monitor another Synology NAS with Prometheus and Grafana. The guide will be similar to this with basic modification to the IP parameters and Grafana ports.
FAQs on Monitoring Synology with Prometheus and Grafana
This means that the persistent folder snmp does not exist. But when you take a look at the File Station, you may see these files. To resolve this issue, I will recommended you to uninstall the “Container Manager and reinstall it”. Then create the directories again.
Once connected to a data source like Prometheus, Grafana allows you to create a variety of visualizations, including:
– Graphs: Line graphs, bar charts, and histograms to visualize time series data over intervals.
– Tables, Single Stat Panels: Show single metrics as a large number for quick insights, such as current CPU usage.
– Heatmaps: Useful for visualizing density of data points over time, ideal for performance monitoring.
– Alert Lists: Visualize active alerts based on the metrics collected, helping you quickly identify issues.
When Prometheus stops with an exit code 2, it indicates a problem with the configuration file in my case. Fix this and try to restart the container.
This issue is tricky as it can be due to numerous reasons such as firewall, no access to SNMP exporter on port 9116, SNMP port not opened, and password are in correct, SNMP Exporter container not running, SNMP configuration. But in my case, the snmp.yml file was not placed in the snmp directory.
I hope you found this guide useful on “Monitoring Synology with Prometheus and Grafana”. Please feel free to leave a comment below.

I have folloed this to a T and yet Grafana keeps saying SNMP: DOWN. All stats show “No DATA”. no idea why
This can be tricky, to be honest. Do you have the complete prometheus.yml and SNMP.yml files in the right locations? Kindly take a look at the linked GitHub account and adjust the files according to your needs. This should also be reflected in the stack script for “Docker-Based Monitoring Stack with Prometheus, Grafana, and Exporters on Synology
“.
did you ever manage to get this sorted? i’m having the same problem
If you need further help on this, use the contact form
all my folders are exact.
Also boticed that your URL to add Prometheus to Grafana is http://prometheus-server:9090. yet that fails. http://prometheus-monitor:9090 works though as that is the container hostname you have set. Also http://<your-NAS-IP>:9090 does not bring up anything. As well I noticed http://<your-NAS-IP>:3000 doesnt work as I believe you changed the port to 3350
Please ensure you start all over again with the files. You may want to use the DS Manager Pro as well