Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
I've been searching all around but I wasn't able to find a proper answer. I have a proper Nagios setup monitoring my network (internal and external) but now I want to monitor the available disk space in my pi-hole.
As the pi-hole is a raspberry pi 1b+, it and has very limited resources. I though about using nrdp with passive monitoring in Nagios but I'm struggling.
I've configured Nagios as nrdp_server and configured check_dummy. It works.
my command configuration in Nagios machine is as follows:
define host {
use linux-server ; Host group to use
host_name pi-hole ; Name of this host
alias pihole ; Alias
address 192.168.1.x ; IP Address
icon_image raspi.png
}
define service {
use generic-service ; Name of service template to use
host_name pi-hole
service_description DNS
check_command check_dns
}
define service {
use generic-service ; Name of service template to use
host_name pi-hole
service_description HTTP
check_command check_http
}
define service {
use generic-service ; Name of service template to use
host_name pi-hole
service_description DHCP
check_command check_dhcp
}
define service {
use generic-service ; Name of service template to use
host_name pi-hole
service_description Disk Usage
check_command check_dummy!2!"No results received"
active_checks_enabled 0
passive_checks_enabled 1
check_freshness 1
freshness_threshold 7200
notification_period 24x7
flap_detection_enabled 0
event_handler_enabled 0
notification_interval 1440
notification_period 24x7
}
In raspberry-pi server (monitored machine):
crontab:
#!/bin/sh
df -H | grep -E $1 | awk '{ print $5 " " $1 }' | while read output;
do
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $3 ]; then
php /usr/local/nrdp/clients/send_nrdp.php --url=http://balrog/nrdp/ --token=C4uu6YbpJIKyrK9qxH --host=pi-hole --service="Disk Usage" --state=2 --output="Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)"
else
if [ $usep -ge $2 ]; then
php /usr/local/nrdp/clients/send_nrdp.php --url=http://balrog/nrdp/ --token=C4uu6YbpJIKyrK9qxH --host=pi-hole --service="Disk Usage" --state=1 --output="Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)"
else
php /usr/local/nrdp/clients/send_nrdp.php --url=http://balrog/nrdp/ --token=C4uu6YbpJIKyrK9qxH --host=pi-hole --service="Disk Usage" --state=0 --output="Disk ok \"$partition ($usep%)\" on $(hostname) as on $(date)"
fi
fi
done
And pls let me know if you find a better solution!