File check_disks of Package nagios-plugins-disks (Revision daf70ba64efa24dec2f3eb23be4a5ba4)
Currently displaying revision daf70ba64efa24dec2f3eb23be4a5ba4, show latest
1
#!/bin/bash
2
CHECK_MULTI_CMD_FILE="/tmp/check_disks.cmd"
3
CNT=0
4
5
rm -rf ${CHECK_MULTI_CMD_FILE}
6
7
for a in `grep -E '(xfs|ext2|ext3|ext4|btrfs|reiserfs|vfat|tmpfs|vzfs)' /proc/mounts | awk '{print $1}' | grep ^/ | grep -v -E '(^/vz/template:)' | sort -u` ; do
8
#a=`readlink -e ${a}`
9
if [ -d /etc/nagios/check_disks/ ] ; then
10
b=`echo ${a} | sed -e s@"/"@"_"@g`
11
if [ -s /etc/nagios/check_disks/${b} ] ; then
12
# format is 20%:10%
13
warn=`cat /etc/nagios/check_disks/${b} | awk -F: '{print $1}'`
14
crit=`cat /etc/nagios/check_disks/${b} | awk -F: '{print $2}'`
15
if [ -z "${warn}" ] || [ -z "${crit}" ] ; then
16
warn="20%"
17
crit="10%"
18
fi
19
else
20
warn="20%"
21
crit="10%"
22
fi
23
fi
24
echo "command[check_disk_${CNT}]=/usr/lib/nagios/plugins/check_disk -w ${warn} -c ${crit} -p ${a}" >> ${CHECK_MULTI_CMD_FILE}
25
CNT=`expr ${CNT} + 1`
26
done
27
if [ -x /usr/lib/nagios/plugins/check_multi ] ; then
28
if [ -f ${CHECK_MULTI_CMD_FILE} ] ; then
29
/usr/lib/nagios/plugins/check_multi -f ${CHECK_MULTI_CMD_FILE} -s dont_be_paranoid=1
30
else
31
if [ -x /usr/lib/nagios/plugins/check_disk ] ; then
32
/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
33
else
34
echo "Couldn't find any valid filesystem to check and i'm unable to execute check_disk plugin"
35
exit 2
36
fi
37
fi
38
else
39
echo "Plugin: /usr/lib/nagios/plugins/check_multi not executable"
40
exit 2
41
fi
42