Monitor a cluster of Raspberry Pi's with Glances and Grafana
dashboard.json glances.service
Child Glance (Client only running Glances and InfluxDB)
Pre-requisites:
sudo apt-get install -y curl iptables python3-pip glances influxdb software-properties-common
Firewall rules to allow traffic to the Glances web interface, InfluxDB and Grafana
Glances
iptables -I INPUT -p tcp --dport 61208 -j ACCEPT
InfluxDB
iptables -I INPUT -p tcp --dport 8086 -j ACCEPT
iptables -I INPUT -p tcp --dport 8088 -j ACCEPT
sudo systemctl enable influxdb
curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=CREATE DATABASE "glances"'
curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=show databases'
Create glances.service file in /etc/systemd/system/glances.service
[Unit]
Description=Glances
After=network.target influxd.service
[Service]
ExecStart=/usr/local/bin/glances --quiet --export influxdb
Restart=on-failure
RemainAfterExit=yes
RestartSec=30s
TimeoutSec=30s
[Install]
WantedBy=multi-user.target
Parent Glance (Client running Glances, InfluxDB and Grafana)
Firewall rules to allow traffic to the Glances web interface, InfluxDB and Grafana
Grafana
iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
Add Grafana repository & install Grafana
sudo mkdir -p /etc/apt/keyrings/
wget -O- https://packages.grafana.com/gpg.key |
gpg --dearmor |
sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://packages.grafana.com/oss/deb stable main" |
sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt-get install grafana
sudo systemctl enable grafana-server
sudo du -sh /var/lib/influxdb/data/glances/