How to install node exporter on TrueNAS Scale
On TrueNAS Scale, Graphite is the only current supported option to export metrics, but in this tutorial we will setup node_exporter and prometheus to get metrics and setup alerts for our NAS. This will also allow us to use standard Node Exporter and ZFS dashboards in Grafana.
Download Node Exporter
Before proceeding, it’s recommended to store the Node Exporter and any configuration files on your storage pool. In this example, the storage pool is named tank
, which is mounted under /mnt/tank
. This ensures the files are stored persistently and are safe from potential system upgrades or reconfigurations.
- Connect to your server via SSH or open Shell from TrueNAS -> System -> Shell.
- Download and extract the latest node exporter version
# cd /mnt/tank
# wget https://github.com/prometheus/node_exporter/releases/download/v1.9.0/node_exporter-1.9.0.linux-amd64.tar.gz
# tar xf node_exporter-1.9.0.linux-amd64.tar.gz
# cd node_exporter-1.9.0.linux-amd64
Create a Init/Shutdown Script
The next step is to configure node exporter to start on boot. This can be achieved by using TrueNAS Init/Shutdown scripts.
- Open TrueNAS Web UI
- Go to System -> Advanced settings -> Init/Shutdown Scripts
- Click on Add fill the form with the following settings:
- Description: Node Exporter
- Type: Command
- Command:
nohup /mnt/tank/node_exporter-1.9.0.linux-amd64/node_exporter > /dev/null 2>&1 &
- When: Post init
- Enabled: Yes
- Timeout: 10
Node Exporter is now configured. To start it, either reboot your TrueNAS or run the above command as root via SSH/Shell.
Note that node_exporter is not officially supported by TrueNAS and you should pay attention to the following cons:
- Default config will allow everyone to scrap your metrics. You should use TLS and basic authentication to protection your node.
- You must manually update and maintain Node Exporter.
- TrueNAS upgrades may break it.