#!/bin/sh # # cpu2: Sun Enterprise Server check - BB external script test # # version 1.0 # version 2.0 - includes uname and prtdiag checks too # 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.4 - properly uses $THIS_HOST instead of $MACHINE due to fqdn using comma in name # thanks Craig Cook # version 2.5 - added inode cache check to $NF of sar -g check - non zero is bad # also adding check for mpstat's smtx column above 500 # # 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" ##### ##### List CPU Info. ##### echo "
" CATCH_COMMAND=` $PSRINFO ` NUM_PROCS=` $PSRINFO | wc -l ` if [ "$?" = "0" ] then ON_LINES=`$PSRINFO | $GREP on-line | wc -l` if [ "$NUM_PROCS" = "$ON_LINES" ] then echo "$CATCH_COMMAND" else COLOR="red" echo "Only $ON_LINES of $NUM_PROCS on-line" echo "$CATCH_COMMAND" fi else COLOR="red" echo "Problem with some/all processors !!!" fi echo "" ##### ##### List more CPU Info. ##### echo "
" CATCH_COMMAND=` $MPSTAT ` if [ "$?" = "0" ] then echo "$CATCH_COMMAND" else COLOR="red" echo "Problem with $MPSTAT or some processors !!!" fi echo "" ##### ##### List still more CPU Info. ##### echo "
" PLATFORM_SPEC=`$UNAME -m` PRTDIAG_COMMAND="/usr/platform/$PLATFORM_SPEC/sbin/prtdiag -v" if [ -s "/usr/platform/$PLATFORM_SPEC/sbin/prtdiag" ] then ECHO_COMMAND=` $PRTDIAG_COMMAND | $AWK '/CPU.*.CPU/, /^$/ {print $0}' | $GREP -v "^$" ` CATCH_COMMAND=` $PRTDIAG_COMMAND | $AWK '/CPU.*.CPU/, /^$/ {print $0}' | $GREP -v "^$" | $TAIL +4 ` CONFIGURED_PROCS=` $PRTDIAG_COMMAND | $AWK '/CPU.*.CPU/, /^$/ {print $0}' | $GREP -v "^$" | $TAIL +4 | $WC | $AWK '{print $NF}' ` INSTALLED_PROCS=` $UNAME -X | $GREP NumCPU | $AWK '{print $NF}' ` if [ "$CONFIGURED_PROCS" = "$INSTALLED_PROCS" ] then echo "$ECHO_COMMAND" else COLOR="red" echo "uname reports $INSTALLED_PROCS installed processors, but prtdiag shows only $CONFIGURED_PROCS present." echo "Some processors seem to be offline or problematic !!!" fi else echo "No prtdiag installed on this platform - $PLATFORM_SPEC" fi echo "" ##### ##### Last of the CPU Info. ##### echo "
" CATCH_COMMAND=` $UNAME -X | $EGREP "Node|NumCPU" ` if [ "$?" = "0" ] then echo "$CATCH_COMMAND" else COLOR="red" echo "Problem with uname command. Cant determine installed processor count !!!" fi echo "" ##### ##### Check the "sar -g 1 1" output (proc paging) for inode cache issues ##### if [ ! -z "$SAR" ] then echo "
" CATCH_COMMAND=` $SAR -g 1 1 | $AWK '/.pgout./, /^$/ {print $0}' ` if [ "$?" = "0" ] then INODE_INFO=` $SAR -g 1 1 | $TAIL -1 | $AWK '{print $NF}' | $GREP -v "^0.00" ` if [ ! -z "$INODE_INFO" ] then if [ "$COLOR" != "red" -a "$COLOR" != "purple" ] then COLOR="yellow" fi echo "Looks like inode cache may need to be increased" echo "$CATCH_COMMAND" else echo "All Inode cache info good at this time." fi else COLOR="red" echo "Problem with $SAR !!!" fi echo "" fi echo "" ##### ##### List more CPU Info. ##### echo "
" CATCH_COMMAND=` $MPSTAT 2 2 ` if [ "$?" = "0" ] then SMTX_VAL=` $MPSTAT 2 2 | $AWK '{print $10}' | $GREP -v smtx | $SORT -n | $TAIL -1` if [ "$SMTX_VAL" -gt "500" ] then if [ "$COLOR" != "red" -a "$COLOR" != "purple" ] then COLOR="yellow" fi echo "Looks like mutex contention if %sys is more than %usr below" echo "$CATCH_COMMAND" else echo "All good - no mutex problems at this time." fi else COLOR="red" echo "Problem with $MPSTAT !!!" fi echo "" ## ##### ## ##### System Swap and Memory Monitoring ## ##### ## echo "
" ## CATCH_COMMAND1=` $SWAP -l ` ## if [ "$?" = "0" ] ## then ## echo "$CATCH_COMMAND1" ## else ## COLOR="red" ## echo "Problem with swap !!!" ## fi ## CATCH_COMMAND2=` $SWAP -s ` ## if [ "$?" = "0" ] ## then ## echo "$CATCH_COMMAND2" ## else ## COLOR="red" ## echo "Problem with swap !!!" ## fi ## echo "" ##### ##### 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.cpu2 $GREP $THIS_HOST $BBHOSTS | $GREP "cpu2" | while read line do if [ ! -z "$line" ] then echo "