mmsexplorer revision cee0fb94c0d4227de0a00efc162fb2739844b641
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# mmsexplorer
#
# mmsexplorer is a script that gathers information about the installed system
# and places it in a file for MMS customer support.
#
# NOTE: this script must be run as root.
#
# $Revision: 1.7 $
#
# Check for root user
echo "Error, you must be root to run this script."
exit 1
fi
# INPUT OPTIONS
while getopts u OPT; do
?) echo "Usage: $0 [-u] [report_name] [num_lines]" 1>&2; exit 1;;
*) echo "Usage: $0 [-u] [report_name] [num_lines]" 1>&2; exit 1;;
esac
done
# REPORT LOCATION
REPORT=${1:-/tmp/MMSreport.`/bin/uname -n`.`/bin/date '+%Y'``/bin/date '+%m'``/bin/date '+%d'`.`/bin/date '+%H'``/bin/date '+%M'``/bin/date '+%Z'`}
# How many lines from log files, etc., to show in the output report.
# Default is 1,000, but your support provider may ask you to change
# this to provide additional historical log messages.
# How many lines from the media manager log file to show in the output
# report. Default is 5,000.
MM_LINES=`/bin/expr $HOW_MANY_LINES \* 5`
# How many lines from a SMF service log file to show in the output
# report. Default is 100.
SVCLOG_LINES=`/bin/expr $HOW_MANY_LINES / 10`
###
# CONFIGURATION VARIABLES
# The number of lines from each mdb invocation
MDB_LINES=100000
# Locale for messages
LOCALE=C
# END OF CONFIGURATION VARIABLES - NO CHANGES BELOW HERE, PLEASE
###
# MMSreport name
# MMSreport directory
# MMS Service Configuration
# Directories that MMS uses
# Output files
# Temporary work files
# A tag emitted on lines indicating serious problems
TAG=":-( "
# The prompt we fake on echoed command lines
# Function definitions
# How many "."s on the current line? 999 means "too many".
COUNT=999
# Note: If you find the lines of dots aren't the same length, or you
# get extra "."s in your output file, then check to make sure you
# haven't done something like "verbose ls >>$REPORT", because then
# twiddle's dot will go to the report file instead of the screen!
COUNT=1
echo
fi
}
# Execute a command, echoing it as it does so.
eval $* >>$REPORT 2>&1
}
# Indenting version of the above verbose function.
}
# Head version of the above verbose function.
}
# Show a file, with title and verbose echoing of the cat command.
elif [ -r $file ]; then
elif [ -f $file ]; then
else
fi
done
}
# Indenting version of the above showfiles function.
elif [ -r $file ]; then
elif [ -f $file ]; then
else
fi
done
}
# Show at least $HOW_MANY_LINES lines of a group of files
ENUF=0
elif [ -r $file ]; then
if [ ! -s $file ]; then
else
return
else
fi
fi
elif [ -f $file ]; then
else
fi
done
}
# Show at least n lines of a group of files
shift
showenuf $*
}
# Show just the last $HOW_MANY_LINES lines of a file
elif [ -r $file ]; then
if [ ! -s $file ]; then
else
fi
elif [ -f $file ]; then
else
fi
done
}
# Show last n lines of a file
shift
showtails $*
}
# End of function definitions
# Generate the report
if [ $TGZ = "ON" ]; then
echo "Lines per file: $HOW_MANY_LINES"
echo "Output format: tar.gz (default) Use -u for unarchived/uncompressed."
else
echo "Report name: $REPORT"
echo "Lines per file: $HOW_MANY_LINES"
echo "Output format: unarchived/uncompressed"
fi
echo "MMS Software Support Report" >$REPORT
echo " " >>$REPORT
echo " " >>$REPORT
echo " " >>$REPORT
echo "------------------- locale --------------------------" >>$REPORT
export LC_ALL
echo "------------------- boot time -----------------------" >>$REPORT
echo "------------------- uptime --------------------------" >>$REPORT
echo "------------------- system type ---------------------" >>$REPORT
if [ X = X$SYS_TYPE ]; then
SYS_TYPE="Not Available"
fi
echo "------------------- uname ---------------------------" >>$REPORT
#
# Check for some Solaris patches we know are required for proper operation
# of MMS. There may be others; this list is subject to change.
# Issue a warning if the patch isn't there; otherwise echo the full patch id.
#
if [ $SOL_VER = "5.11" ]; then
NEEDED="NONE"
else
NEEDED="UNKNOWN"
fi
echo "------------------- application architecture info ---" >>$REPORT
echo "------------------- kernel architecture info --------" >>$REPORT
KERN_VER=` echo $KERN_ARCH | /bin/cut -c1-2`
echo "\nSolaris is running in 64-bit kernel mode." >>$REPORT
else
echo "\nSolaris is running in 32-bit kernel mode." >>$REPORT
fi
if [ X"$KERN_ARCH" != X ]; then
echo $KERN_ARCH >>$REPORT
fi
echo "------------------- check system patches ------------" >>$REPORT
NEEDED=""
fi
echo "\nPatches installed for Solaris:\n" >>$REPORT
PATCHFOUND=`/bin/grep -w $patch $TMPPAT`
if [ "X$PATCHFOUND" = "X" ]; then
else
fi
done
echo "\nPatches installed for MMS:\n" >>$REPORT
verbose "/bin/showrev -p 2>/dev/null | /bin/egrep 'SUNWhsmr|SUNWhsmu|SUNWmmsr|SUNWmmsu|SUNWpostgr|SUNWopenssl' | /bin/sed -e 's/Obso.*//' | /bin/sed -e 's/Patch: //' > $TMPPAT"
done
#
# SUNWhsmr - Sun ADM HSM software Solaris 11 (root)
# SUNWhsmu - Sun ADM HSM software Solaris 11 (usr)
# SUNWmmsr - MMS Solaris (root)
# SUNWmmsu - MMS Solaris (usr)
# SUNWpostgr - Postgres psql (client programs)
# SUNWpostgr-libs - Postgres libpq (client)
# SUNWpostgr-server - Postgres postmaster (server)
# SUNWopenssl-commands - OpenSSL commands (usr)
# SUNWopenssl-libraries - OpenSSL libraries (usr)
# SUNWopensslr - OpenSSL (root)
# STKacsls - Automated Cartridge System Library Software by StorageTek
# SUNWfcp - Sun FCP SCSI Device Driver (system)
# SUNWfcpx - Sun FCP SCSI Device Driver 64-bit (system)
# SUNWfctl - Sun Fibre Channel Transport layer (system)
# SUNWfctlx - Sun Fibre Channel Transport layer 64-bit (system)
# SUNWqlc - Qlogic ISP 2200/2202 Fibre Channel Device Driver (system)
# SUNWqlcx - Qlogic ISP 2200/2202 Fibre Channel Device Driver 64-bit (system)
# SUNWsmgr - SANsurfer, QLogic Fibre Channel Administration (system)
# JNIC - JNI Fibre Channel SCSI HBA Driver (system)
# QLA2200-3 - QLogic QLA2200 driver (system)
#
echo "------------------- package info --------------------" >>$REPORT
for PACKAGE in SUNWhsmr SUNWhsmu SUNWmmsr SUNWmmsu SUNWpostgr SUNWpostgr-libs SUNWpostgr-server SUNWopenssl-commands SUNWopenssl-libraries SUNWopensslr STKacsls SUNWfcp SUNWfcpx SUNWfctl SUNWfctlx SUNWqlc SUNWqlcx SUNWsmgr JNIC QLA2200-3
do
done
echo "------------------- kernel info ---------------------" >>$REPORT
echo "------------------- modinfo output ------------------" >>$REPORT
echo "------------------- storage array info ------------------" >>$REPORT
fi
echo "------------------- device configuration info -----------" >>$REPORT
fi
else
fi
echo "------------------- service configuration -----------" >>$REPORT
# check for database downgrade
# order database log files from current day of week
found=0
found=1
else
fi
done
# database snapshot
object="APPLICATION AI CONNECTION SESSION NOTIFY NOTIFYRULES "\
"EVENTRULES LIBRARY LM BAY SLOTTYPE CARTRIDGEGROUP CARTRIDGETYPE "\
"CARTRIDGE CARTRIDGEGROUPAPPLICATION SIDE PARTITION VOLUME DRIVEGROUP "\
"DRIVEGROUPAPPLICATION DRIVE DM DMCAPABILITY DMCAPABILITYTOKEN "\
"DMCAPABILITYDEFAULTTOKEN DMCAPABILITYGROUP DMCAPABILITYGROUPTOKEN "\
"DMBITFORMAT DMBITFORMATTOKEN SLOTGROUP SLOT SLOTCONFIG MOUNTLOGICAL "\
"MOUNTPHYSICAL DRIVECARTRIDGEACCESS TASK TASKCARTRIDGE TASKDRIVE "\
"TASKLIBRARY MESSAGE REQUEST SYSTEM STALEHANDLE DMSHAPEPRIORITY "\
"DMDENSITYPRIORITY DMMOUNTPOINT LIBRARYLIST DRIVELIST CARTRIDGELIST "\
"DRIVECARTRIDGEERROR"
cmd="select * from \\\"MM\\\";"
done
/bin/su - $PGADMIN -c "PGPASSFILE=${PGPASS} ; export PGPASSFILE ; /bin/echo \"$cmd\" | /usr/bin/psql -h $PGHOST -p $PGPORT -d $DBNAME -U $PGUSER -e" 2>&1 | /bin/gzip -f > $OUTDATABASE
echo "------------------- media manager service -----------" >>$REPORT
echo "------------------- watcher service -----------------" >>$REPORT
done
done
done
# all trace
echo "------------------- hostid --------------------------" >>$REPORT
echo "------------------- network info --------------------" >>$REPORT
echo "------------------- ipcs info -----------------------" >>$REPORT
echo "------------------- threadlist of running system ----" >>$REPORT
time/y
lbolt/K
=n"---- utsname ----"
utsname::print
=n"---- threadlist ----"
::threadlist -v
=n"---- function call args ----"
::walk thread | ::findstack ".$c6"
echo "------------------- stack tracebacks ----------------" >>$REPORT
# ps -e only returns 8 characters, so match on first 8.
done
done
if [ "$MMS" = "" ]; then
echo "Sorry, mms_ processes not running.\n" >>$REPORT
fi
echo "------------------- filesystem information ----------" >>$REPORT
# Background this command so it doesn't hang the script
# on file system problems.
sleep 5
sleep 5
if [ -s $TMPBGDF ]; then
else
fi
echo "------------------- ps -edalf -----------------------" >>$REPORT
echo "------------------- iostat --------------------------" >>$REPORT
echo "------------------- mpstat --------------------------" >>$REPORT
echo "------------------- kstat ---------------------------" >>$REPORT
echo "------------------- prstat --------------------------" >>$REPORT
echo "------------------- prtconf -------------------------" >>$REPORT
echo "------------------- core files ----------------------" >>$REPORT
CORE_FILES=""
if [ -d $DIR ]; then
done
fi
else
fi
if [ x"$CORE_FILES" != x ]; then
else
fi
done
if [ -f /core ]; then
ONLINE_CORE_FILES="$ONLINE_CORE_FILES /core"
fi
echo "------------------- core file stack tracebacks ------" >>$REPORT
done
echo "------------------- system panic dumps --------------" >>$REPORT
dumpdir=`/usr/sbin/dumpadm | /bin/grep "core dir" | /bin/sed -e "s/Savecore directory: //" | /bin/awk '{print $1}'`
enabled=`/usr/sbin/dumpadm | /bin/grep "core ena" | /bin/sed -e "s/Savecore enabled: //" | /bin/awk '{print $1}'`
if [ -n "$enabled" ]; then
if [ $enabled = "no" ]; then
fi
fi
if [ -n "$dumpdir" ]; then
do
# Only process vmcores that match the running Solaris release.
if [ $SOL_VER = $VM_SOL_VER ]; then
time/y
lbolt/K
=n"---- utsname ----"
utsname::print
=n"---- panic string ----"
*panicstr/s
=n"----panic_regs/2K----"
panic_regs/2K
=n"---- stack traceback ----"
$c
=n"---- stack traceback verbose----"
$C
=n"---- message buffer ----"
$<msgbuf
=n"---- threadlist ----"
::threadlist -v
=n"---- function call args ----"
::walk thread | ::findstack ".$c6"
fi
done
fi
echo " " >>$REPORT
echo "------------------- THE END -------------------------" >>$REPORT
echo " "
echo " "
echo " "
echo "The following files should now be ftp'ed to your support provider"
echo "as ftp type binary."
echo " "
#
# Use the following syntax for the report name in order to echo
# any unspecified dot slash for the path.
#
if [ $TGZ = "ON" ]; then
echo "${REPORTDIR}/${REPORTNAME}.tar.gz"
else
echo "${REPORTDIR}/${REPORTNAME}"
fi
if [ -s $file ]; then
if [ $TGZ = "ON" ]; then
else
echo "$file"
fi
fi
done
echo " "
if [ $TGZ = "ON" ]; then
(
cd $REPORTDIR
chmod 555 ${REPORTNAME}.tar
/bin/gzip ${REPORTNAME}.tar
)
fi
if [ x"$ONLINE_CORE_FILES" != x ]; then
echo "This script found the following core files. Please ftp them as"
echo "binary files to your support provider only if they appear to be"
echo "from the MMS product."
echo " "
echo
done
fi