#!/bin/sh # # ha: Sun Enterprise Server check - BB external script test # # version 1.0 - only works with Veritas FirstWatch # version 2.0 - updated for Veritas Cluster Server # version 2.1 - properly uses $CAT instead of cat # version 2.2 - properly uses $MACHINE instead of `uname -n` in bb-hosts check # version 2.3 - 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 ######################################## ######################################## # 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 ##### 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 ##### ##### now decide what to do based on clustering software ##### case "$CLUSTER" in VRTSfw) ##### ##### Veritas First Watch ##### echo "
" CATCH_COMMAND1=` /opt/VRTSfw/bin/HAevent status | $EGREP "ONLINE_PRIMARY|TAKEOVER_READY" ` if [ "$?" = "0" ] then echo "Status of the Primary Service : \c" echo "$CATCH_COMMAND1" else COLOR="red" echo "Problem with First Watch Primary !!!" echo "Actual output was : $CATCH_COMMAND1" fi CATCH_COMMAND2=` /opt/VRTSfw/bin/HAevent -remote status | $EGREP "ONLINE_PRIMARY|TAKEOVER_READY" ` if [ "$?" = "0" ] then echo "Status of the Remote Service : \c" echo "$CATCH_COMMAND2" else COLOR="red" echo "Problem with First Watch Remote !!!" echo "Actual output was : $CATCH_COMMAND2" fi echo "" ##### ##### Veritas First Watch Heartbeat Info. ##### echo "
" CATCH_COMMAND3=` /opt/VRTSfw/bin/HAevent hstatus ` CATCH_COMMAND1=` /opt/VRTSfw/bin/HAevent hstatus | $GREP Heartbeat | $GREP -v Yes ` if [ ! "$?" = "0" ] then echo " Status of the Primary Heartbeat : " echo "$CATCH_COMMAND3" else COLOR="red" echo "Problem with First Watch Heartbeat !!!" echo "Actual output was : $CATCH_COMMAND3" fi echo "" ;; VRTSvcs) ##### ##### Veritas Cluster Server Info. ##### echo "
" CATCH_COMMAND1=` /opt/VRTSvcs/bin/hastatus -summary | $GREP "^A" | $AWK '{print $2" "$3" "$4}' ` if [ "$?" = "0" ] then echo "Cluster Server Status : \n" echo "System State Frozen" echo "$CATCH_COMMAND1" else COLOR="red" echo "Problem with Cluster Services !!!" echo "Actual output was : $CATCH_COMMAND1" fi CATCH_COMMAND2=` /opt/VRTSvcs/bin/hastatus -summary | $GREP "RUNNING" | $AWK '{print $2}' | $WC -l` CATCH_COMMAND3=` /opt/VRTSvcs/bin/hasys -list | $WC -l` if [ ! "$CATCH_COMMAND2" = "$CATCH_COMMAND3" ] then echo "\nOne or more of the members of the cluster appear down." echo "Only showing $CATCH_COMMAND2 of $CATCH_COMMAND3 up." # echo "Running systems are : $CATCH_COMMAND2" COLOR="red" fi CATCH_COMMAND4=` /opt/VRTSvcs/bin/hastatus -summary | $GREP " C " | $AWK '{print $2" "$3" "$4" "$5}' ` if [ "$?" = "0" ] then echo "Cluster Server Failed Resources : \n" echo "Group Type Resource System" echo "$CATCH_COMMAND4" else COLOR="red" echo "Problem with Cluster Services !!!" echo "Actual output was : $CATCH_COMMAND4" fi echo "" ##### ##### Veritas Cluster Group Info. ##### echo "
" CATCH_COMMAND3=` /opt/VRTSvcs/bin/hastatus -summary | $GREP "ONLINE" | $AWK '{print $2" "$3" "$6}' ` if [ "$?" = "0" ] then echo "Cluster Server Group Status : \n" echo "Group Server State" echo "$CATCH_COMMAND3" else COLOR="red" echo "Problem with Cluster Service Group !!!" echo "Actual output was : $CATCH_COMMAND1" fi echo "" ##### ##### Veritas Cluster Server Heartbeat Info. ##### echo "
" CATCH_COMMAND1=` /sbin/lltstat -l | $GREP "ether" | $AWK '{print " "$1" "$2" "$3"line"}' ` if [ "$?" = "0" ] then echo "Heartbeat Link Status : \n" echo "Link Interface Status" echo "$CATCH_COMMAND1" else COLOR="red" echo "Problem with Heartbeat !!!" echo "Actual output was : $CATCH_COMMAND1" fi CATCH_COMMAND2=` /sbin/lltstat -l | $GREP "ether" | $AWK '{print $3}' | $WC -l` if [ ! "$CATCH_COMMAND2" -gt "1" ] then echo "\nProblem with heartbeat - one or more are down." echo "Only showing $CATCH_COMMAND2 configured and should be at least 2." COLOR="red" fi echo "" ;; *) ##### ##### No Cluster Info Available ##### echo "
" COLOR="yellow" echo "No Cluster Heartbeat Configured !!!" echo "" ;; ##### ##### End of case statement ##### esac ##### ##### Make sure to export COLOR so that it gets back to "central" ##### export COLOR ##### ##### End of get_status proc ##### } ##### ##### Main body ##### touch /tmp/$THIS_HOST.ha $GREP $THIS_HOST $BBHOSTS | $GREP "ha" | while read line do if [ ! -z "$line" ] then echo "