check_disk 1.4.3 (1.64) for AIX not working?

Alexander Harvey alexh19740110 at gmail.com
Mon Jul 17 08:05:59 CEST 2006


Actually, it still doesn't really work in AIX5L as it always finds the /proc
filesystem to be of size -1%.

I've rewritten this plugin as a shell script for anyone else who might find
this useful:

#!/bin/ksh
# author: alex harvey
# email: alexh19740110 at gmail.com

Usage ()
{
    printf "Usage: %s: [-w warn] [-c crit]\n" $0
    exit 3
}

wflag=
cflag=

while getopts w:c: opt
do
   case $opt in
      w) wflag=1
         warn=$OPTARG
         ;;
      c) cflag=1
         crit=$OPTARG
         ;;
      ?) Usage
         ;;
   esac
done

# too many arguments?
shift $(($OPTIND -1))
[ $# -ne 0 ] && Usage

# missing warn or crit option?
[ ! -z "$wflag" ] && [ ! -z "$cflag" ] || Usage

# chop the trailing %
warn=`echo $warn | sed -e 's/%$//'`
crit=`echo $crit | sed -e 's/%$//'`

mounts=`\
  df -k |\
  grep -v /proc |\
  grep -v /var/adm/ras/platform |\
  tail +2 |\
  awk '{print $7}'`

STATE=0

for i in $mounts; do
   free_pcent=`df -k |\
     awk -v input=$i '{if ($7 == input) print $4}' |\
     sed -e 's/%//'`
   free_pcent=`echo 100 - $free_pcent | bc`
   free_kb=`df -k |\
     awk -v input=$i '{if ($7 == input) print $3}'`
   if [ $free_pcent -le $warn ] && [ $STATE -le 1 ]; then
      STATE=1
      mess="$mess, $free_kb kB (${free_pcent}%) free on $i"
   fi
   if [ $free_pcent -le $crit ]; then
      STATE=2
      mess="$mess, $free_kb kB (${free_pcent}%) free on $i"
   fi
done

case $STATE in
   0) echo "DISK OK"
      exit 0
      ;;
   1) STATE_MESS=WARNING
      ;;
   2) STATE_MESS=CRITICAL
      ;;
esac

mess=`echo $mess | sed -e 's/^, //'`
mess="DISK $STATE_MESS [$mess]"
echo $mess
exit $STATE


Kind Regards,
Alex


On 7/10/06, Alexander Harvey <alexh19740110 at gmail.com> wrote:
>
> Well, I got this to work using the earlier version:
>
>
> # ./plugins/check_disk -w 10% -c 5% -p /home
> DISK OK - free space: /home 508 MB (99%);| /home=5MB;460;486;0;512
>
> # ./plugins/check_disk --version
> check_disk (nagios-plugins 1.4.2) 1.57
>
> Perhaps this is a bug?
>
> Regards,
> Alex
>
>
> On 7/10/06, Alexander Harvey <alexh19740110 at gmail.com > wrote:
> >
> > Hi,
> >
> > Has anyone else had any problems using the latest check_disk v1.64plugin in
> > AIX5.3?
> >
> > Here's my list of filesystems:
> >
> > # df -k
> > Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
> > /dev/hd4         10747904   1515560   86%     1975     1% /
> > /dev/hd2          2883584   1653188   43%    28814     8% /usr
> > /dev/hd9var       2097152   1454828   31%     2898     1% /var
> > /dev/hd3          2097152   1770060   16%     1453     1% /tmp
> > /dev/fwdump        262144    261776    1%        4     1%
> > /var/adm/ras/platform
> > /dev/hd1           524288    519920    1%      118     1% /home
> > /proc                   -         -    -         -     -  /proc
> > /dev/hd10opt       262144    125340   53%     3127    10% /opt
> > /dev/fslv00     167772160  23425268   87%       48     1% /u02
> > /dev/fslv01     139460608  69102616   51%      131     1% /u03
> > /dev/u01lv       16515072   9477800   43%    22322     2% /u01
> >
> > 1. First example of false or misleading output:
> >
> > # ./plugins/check_disk -w 10% -c 5%
> > DISK CRITICAL - free space: / 1480 MB (14% inode=99%); /usr 1614 MB (57%
> > inode=93%); /var 1421 MB (69% inode=99%); /tmp 1729 MB (84% inode=100%);
> > /var/adm/ras/platform 256 MB (100% inode=100%); /home 508 MB (99%
> > inode=100%); /proc 0 MB (0% inode=NaNQ%); /opt 122 MB (48% inode=90%); /u02
> > 22876 MB (14% inode=100%); /u03 67483 MB (50% inode=100%); /u01 9256 MB (57%
> > inode=99%);| /=9016MB;9446;9971;99;10496 /usr=1202MB;2534;2675;92;2816
> > /var=628MB;1843;1945;99;2048 /tmp=320MB;1843;1945;99;2048
> > /var/adm/ras/platform=1MB;230;243;99;256 /home=5MB;460;486;99;512
> > /proc=-1MB;1717986917;858993458;-2147483648;-1 /opt=134MB;230;243;90;256
> > /u02=140964MB;147456;155648;99;163840 /u03=68709MB;122572;129382;99;136192
> > /u01=6873MB;14515;15321;98;16128
> >
> > (Looks like it's failing to understand the /proc entry?)
> >
> > 2. Second example of failed output:
> >
> > # ./plugins/check_disk -w 10% -c 5% -p /home
> > INPUT ERROR: C_IDFP (0.000000) should be less than W_IDFP ( 0.0) and
> > both should be between zero and 100 percent, inclusive for /home
> > check_disk: Could not parse arguments
> > Usage: check_disk -w limit -c limit [-p path | -x device] [-t
> > timeout][-m] [-e] [-W limit] [-K limit] [-v] [-q]
> >
> > 3. Furthermore I noticed it failed the test in 'make test':
> >
> > ./t/check_disk......dubious
> >         Test returned status 255 (wstat 65280, 0xff00)
> > DIED. FAILED tests 1, 3-32
> >         Failed 31/32 tests, 3.12% okay
> >
> > Anyone seen any of this before?
> >
> > My configure options were:
> >
> > # ./configure --with-openssl=no --with-ipv6=no
> >
> > Thanks in advance,
> >
> > Alex Harvey
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20060717/bf069d75/attachment.html>
-------------- next part --------------

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list