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