Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
:
icinga
:
production
>
nagios-plugins-disks
> check_disks
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File check_disks of Package nagios-plugins-disks
#!/bin/bash CHECK_MULTI_CMD_FILE="/tmp/check_disks.cmd" CNT=0 rm -rf ${CHECK_MULTI_CMD_FILE} 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 b=`readlink -e ${a}` if [ "`mount | grep ^${b} | wc -l`" == "1" ] ; then a=${b} fi if [ -d /etc/nagios/check_disks/ ] ; then b=`echo ${a} | sed -e s@"/"@"_"@g` if [ -s /etc/nagios/check_disks/${b} ] ; then # format is 20%:10% warn=`cat /etc/nagios/check_disks/${b} | awk -F: '{print $1}'` crit=`cat /etc/nagios/check_disks/${b} | awk -F: '{print $2}'` if [ -z "${warn}" ] || [ -z "${crit}" ] ; then warn="20%" crit="10%" fi else warn="20%" crit="10%" fi else warn="20%" crit="10%" fi echo "command[check_disk_${CNT}]=/usr/lib/nagios/plugins/check_disk -w ${warn} -c ${crit} -p ${a}" >> ${CHECK_MULTI_CMD_FILE} CNT=`expr ${CNT} + 1` done if [ -x /usr/lib/nagios/plugins/check_multi ] ; then if [ -f ${CHECK_MULTI_CMD_FILE} ] ; then /usr/lib/nagios/plugins/check_multi -f ${CHECK_MULTI_CMD_FILE} -s dont_be_paranoid=1 else if [ -x /usr/lib/nagios/plugins/check_disk ] ; then /usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / else echo "Couldn't find any valid filesystem to check and i'm unable to execute check_disk plugin" exit 2 fi fi else echo "Plugin: /usr/lib/nagios/plugins/check_multi not executable" exit 2 fi