1 # NagCollect -- Nagios Data Collector for Passive Checks
2 # Copyright (c)2010 Alexander Barton, alex@barton.de
4 # Check disks for I/O errors
8 offset=`LC_ALL=C grep -b "BOOT_TIME:" /var/log/system.log \
9 | tail -n 1 | cut -d':' -f1`
10 [ -n "$offset" ] || offset=`LC_ALL=C grep -b -- --NagiosReset-- \
11 /var/log/system.log | tail -n 1 | cut -d':' -f1`
12 if [ -n "$offset" ]; then
13 # reboot detected in system.log
14 error=`LC_ALL=C tail -c "+$offset" /var/log/system.log \
15 | grep -i "I/O" | grep -i error | grep -v nagcollect | tail -n 1`
17 # no reboot detected in system.log
18 error=`LC_ALL=C grep -i "I/O" /var/log/system.log \
19 | grep -i error | grep -v nagcollect | tail -n 1`
21 if [ -n "$error" ]; then
22 msg=`echo $error | cut -d' ' -f6-`
27 TEXT="OK - No I/O errors detected."