Have you installed Grafana monitored by Prometheus following my step by step guide to display system metrics for your Synology NAS server? Have you installed Prometheus on your second or third NAS device? In this step by step guide I will show you how to integrate Watchtower in the Grafana Dashboard. When it came to my First and Second guides, people complained they had No data showing on the Container Updates area. So today I will teach you how to display Watchtower data on your Container Updates area so you can Fully Enjoy your Synology Dashboard.
What is Watchtower? Watchtower is a Docker application that monitors your running containers for changes to the image. When an update is available in the Docker registry, Watchtower detects the changes and pulls down the new copy of the image. It will then restart the container using the new image and the same start options of the original, without you losing any data.
Please Support My work by Making a Donation.
If you already have the Watchtower container installed on your Synology NAS, it’s mandatory to delete it first and then install it again using my guide below. If you don’t have Watchtower installed on your NAS, skip this STEP.
Install Text Editor via Synology “Package Center”. (Mandatory STEP.) If you already have Text Editor installed on your Synology NAS, skip this STEP.
Open the prometehus.yml file that you have in File Station. Remove these lines below:
And replace with these lines below.
- job_name: watchtower-docker scrape_interval: 10m metrics_path: /v1/metrics bearer_token: mariushostingisthebest # your API_TOKEN static_configs: - targets: ['watchtower:8080']
See the example in the image below.
Click X to save the file. Click Save to save the file. Follow the instructions in the image below.
Log into Portainer using your username and password. On the Portainer left sidebar click on Stacks then + Add stack. Follow the instructions in the image below.
In the Name field type in watchtower. Follow the instructions in the image below.
version: "3.9" services: watchtower: image: containrrr/watchtower:latest container_name: WATCHTOWER hostname: watchtower networks: - prometheus-net mem_limit: 128m mem_reservation: 50m cpu_shares: 256 security_opt: - no-new-privileges=true read_only: true volumes: - /var/run/docker.sock:/var/run/docker.sock:ro environment: TZ: Europe/Bucharest WATCHTOWER_CLEANUP: true # Remove old images after updating WATCHTOWER_REMOVE_VOLUMES: false # Remove attached volumes after updating DOCKER_API_VERSION: 1.41 # SSH docker version WATCHTOWER_INCLUDE_RESTARTING: true # Restart containers after update WATCHTOWER_INCLUDE_STOPPED: false # Update stopped containers WATCHTOWER_SCHEDULE: "0 0 */2 * * *" # Update & Scan containers every 2 hours WATCHTOWER_LABEL_ENABLE: false WATCHTOWER_ROLLING_RESTART: true WATCHTOWER_TIMEOUT: 30s WATCHTOWER_HTTP_API_METRICS: true # Metrics for Prometheus WATCHTOWER_HTTP_API_TOKEN: mariushostingisthebest # Token for Prometheus restart: on-failure:5 networks: prometheus-net: external: true
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: If you want, you can change some parameters in the code above such as the frequency with which your containers get scanned and updated.
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.
If everything goes right, you will see this message at the top right of your screen: “Success Stack successfully deployed“.
On the left sidebar in Portainer, click Containers. Identify your Prometheus instance, select it then click Restart. Follow the instructions in the image below.
Go back to STEP 1 or you will deal with karma 🙂
After the Prometheus container has restarted, go to your Synology Dashboard to see your metrics about Container Updates. Note: Know that the container updates metrics are not real-time metrics. The metrics take 10 minutes to show. For example, if you have set Watchtower to update and scan your containers every 2 hours (like in the example at STEP 6), then your metrics in the Grafana dashboard will appear every 2 hours and 10 minutes in the Container Updates area.
Note: Remember that you have to use this guide and install Watchtower on every Synology NAS device you want to monitor.
This post was updated on Monday / February 6th, 2023 at 7:25 AM