#! /bin/sh # Be sure to ftp in binary mode. # Script for collecting performance data. # Developed on SunOS 5.8 for general platform use. if [ -d PERFORMANCE ] then echo " " echo "Directory PERFORMANCE already exists" echo " " exit 1 fi # For the general UNIX script leave the following # instruction instead of a test for informix user. for i in 0 1 2 3 4 5 6 do echo " " done echo " -------------------------------------" echo " Execute this script as user informix." echo " -------------------------------------" for i in 0 1 2 3 4 do echo " " done echo " " echo "This program collects four sets of onstat outputs. a number of" echo "onstats are run initially. Then the program waits for a user-defined" echo "period (seconds) before collecting the next set of data." echo " " echo "Please enter the PMR number, using periods for separators. For" echo "example, if the PMR is \"11111,111,111\", you would type this:" echo " " echo "11111.111.111" echo " " echo "Type yours and and hit enter:" echo " " read CASENUMBER while [ "$CASENUMBER" = "" ] do echo "You did not enter a PMR. Please enter it now." echo "Otherwise use control-c to interupt." echo " " read CASENUMBER done if [ -f ${CASENUMBER}.perf.zip ] || [ -f ${CASENUMBER}.perf.tar.gz ] then echo "Output file already exists" exit 1 fi echo " " echo "Enter the seconds to sleep between the four sets of onstat \ outputs." echo "The recommended number is 300." echo " " read SLEEP echo " " while [ "$SLEEP" = "" ] do echo "You did not enter the sleep time . Please enter it now." echo "Otherwise use control-c to interupt." echo " " read SLEEP done mkdir PERFORMANCE #if no permissions then exit if [ $? != 0 ] then exit 1 fi mkdir PERFORMANCE/OSCONFIG mkdir PERFORMANCE/OSDATA mkdir PERFORMANCE/INSTANCE mkdir PERFORMANCE/IDSCONFIG echo " " echo "PMR: $CASENUMBER" > PERFORMANCE/INSTANCE/onstats.txt echo "Date: `date`" >> PERFORMANCE/INSTANCE/onstats.txt echo "Collecting OS data .... this may take a few seconds" #OS CONFIG info uname -a > PERFORMANCE/OSCONFIG/uname.txt 2>&1 #OS data uptime > PERFORMANCE/OSDATA/uptime.1 2>&1 ipcs -a > PERFORMANCE/OSDATA/ipcs.1 2>&1 echo " " echo "done" echo " " # Collect an initial set of data. env > PERFORMANCE/IDSCONFIG/env.txt onstat -c > PERFORMANCE/IDSCONFIG/onconfig.txt onstat -d > PERFORMANCE/IDSCONFIG/dbspaces.txt # sqlhosts if grep INFORMIXSQLHOSTS PERFORMANCE/IDSCONFIG/env.txt 1> /dev/null then cp $INFORMIXSQLHOSTS PERFORMANCE/IDSCONFIG/ else cp $INFORMIXDIR/etc/sqlhosts PERFORMANCE/IDSCONFIG/ fi echo " " echo "Sleep time between onstats: $SLEEP seconds." >> \ PERFORMANCE/INSTANCE/onstats.txt #Windows has a problem with name "con.txt" so #add the underscore to each file name. #give onstat -P unique naming because windows does not #distinguish upper case from lower echo "onstat -P" > PERFORMANCE/INSTANCE/P-.txt for i in C m D p F R l u x G b k t ckp glo sql ses session \ ioq iof seg rea act ath cpu tpf mgm mem vpcache \ sts lsc nta lmx wmx cac dic con opn ppf ioa\ spi his stk do touch PERFORMANCE/INSTANCE/${i}_.txt done # Now enter outer LOOP for controlling collection iterations for LOOP in first second third last do echo "Collecting ${LOOP} set of onstat data ....." echo "===================================================" >> \ PERFORMANCE/INSTANCE/P-.txt echo "onstat -P" >> PERFORMANCE/INSTANCE/P-.txt onstat -P >> PERFORMANCE/INSTANCE/P-.txt for i in C m D p F R l u x G b k t do echo "===================================================" >> \ PERFORMANCE/INSTANCE/${i}_.txt echo "onstat -$i" >> PERFORMANCE/INSTANCE/${i}_.txt onstat -$i >> PERFORMANCE/INSTANCE/${i}_.txt done for j in ckp glo sql ses ioq iof seg rea act ath cpu tpf mgm mem \ vpcache sts lsc nta lmx wmx cac dic con opn ppf ioa spi his do echo "===================================================" >> \ PERFORMANCE/INSTANCE/${j}_.txt echo "onstat -g $j" >> PERFORMANCE/INSTANCE/${j}_.txt onstat -g $j >> PERFORMANCE/INSTANCE/${j}_.txt done echo "===================================================" >> \ PERFORMANCE/INSTANCE/session_.txt echo "onstat -g ses 0" >> PERFORMANCE/INSTANCE/session_.txt onstat -g ses 0 >> PERFORMANCE/INSTANCE/session_.txt echo "===================================================" >> \ PERFORMANCE/INSTANCE/stk_.txt echo "onstat -g stk all" >> PERFORMANCE/INSTANCE/stk_.txt onstat -g stk all >> PERFORMANCE/INSTANCE/stk_.txt echo " " echo "done" echo " " if [ $LOOP != last ] then echo "Zeroing the onstats." onstat -z echo "Sleeping $SLEEP seconds before collecting next set of onstats" echo " " sleep $SLEEP echo "done sleeping" echo " " fi done #outer loop ENGINE=`onstat - | awk '{print $6}'` if [ `echo $ENGINE | awk '{FS = "."} {print $1}'` -gt 8 ] then mkdir PERFORMANCE/INSTANCE/PSTACKS # Now collect stacks with onmode, just in case. Note these # go into af files in DUMPDIR. echo " " echo "Now collect stacks on the processes." echo "This may take a minute." echo " " DMP=`onstat -g ras | grep DUMPDIR | awk '{print $2}'` touch $DMP/t.txt for d in 1 2 3 4 5 do for i in `onstat -g glo | grep "^ *[1-9]" | awk '{print $1}'` do onmode -X s $i done sleep 5 done # Get af files with a timestamp later than t.txt. cp `find $DMP -newer $DMP/t.txt | grep af.` PERFORMANCE/INSTANCE/PSTACKS rm $DMP/t.txt fi # collecting stacks echo " " echo "Collecting a last set of OS data, please wait ...." echo " " #Collect a last set of OS data uptime > PERFORMANCE/OSDATA/uptime.2 2>&1 # Clean up and prepare data for submitting to # Technical support # Package up the files. If a zip file cannot # be created, then create and gzip a tar file. zip ${CASENUMBER}.perf.zip -r PERFORMANCE 2> /dev/null if [ ! -f ${CASENUMBER}.perf.zip ] then tar -cvf ${CASENUMBER}.perf.tar PERFORMANCE gzip ${CASENUMBER}.perf.tar fi echo " " echo " " echo " " echo "=========================================================" if [ -f ${CASENUMBER}.perf.zip ] then echo "Please submit file \"${CASENUMBER}.perf.zip\" to" echo "IBM Informix technical support." else if [ -f ${CASENUMBER}.perf.tar.gz ] then echo "Please submit file \"${CASENUMBER}.perf.tar.gz\" to" echo "IBM Informix technical support." else echo "Program did not create file to submit." echo "Please contact IBM Informix technical support." fi fi echo "=========================================================" echo " " rm -fr PERFORMANCE echo " " echo "Program over" echo " " echo "If you have space on your filesystem, please collect a" echo "shared memory dump. The dump will be the same size as" echo "the total size (bytes) in the onstat -g seg output. If" echo "you wish to collect the dump, execute the command:" echo " " echo " onstat -o ${CASENUMBER}.shmem.dmp" echo " "