Figure 3: check_multi-machines--A sample script to check a list of machines
#!/bin/sh -x
# Script to use checktool to check a number of machines
# and to mail the results of the tests to the administrator
FLAGS=-d
TESTFILE=/usr/local/etc/check_machine_list
MACHINE_LIST=$1
RESULTS=/tmp/$$.results
SYSADMIN=cmk
CHECKTOOL=/usr/local/etc/checktool
touch $RESULTS
for machine in `cat $MACHINE_LIST`
do
echo "Checking results for Machine " $machine 1>> $RESULTS
$CHECKTOOL $FLAGS $machine $TESTFILE 1>>$RESULTS 2>&1
if [ $? != 0 ] ; then
echo "can not run on " $machine >> $RESULTS
fi
done
cat $RESULTS
cat $RESULTS | /usr/ucb/mail -s 'checktool results' $SYSADMIN
rm $RESULTS
|