From: Alexander Barton Date: Fri, 5 Feb 2010 16:32:30 +0000 (+0100) Subject: Migrated Disks.tst (I/O errors) to Darwin/Disks.tst X-Git-Tag: rel-2~17 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=nagcollect.git;a=commitdiff_plain;h=e4ad458cca0145cbcb6edd9f046eff6d8ac1d8e6;hp=8f1a22e4afc931ae86a4661f0d4e0037e4b2073f Migrated Disks.tst (I/O errors) to Darwin/Disks.tst --- diff --git a/client/lib/tests/Darwin/DiskErrors.tst b/client/lib/tests/Darwin/DiskErrors.tst new file mode 100644 index 0000000..e2d2ce9 --- /dev/null +++ b/client/lib/tests/Darwin/DiskErrors.tst @@ -0,0 +1,26 @@ +# NagCollect -- Nagios Data Collector for Passive Checks +# Copyright (c)2010 Alexander Barton, alex@barton.de + +# Check disks for I/O errors + +SERVICE="Disks_p" + +offset=`LC_ALL=C grep -b "BOOT_TIME:" /var/log/system.log \ + | tail -n 1 | cut -d':' -f1` +if [ -n "$offset" ]; then + # reboot detected in system.log + error=`LC_ALL=C tail -c "+$offset" /var/log/system.log \ + | grep -i "I/O" | grep -i error | grep -v nagcollect | tail -n 1` +else + # no reboot detected in system.log + error=`LC_ALL=C grep -i "I/O" /var/log/system.log \ + | grep -i error | grep -v nagcollect | tail -n 1` +fi +if [ -n "$error" ]; then + msg=`echo $error | cut -d' ' -f6-` + STATUS=2 + TEXT="ERROR - $msg" +else + STATUS=0 + TEXT="OK - No I/O errors detected." +fi diff --git a/client/lib/tests/Disks.tst b/client/lib/tests/Disks.tst deleted file mode 100644 index 9c7b045..0000000 --- a/client/lib/tests/Disks.tst +++ /dev/null @@ -1,25 +0,0 @@ -# NagCollect -- Nagios Data Collector for Passive Checks -# Copyright (c)2009 Alexander Barton, alex@barton.de - -if [ `uname` = "Darwin" ]; then - SERVICE="Disks_p" - offset=`LC_ALL=C grep -b "BOOT_TIME:" /var/log/system.log \ - | tail -n 1 | cut -d':' -f1` - if [ -n "$offset" ]; then - # reboot detected in system.log - error=`LC_ALL=C tail -c "+$offset" /var/log/system.log \ - | grep -i "I/O" | grep -i error | grep -v nagcollect | tail -n 1` - else - # no reboot detected in system.log - error=`LC_ALL=C grep -i "I/O" /var/log/system.log \ - | grep -i error | grep -v nagcollect | tail -n 1` - fi - if [ -n "$error" ]; then - msg=`echo $error | cut -d' ' -f6-` - STATUS=2 - TEXT="ERROR - $msg" - else - STATUS=0 - TEXT="OK - No I/O errors detected." - fi -fi