#!/bin/sh -- nagios=/usr/local/nagios etc=$nagios/etc lib=$nagios/libexec date=`date '+%Y%m%d_%H%M%S'` tmp="/tmp/check_maestro_${date}_$$" /bin/rm -f $tmp $lib/check_conman > $tmp $lib/check_ps_multi.pl -f $etc/check_ps_multi_maestro.cfg >> $tmp $lib/check_dircount -w :400 -c :500 /opt/tws/TWS/schedlog >> $tmp $lib/check_dircount -w :400 -c :500 /opt/tws/TWS/stdlist >> $tmp $lib/check_dircount -w :800 -c :1000 /opt/tws/TWS/stdlist/logs >> $tmp # If you run more than one egrep, that has output, nrpe pukes and claims no # output was received (error code 10). It has something to do with nrpe # closing the pipe from the child process (this script) after it receives # one line of output (really one buffered block, but it only looks at the # first line). The second egrep attempts to write up the now closed pipe, # and gets a broken pipe error. It doesn't mind if there are multiple # lines of output (though it only passes the first one), so long as they # all fit in one block, ie probably one write call from egrep. rc=0 egrep -i '^CRITICAL' $tmp if [ $? -eq 0 ]; then rc=2 fi if [ $rc -eq 0 ]; then egrep -i '^WARNING' $tmp if [ $? -eq 0 -a $rc -eq 0 ]; then rc=1 fi fi if [ $rc -eq 0 ]; then egrep -vi '^CRITICAL|^WARNING' $tmp fi #/bin/rm -f $tmp exit $rc