--- /dev/null
+# 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
+++ /dev/null
-# 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