#!/bin/sh # # logs Sun Enterprise Server check - BB external script test # # version 1.0 # version 1.1 - Now incorporates Veritas FirstWatch and VCS logs # version 1.2 - Now properly also uses the IGNMSGS value from etc/bbdef.sh # version 1.3 - Corrected bug involving the IGNMSGS, where it was not enclosed in quotes # version 1.4 - Now properly also uses the MSGFILE value from /etc/bbdef.sh # version 1.5 - Updated by Brian McCullough for SULOG and ADMDIR # version 1.6 - properly uses $CAT instead of cat # version 1.7 - properly uses $MACHINE instead of `uname -n` in bb-hosts check # version 1.8 - Corrected bug involving the IGNMSGS, where the syntax of SED was incorrect - missing global # version 1.9 - Fixed bug in FirstWatch area for logging information # version 1.10 - properly uses $THIS_HOST instead of $MACHINE due to fqdn using comma in name - thanks Craig Cook # # BIG BROTHER / XXXXXXXXXXXXXXXX status # # Written by Paul A. Luzzi # on March 22, 2000 # ######################################## # NOTE # This has been tested with BB 1.2b, 1.4h2, 1.5, 1.5a # # Tested on # Sun Ultra 60, E220R/420R, E250/450, E3000/3500, E4500 # AIX 43P # UnixWare 7 # RedHat 5.2, 6.0 and 6.1 # Linux Turbo Cluster Server 4.0 # Caldera Open Linux 1.1 and 2.3 ######################################## ######################################## # INSTALLATION # step 1 - update the EXT section of the runbb.sh script to include this # ... ######################################## ################################## # CONFIGURE IT HERE ################################## ################################## # Start of script ################################## if test ! "$BBHOME" then echo "template- BBHOME is not set" exit 1 fi if test ! -d "$BBHOME" then echo "template- BBHOME is invalid" exit 1 fi if test ! "$BBTMP" # GET DEFINITIONS IF NEEDED then echo "template- The BB environment is not set" exit 1 fi ##### ##### Start of custom section added by Paul A. Luzzi ##### ##### ##### Get Status proc - used to get all responses ##### get_status() { ##### ##### Setup any and all variables before beginning. ##### ##### ##### Modified extensively on 03-22-2000 by Paul A. Luzzi ##### for use with Big Brother ##### ##### Purpose is to report back to a central server, all "standard" ##### detailed information about network, disk, volume, cpu, memory ##### which is not reported thru regular "easy" checks. ##### ##### Any problem areas should be highlighted in - ##### bold, italics, and red font. ##### ##### ##### Setup some variables for use later ##### CUR_DATE=`$DATE | $SORT -u | $CUT -c 5-10` COLOR="green" ##### ##### Find which cluster software is used ##### CLUSTER_TYPE=`$PKGINFO | $GREP VRTS | $AWK '{print $2}' ` if [ "`echo "$CLUSTER_TYPE" | $GREP fw `" ] then CLUSTER="VRTSfw" elif [ "`echo \"$CLUSTER_TYPE\" | $GREP vcs `" ] then CLUSTER="VRTSvcs" fi ##### ##### Extract the current /var/adm/messages ##### echo "
" if [ ! -z "$IGNMSGS" ] then NEWIGNMSGS=`echo $IGNMSGS | $SED s/\;/\|/g` CATCH_COMMAND=` $GREP "$CUR_DATE" ${MSGFILE}* | $EGREP -v "$NEWIGNMSGS" > /tmp/$THIS_HOST.logs.messages` else CATCH_COMMAND=` $GREP "$CUR_DATE" ${MSGFILE}* > /tmp/$THIS_HOST.logs.messages` fi $CAT /tmp/$THIS_HOST.logs.messages if [ -s "/tmp/$THIS_HOST.logs.messages" ] then COLOR="yellow" fi echo "" ##### ##### Extract the current sulog file ##### SU_LOG_DATE=` $DATE '+%m/%d' ` echo "
" CATCH_COMMAND=` $GREP "$SU_LOG_DATE" ${SULOG} > /tmp/$THIS_HOST.logs.sulog` $CAT /tmp/$THIS_HOST.logs.sulog echo "" ##### ##### Grep thru the current ha log file ##### if [ "$CLUSTER" = "VRTSfw" ] then HA_DATE=` $DATE '+%b %d' ` echo "
" CATCH_COMMAND=` $GREP "$HA_DATE" /var/log/ha.log > /tmp/$THIS_HOST.logs.halog` if [ -s "/tmp/$THIS_HOST.logs.halog" ] then COLOR="red" echo "Potential problem with FirstWatch !!! Reported issues of -" echo "" echo "$CATCH_COMMAND" else echo "$CATCH_COMMAND" fi echo "" elif [ "$CLUSTER" = "VRTSvcs" ] then HA_DATE=` $DATE '+%Y/%m/%d' ` echo "
" CATCH_COMMAND=` $GREP "$HA_DATE" /var/VRTSvcs/log/engine.log_A > /tmp/$THIS_HOST.logs.halog` CATCH_COMMAND2=` $EGREP "ailed|FAILED|ffline|illed|xited" /tmp/$THIS_HOST.logs.halog ` if [ -z "$CATCH_COMMAND2" ] then $CAT /tmp/$THIS_HOST.logs.halog else COLOR="red" echo "Potential problem with VCS !!! Reported issues of -" echo "" echo "$CATCH_COMMAND2" fi echo "" fi ##### ##### Check sizes of btmp, wtmp, wtmpx, utmp, or any type of these files ##### echo "
" FILE_LIST=`$LS ${ADMDIR}/?tmp*` CATCH_COMMAND=` $LS -l ${ADMDIR}/?tmp* > /tmp/$THIS_HOST.logs.tmp ` $CAT /tmp/$THIS_HOST.logs.tmp echo "" ##### ##### Make sure to export COLOR so that it gets back to "central" ##### export COLOR ##### ##### Cleanup ##### if [ -s /tmp/$THIS_HOST.logs.syslog ] then $RM -f /tmp/$THIS_HOST.logs.syslog fi if [ -s /tmp/$THIS_HOST.logs.messages ] then $RM -f /tmp/$THIS_HOST.logs.messages fi if [ -s /tmp/$THIS_HOST.logs.sulog ] then $RM -f /tmp/$THIS_HOST.logs.sulog fi if [ -s /tmp/$THIS_HOST.logs.tmp ] then $RM -f /tmp/$THIS_HOST.logs.tmp fi ##### ##### End of get_status proc ##### } ##### ##### Main body ##### touch /tmp/$THIS_HOST.logs $GREP $THIS_HOST $BBHOSTS | $GREP "logs" | while read line do if [ ! -z "$line" ] then echo "