#!/bin/sh # #a PATH=/usr/bin:/etc:/usr/opt/SUNWmd/sbin export PATH HOST=`uname -n` #EMAIL="sds-survey@harbor.net" EMAIL="kinscoe@cbis.com" BOUNDARY=`date "+--------------------------------%a_%b_%e_%T_%Z_%Y--"` HEADER="X-Mailer: Harbor SDS Survey 0.0 Subject: SDS Survey Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary=\"$BOUNDARY\" This is a multipart MIME message. " file=/tmp/sds-survey rm -f $file MSG=" This shell script records the SDS, disk, and storage related system configuration. It is a read-only operation, making no temporary or permanent configuration changes whatsoever. However, it still must be run as root because certain utilities require root priviledge. It does create a file, $file, which contains the configuration data in plain text. Please feel free to review it for your own peace of mind. The data file is a MIME formatted message to make utilizing data easier when it is returned via email. The commands executed and their flags are: uname -n - Used strictly to name the dataset metastat - Collect the local diskset config metastat -s \$setname - Run for each metaset found prtvtoc /dev/rdsk/\$diskname - Run for each disk found mount - To find out if the system is rooted swap -l - To identify disk suite swap devs prtconf - To classify the data according server class " echo "$MSG" ans=`ckyorn -d "y" -p "Do you want to continue? (default: yes)"` || exit $? ans=`echo $ans | tr '[:upper:]' '[:lower:]'` if [ "$ans" = "n" -o "$ans" = "no" ] then exit 1 fi printf "\nThis may take a minute or two depending on the size of your server\n" printf "and configuration. Please be patient.\n" # Save stdout and stderr prior to setting them to the data file exec 4>&1 5>&2 1> $file 2>&1 echo "$HEADER" printf "--$BOUNDARY\n" printf "Content-Type: survey/nodename\n" printf "Content-Name: $HOST\n" printf "Content-Description: SDS Survey Information for $HOST\n\n" # # Collect SDS info, including any and all disksets. # printf "--$BOUNDARY\n" printf "Content-Type: survey/sds; charset=us-ascii\n" printf "Content-Name: $HOST/sds\n" printf "Content-Description: SDS Configuration\n\n" printf "localset: Diskset\n\n" metastat sets=`metaset | awk '{if ($3=="=") {split($4,a,",");print a[1]}}' 2>/dev/null` for s in $sets; do printf "$s: Diskset\n\n" metastat -s $s done printf "\n" # # Collect all disk VTOC's # printf "--$BOUNDARY\n" printf "Content-Type: survey/disk; charset=us-ascii\n" printf "Content-Name: $HOST/disk\n" printf "Content-Description: Disk Configuration\n\n" disks=`ls /dev/rdsk/c*s2 2> /dev/null` for d in $disks; do printf "\n`basename $d`: Disk\n\n" prtvtoc $d done printf "\n" # # Collect basic host info to put this data in context # printf "--$BOUNDARY\n" printf "Content-Type: survey/host; charset=us-ascii\n" printf "Content-Name: $HOST/host\n" printf "Content-Description: Host Information\n\n" printf "$HOST: Host info\n\n" mount printf "\n" swap -l printf "\n" prtconf printf "\n" # Done! # Restore stdout and stderr exec 1>&4 2>&5 printf "\nPlease send the file $file, to $EMAIL. Thank-you.\n\n" printf " mail $EMAIL < $file\n\n" /bin/cat $file | /usr/ucb/mail -s "sds survey" $email exit 0