check_new_disk

Our AIX(this could be used on any *nix) servers all have different drives and different requirements per drive. So every mount point we want monitored is a separate check as the W and C values are different. We also wanted a mechanism to alert the Nagios admins(me) if a new mount point was ever added to a server so I could add a check for it. If you run the check_disk check and exclude and/or ignore everything, then your get an unknown reply. I wrote this to change the unknown into an OK and anything else(meaning a new drive was found) into a critical.

Script(check_new_disk):

#!/bin/bash

if [[ $(“$@”) == “DISK UNKNOWN – free space:|” ]]
then
echo “OK: No new drives!”;
exit 0;
else
echo “CRITICAL: New drives!”;
exit 2;
fi;

Nagios Command Definition:

$USER1$/check_new_disk $USER1$/check_nrpe -n -H $HOSTADDRESS$ -t 30 -c check_disk -a ‘$ARG1$’

Example command:

/usr/local/nagios/libexec/check_new_disk /usr/local/nagios/libexec/check_nrpe -n -H 10.97.235.15 -t 30 -c check_disk -a ‘-w 1000 -c 500 -A -x / -x /usr -x /home -x /tmp -x /u01 -x /proc -x /opt -x /tomaxbin -i ‘/var*$’ -i ‘^/notes*$”