Grafana dashboard for monitoring virtual machines, pihole, nas, docker containers and plex ecosystem!!
- How it Works
- Installing InfluxDB
- Installing Telegraf
- Installing Varken
- Installing Sabnzbd Script
- Installing Speedtest
- Setting up Pihole
- Installing Grafana
In getting all this setup, there are 3 main moving parts. Telegraf, InfluxDB and Grafana. Telegraf is what collects all the different system metrics and outputs it to an InfluxDB database that Grafana uses to visualize everything with pretty graphs and bars.
- Download the config file and place it in the influxdb appdata folder i.e. ./docker/influxdb
- Run the docker-compose.
# INFLUXDB - DATABASE FOR SENSOR DATA
influxdb:
image: influxdb:1.8.6
container_name: influxdb
restart: always
security_opt:
- no-new-privileges:true
ports:
- 8086:8086
- 8089:8089/udp
volumes:
- ./docker/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro
- ./docker/influxdb/db:/var/lib/influxdb
environment:
- TZ=Europe/Amsterdam
- INFLUXDB_HTTP_ENABLED=true
- INFLUXDB_DB=host
command: -config /etc/influxdb/influxdb.conf
- Download the config file and place it in the telegraf appdata folder i.e. ./docker/telegraf
- Edit the telegraf.conf file. Scroll down to OUTPUT PLUGINS and edit the url on line 106 and database on the 110.
# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
urls = ["http://192.168.1.252:8086"]
## The target database for metrics; will be created as needed.
## For UDP url endpoint database needs to be configured on server side.
database = "docktelegraf"
192.168.1.252 is the IP address of the server running InfluxDB and 8086 is the default InfluxDB port. InfluxDB will save the metrics sent from telegraf under docktelegraf database.
- Scroll further down to INPUT PLUGINS and edit the url on line 247.
# # PiHole monitoring
[[inputs.http]]
urls = ["http://192.168.1.253/admin/api.php"]
- Incase you are using default config file, the following input plugins needs to be enabled so that all the panels on the Grafana dashboard will work. It is curently enabled in the attached config file.
[[inputs.docker]]
[[inputs.hddtemp]]
[[inputs.net]]
[[inputs.netstat]]
[[inputs.sensors]]
[[inputs.http]]
[[inputs.exec]]
[[inputs.file]]
For the hddtemp input to work, we need to install the HDDTemp container. There is nothing special to configure here except the time zone variable.
# HDDTEMP - MONITOR HDD TEMPS
hddtemp:
image: drewster727/hddtemp-docker:latest
container_name: hddtemp
restart: unless-stopped
privileged: true
environment:
- HDDTEMP_ARGS="-q -d -F /dev/sd*"
- TZ=Europe/Amsterdam
# Install lm-sensor
sudo apt install lm-sensors
# Detect all the sensors
sudo sensors-detect --auto
- Run the docker-compose.
# TELEGRAF - SERVER TELEMERTY AND METRICS COLLECTOR
telegraf:
image: telegraf:latest
container_name: telegraf
restart: unless-stopped
security_opt:
- no-new-privileges:true
volumes:
- ./docker/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /sys:/rootfs/sys:ro
- /proc:/rootfs/proc:ro
- /etc:/rootfs/etc:ro
environment:
- TZ=Europe/Amsterdam
- HOST_PROC=/rootfs/proc
- HOST_SYS=/rootfs/sys
- HOST_ETC=/rootfs/etc
- Download the config file and place it in the varken appdata folder i.e. ./docker/varken
- Edit the config file. Detailed instructions can be found here.
- Run the docker-compose.
# VARKEN - MONITOR PLEX, SONARR, RADARR, AND OTHER DATA
varken:
image: boerderij/varken:latest
container_name: varken
restart: unless-stopped
security_opt:
- no-new-privileges:true
volumes:
- ./docker/varken:/config
depends_on:
- influxdb
- telegraf
- grafana
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Amsterdam
- Edit the environmental values in the docker-compose.
- Run the docker-compose.
# SABNZBD SCRIPT – SABNZBD STATS FOR INFLUXDB
sabnzbd-influxdb:
image: mbarmem/sabnzbd_influxdb:latest
container_name: sabnzbd-influxdb
restart: unless-stopped
volumes:
- ./docker/telegraf:/config
depends_on:
- influxdb
- telegraf
- grafana
environment:
- INTERVAL=5
- SABNBZBD_HOST=192.168.1.252 # IP ADDRESS OF SABNZBD SERVER
- SABNZBD_PORT=8080 # PORT OF SABNZBD SERVER
- SABNZBD_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # API KEY FOR SABNZBD
- INFLUXDB_HOST=192.168.1.252 # IP ADDRESS OF INFLUXDB SERVER
- INFLUXDB_PORT=8086 # PORT OF INFLUXDB SERVER
- INFLUXDB_DB=sabnzbd # NAME OF SABNZBD DATABASE
- Download the config file and place it in the speedtest appdata folder i.e. ./docker/speedtest
- Edit the config file and modify the adress and port under Influxdb.
[INFLUXDB]
Address = 192.168.1.252 # IP ADDRESS OF INFLUXDB SERVER
Port = 8086 # PORT OF INFLUXDB SERVER
- Run the docker-compose.
# SPEEDTEST – SPEEDTEST COLLECTOR FOR INFLUXDB
speedtest:
image: mbarmem/speedtest-for-influxdb:latest
container_name: speedtest
restart: unless-stopped
volumes:
- ./docker/speedtest:/src
depends_on:
- influxdb
- telegraf
- grafana
- Run the below commands to install telegraf on Debian.
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update
sudo apt-get install telegraf
- Delete the telegraf config file.
sudo rm -rf /etc/telegraf/telegraf.conf
-
Download the config file and place it in the telegraf folder i.e. /etc/telegraf/telegraf.conf
-
Edit the telegraf.conf file. Scroll down to OUTPUT PLUGINS and edit the url on line 106 and database on the 110.
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
urls = ["http://192.168.1.252:8086"] # required
database = "pihole1" # required
192.168.1.252 is the IP address of the server running InfluxDB and 8086 is the default InfluxDB port. InfluxDB will save the pihole metrics sent from telegraf under pihole1 database.
- Scroll further down to INPUT PLUGINS and edit the url on line 247.
# # PiHole monitoring
[[inputs.http]]
urls = ["http://192.168.1.253/admin/api.php"]
- Start Telegraf
sudo systemctl start telegraf
-
Install telegraf with docker as described earlier.
-
Download the config file and place it in the telegraf appdata folder i.e. ./docker/telegraf
-
Edit the telegraf.conf file. Scroll down to OUTPUT PLUGINS and edit the url on line 106 and database on the 110.
# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
urls = ["http://192.168.1.252:8086"] # required
database = "pihole1" # required
192.168.1.252 is the IP address of the server running InfluxDB and 8086 is the default InfluxDB port. InfluxDB will save the metrics sent from telegraf under docktelegraf database.
- Scroll further down to INPUT PLUGINS and edit the url on line 247.
# # PiHole monitoring
[[inputs.http]]
urls = ["http://192.168.1.253/admin/api.php"]
- Download the config file and place it in the grafana appdata folder i.e. ./docker/grafana
- Edit the config file and modify the admin_user and admin_password at line 156 and 160 respectively. Default username and password is admin.
- Run the docker-compose.
# GRAFANA - GRAPHICAL DATA VISUALIZATION FOR INFLUXDB DATA
grafana:
image: mbarmem/grafana-render:latest
container_name: grafana
restart: unless-stopped
security_opt:
- no-new-privileges:true
ports:
- 3000:3000
user: "0"
volumes:
- ./docker/grafana:/var/lib/grafana
- ./docker/grafana/grafana.ini:/etc/grafana/grafana.ini
environment:
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,grafana-worldmap-panel,grafana-piechart-panel
- After the installation is finished go to the WebUI (http://IP:3000) and log in with username and password you chose.
- Click on Add data source and select InfluxDB.
- Next give the data source a name, add the URL to InfluxDB, enter the database to use. In this case:
Name: DockTelegraf
URL: http://192.168.1.252:8086
Database: docktelegraf
192.168.1.252 is the IP address of the server running InfluxDB and 8086 is the default InfluxDB port. docktelegraf is the database which was set earlier under telegraf config.
- Click Save & Test. If all your settings are correct you should see Data source is working message.
-
Click on Add data source and select InfluxDB.
-
Next give the data source a name, add the URL to InfluxDB, enter the database to use. In this case:
Name: Plex
URL: http://192.168.1.252:8086
Database: varken
192.168.1.252 is the IP address of the server running InfluxDB and 8086 is the default InfluxDB port. varken is the database assigned in varken config.
- Click Save & Test. If all your settings are correct you should see Data source is working message.
-
Click on Add data source and select InfluxDB.
-
Next give the data source a name, add the URL to InfluxDB, enter the database to use. In this case:
Name: Sabnzbd
URL: http://192.168.1.252:8086
Database: varken
192.168.1.252 is the IP address of the server running InfluxDB and 8086 is the default InfluxDB port. sabnzbd is the database assigned in sabnzbd script docker config.
- Click Save & Test. If all your settings are correct you should see Data source is working message.
-
Click on Add data source and select InfluxDB.
-
Next give the data source a name, add the URL to InfluxDB, enter the database to use. In this case:
Name: SpeedTest
URL: http://192.168.1.252:8086
Database: speedtest
192.168.1.252 is the IP address of the server running InfluxDB and 8086 is the default InfluxDB port. speedtest is the database assigned in speedtest config.
- Click Save & Test. If all your settings are correct you should see Data source is working message.