1 # NagCollect -- Nagios Data Collector for Passive Checks
2 # Copyright (c)2010-2012 Alexander Barton, alex@barton.de
4 # Check disks for I/O errors
8 grepcmd='grep -i "I/O" | grep -i error | grep -v nagcollect
9 | grep -v "com.apple.mdworker.pool"
10 | grep -v "file i/o error - bad dset location"
11 | grep -v "encoder error"
12 | grep -v "SQLite error code:"
15 offset=`LC_ALL=C grep -b "BOOT_TIME:" /var/log/system.log \
16 | tail -n 1 | cut -d':' -f1`
17 [ -n "$offset" ] || offset=`LC_ALL=C grep -b -- --NagiosReset-- \
18 /var/log/system.log | tail -n 1 | cut -d':' -f1`
20 if [ -n "$offset" ]; then
21 # reboot detected in system.log
22 error=`LC_ALL=C tail -c "+$offset" /var/log/system.log \
23 | eval $grepcmd | tail -n 1`
25 # no reboot detected in system.log
26 error=`LC_ALL=C grep -i "I/O" /var/log/system.log \
27 | eval $grepcmd | tail -n 1`
29 if [ -n "$error" ]; then
30 msg=`echo $error | cut -d' ' -f6-`
35 TEXT="OK - No I/O errors detected."