This docker compose file can be used to run the grafana-agent in a container on a Synology NAS.
Tested on a DS420+
(AMD64) with DSM 7.2.1
Disclaimer: Your results might vary, use at own risk, no liability accepted.
- Create and login to Free Grafan Cloud
- Click
Getting Started
button - Click
Quickstart
button (with all the OS icons) - Click
Linux
Click the button and follow the instructions.
I recommend running the commands on a different linux system, or in WSL.
Once you are done make sure any started agent is stopped, then grab
the generated grafana-agent.yaml
config file. This will become
the file we need in docker.
If you do need to run the script on your NAS directly you'll need to
manually download the install-linux-binary.sh
script and edit it
to replace unzip
with 7z x
as unzip is no longer installed.
--- install-linux-binary.sh 2024-01-20 13:36:08.137819400 +0100
+++ install-linux-binary_nas.sh 2024-01-20 13:35:52.324263900 +0100
@@ -78,7 +78,7 @@
log '--- Verifying package checksum'
check_sha
- unzip "${ASSET_NAME}";
+ 7z x "${ASSET_NAME}";
chmod a+x "${ASSET_NAME}";
}
Select Other Distribution
as your OS and make sure you select
the correct architecture. (I only tested this on AMD64)
Follow all the instructions to update configuration but stop before it asks you to run/start the grafana-agent.
Because we're planning to run the agent in docker the following updates need to be made to configuration:
- The paths for node_exporter to monitor need to be updated to those mapped into the container
- Log location needs to be updated (if you are collecting logs)
--- agent_orig.yaml 2024-01-20 13:21:52.078747800 +0100
+++ agent.yaml 2024-01-20 13:20:25.666723500 +0100
@@ -23,6 +23,11 @@
# For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
node_exporter:
enabled: true
+ # For running in container
+ rootfs_path: /host/root
+ sysfs_path: /host/sys
+ procfs_path: /host/proc
+ udev_data_path: /host/root/run/udev/data
# disable unused collectors
disable_collectors:
- ipvs #high cardinality on kubelet
@@ -82,7 +87,7 @@
labels:
instance: 'synnas'
# For running in container
- __path__: /var/log/{syslog,messages,*.log}
+ __path__: /var/host-log/{syslog,messages,*.log}
job: integrations/node_exporter
metrics:
Copy the grafana-agent.yaml
to this folder (where the compose.yaml
is)
and name it agent.yaml
.
Review the compose.yaml
and ensure you know what it does, as it will access
potentially sensitive data about your system.
Install/Start the docker compose in your preferred manner (I prefer dockge)
Ensure you are getting log messages in the console from the running agent.
With the container successfully started you can now click the
Test Connection
button and it should succeed.
It's fairly easy to do but does require some tweaking.