Skip to content

Latest commit

 

History

History
123 lines (96 loc) · 4.61 KB

README.md

File metadata and controls

123 lines (96 loc) · 4.61 KB

Monitoring

  1. Configure Mail
  2. Drives (HDD / SSD)
    1. S.M.A.R.T
    2. Temperature
  3. Prometheus / Grafana
  4. Prometheus Exporters
    1. Node Exporter
    2. Pi-Hole Exporter
    3. cAdvisor

Configure Mail

for more information see here

for more information about sending proxmox notifications see here

Drives (HDD / SSD)

S.M.A.R.T

  • smartctl must be installed
  • smtp client must be installed and configured
  • smart.sh can be used to trigger test runs and to retrieve test results (email)
Options Comment Example value
-d --device specify device to be used /dev/sda
-h --help show help
-m --mode specify mode to be used test
test run a new test
result provide results of a previously triggered test
-r --recipient specify recipient (email) to be notified when using result mode [-m result] [email protected]
-t --test-mode specify smartctl test mode to be used short
short
long
  • to automate test runs a crontab entry can be used: crontab -e
# run a long test for /dev/sda every first day of the month at 1 am
0 1 1 * * /root/Homelab-Tools/monitoring/smart.sh -m test -d /dev/sda -t long

# provide test results for /dev/sda every second day of the month at 1 am
0 1 2 * * /root/Homelab-Tools/monitoring/smart.sh -m result -d /dev/sda -r [email protected]

Commands

# run short test for device /dev/sda
smartctl -t short /dev/sda

# run long test for device /dev/sda
smartctl -t long /dev/sda

# show test results for device /dev/sda
smartctl -a /dev/sda

Temperature

Commands

# show temp for multiple devices
hddtemp /dev/sd[a-d]

# show temp for device as numeric
hddtemp /dev/sda --numeric

Prometheus / Grafana

Easiest way to use Prometheus and Grafana is by using docker-compose file

Prometheus Exporters

Node Exporter (Service)

use setup-node-exporter.sh script for setup on Debian/Ubuntu

Pi-Hole Exporter (Service)

see Pi-Hole Prometheus Exporter GitHub page for further information

  1. create new user
sudo useradd pihole_exporter -s /sbin/nologin
  1. download pihole_exporter

check for newest version on pihole-exporter GitHub page

wget https://github.com/eko/pihole-exporter/releases/download/v0.3.0/pihole_exporter-linux-amd64
  1. make pihole_exporter executable and move
chmod +x pihole_exporter-linux-amd64 
sudo cp pihole_exporter-linux-amd64 /usr/bin/pihole_exporter
  1. create new service
sudo nano /etc/systemd/system/pihole_exporter.service

add content from pihole_exporter.service

  1. create start script
sudo nano /etc/pihole/pihole-exporter.sh

add content from pihole_exporter.service

make script executable

sudo chmod +x /etc/pihole/pihole-exporter.sh
  1. activate and start service
sudo systemctl daemon-reload
sudo systemctl enable pihole_exporter
sudo systemctl start pihole_exporter

cAdvisor (Docker-Compose)

use docker-compose.yml file to setup cAdvisor