#!/usr/bin/ksh
# Purpose : Script to collect data before any change on UNIX system
#
#--------------------------------------------------------------------
#
PATH=$PATH:/usr/contrib/bin
HOMEROOT=`grep "^root:" /etc/passwd|cut -d: -f6`
v=$(uname -s)
case $v in
HP-UX) VENDOR=HP ;;
SunOS) VENDOR=Sun ;;
OSF1) VENDOR=Compaq ;;
Linux) VENDOR=Linux ;;
AIX) VENDOR=IBM ;;
esac
#
TIME=`date +%d_%m:%H_%M`
#
mkdir $HOMEROOT/CRQ/collected_data_$TIME
#
# Commands that can run on any flavour
#
ps -ef > $HOMEROOT/CRQ/collected_data_$TIME/ps.txt
ps -ef|grep pmon > $HOMEROOT/CRQ/collected_data_$TIME/pmon.txt
who > $HOMEROOT/CRQ/collected_data_$TIME/who.txt
uptime > $HOMEROOT/CRQ/collected_data_$TIME/uptime.txt
netstat -nvr > $HOMEROOT/CRQ/collected_data_$TIME/netstatnr.txt
netstat -ni > $HOMEROOT/CRQ/collected_data_$TIME/netstatni.txt
netstat -n > $HOMEROOT/CRQ/collected_data_$TIME/netstatn.txt
ntpq -p > $HOMEROOT/CRQ/collected_data_$TIME/ntpq.txt
vmstat 2 5 > $HOMEROOT/CRQ/collected_data_$TIME/vmstat.txt
cp /etc/hosts $HOMEROOT/CRQ/collected_data_$TIME/hosts.txt
if [ -f /etc/pam.conf ]
then
cp /etc/pam.conf $HOMEROOT/CRQ/collected_data_$TIME/pam.conf
fi
if [ -f /opt/VRTSvcs/bin/hastatus ]
then
/opt/VRTSvcs/bin/hastatus -summ > $HOMEROOT/CRQ/collected_data_$TIME/hastatus.txt
else
echo VCS is not running > $HOMEROOT/CRQ/collected_data_$TIME/hastatus.txt
fi
#
if [ "$VENDOR" = "HP" ]
then
# collect data
/opt/ignite/bin/print_manifest > $HOMEROOT/CRQ/collected_data_$TIME/print_manifest.txt
swlist -l fileset -a state |grep -v config |grep -v ^# > $HOMEROOT/CRQ/collected_data_$TIME/swlist_state.txt
bdf > $HOMEROOT/CRQ/collected_data_$TIME/bdf.txt
ioscan -fn > $HOMEROOT/CRQ/collected_data_$TIME/ioscan.txt
version=`uname -r`
if [ "$version" = "B.11.31" ]
then
ioscan -m dsf > $HOMEROOT/CRQ/collected_data_$TIME/ioscan_dsf.txt
fi
swlist > $HOMEROOT/CRQ/collected_data_$TIME/swlist.txt
swapinfo > $HOMEROOT/CRQ/collected_data_$TIME/swapinfo.txt
# ps -ef > $HOMEROOT/CRQ/collected_data_$TIME/ps.txt
# who > $HOMEROOT/CRQ/collected_data_$TIME/who.txt
# uptime > $HOMEROOT/CRQ/collected_data_$TIME/uptime.txt
vgdisplay -v > $HOMEROOT/CRQ/collected_data_$TIME/vgdisplay.txt
icmcld=`grep cmcld $HOMEROOT/CRQ/collected_data_$TIME/ps.txt|wc -l`
if [ -f /etc/mail/sendmail.cf ]
then
cp /etc/mail/sendmail.cf $HOMEROOT/CRQ/collected_data_$TIME/sendmail.cf
fi
cp /etc/rc.log $HOMEROOT/CRQ/collected_data_$TIME/rc.log
cp /etc/fstab $HOMEROOT/CRQ/collected_data_$TIME/fstab
#
# Veritas
ivxconfigd=`grep vxconfigd $HOMEROOT/CRQ/collected_data_$TIME/ps.txt|wc -l`
if [ "ivxconfigd" -ne 0 ]
then
vxdisk list > $HOMEROOT/CRQ/collected_data_$TIME/vxdisk_list.txt
vxdmpadm listctlr all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_listctlr.txt
vxdmpadm getsubpaths all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_getsubpaths.txt
vxprint -hAt > $HOMEROOT/CRQ/collected_data_$TIME/vxprint.txt
vxlicrep > $HOMEROOT/CRQ/collected_data_$TIME/vxlicrep.txt
else
echo "vxconfigd not running" > $HOMEROOT/CRQ/collected_data_$TIME/vxdisk_list.txt
fi
#
setboot > $HOMEROOT/CRQ/collected_data_$TIME/setboot.txt
lvlnboot -v > $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.txt
#
#
#
if [ "icmcld" -ne 0 ]
then
/usr/sbin/cmviewcl > $HOMEROOT/CRQ/collected_data_$TIME/cmviewcl.txt
else
echo cmcld is not running so no service guard > $HOMEROOT/CRQ/collected_data_$TIME/cmviewcl.txt
fi
#
# Error checking highlight!
#
# Check for software that is not configured.
istates=`cat $HOMEROOT/CRQ/collected_data_$TIME/swlist_state.txt |wc -l`
if [ "istates" -gt 1 ]
then
echo "Warning some sofware is not configured !!!!"
echo " please check and configure"
cat $HOMEROOT/CRQ/collected_data_$TIME/swlist_state.txt
fi
#
# Check boot and lvlnboot is the same
grep bootpath $HOMEROOT/CRQ/collected_data_$TIME/setboot.txt|grep -v "HA" |awk '{print $4}' > $HOMEROOT/CRQ/collected_data_$TIME/set_boot.chk
grep "Boot Disk" $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.txt |awk '{print $2}'|sed "s/(//" |sed "s/)//" > $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.chk
diff $HOMEROOT/CRQ/collected_data_$TIME/set_boot.chk $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.chk >> /dev/null
if [ $? -ne 0 ]
then
echo "Error Bootpaths for setboot and lvlnboot are different stop change !!!!"
fi
#
#
#
grep "Boot: " $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.txt >> /dev/null
if [ $? -ne 0 ]
then
echo ""
echo "No boot in lvlnboot on lvol1 stop change !!!!"
echo ""
fi
#
#
#
if [ -f /usr/sbin/vparstatus ]
then
/usr/sbin/vparstatus > $HOMEROOT/CRQ/collected_data_$TIME/vparstatus.txt 2>&1
fi
if [ -f /usr/sbin/parstatus ]
then
/usr/sbin/parstatus > $HOMEROOT/CRQ/collected_data_$TIME/parstatus.txt 2>&1
fi
#
#
UNIX95=1 ps -e -o vsz,pid,ppid,user,args | sort -rn | head > $HOMEROOT/CRQ/collected_data_$TIME/highest_mem_proc.txt
UNIX95=1 ps -e -o pcpu,pid,ppid,user,args | sort -rn | head > $HOMEROOT/CRQ/collected_data_$TIME/highest_cpu_proc.txt
#
# Run check for Solaris systems
#
elif [ "$VENDOR" = "Sun" ]
then
# if [ -x $HOME/gloverm/hardwware-checks.ksh ]
# then
# $HOME/gloverm/hardwware-checks.ksh -q
# fi
/usr/platform/`uname -i`/sbin/prtdiag -v > $HOMEROOT/CRQ/collected_data_$TIME/prtdiag.txt
grep "failed " $HOMEROOT/CRQ/collected_data_$TIME/prtdiag.txt >> /dev/null
if [ $? -eq 0 ]
then
echo ""
echo "Fault found in prtdiag please check before doing any work !!!!"
echo ""
fi
ifconfig -a > $HOMEROOT/CRQ/collected_data_$TIME/ifconfig_a.txt
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
iostat -En > $HOMEROOT/CRQ/collected_data_$TIME/iostat.txt
#
#
if [ -x /usr/sbin/vxprint ]
then
/usr/sbin/vxprint -hAt > $HOMEROOT/CRQ/collected_data_$TIME/vxprint.txt
fi
#
if [ -x /usr/bin/kstat ]
then
/usr/bin/kstat -p > $HOMEROOT/CRQ/collected_data_$TIME/kstat.txt
fi
#
# if [ -x /usr/bin/mdb ]
# then
# echo "::memstat" | /usr/bin/mdb -k > $HOMEROOT/CRQ/collected_data_$TIME/mdb_memstat.txt
# fi
#
if [ -x /usr/sbin/zpool ]
then
zpool status > $HOMEROOT/CRQ/collected_data_$TIME/zpool_status.txt
zfs list > $HOMEROOT/CRQ/collected_data_$TIME/zfs_list.txt
fi
#
if [ -x /sbin/vxlicrep ]
then
/sbin/vxlicrep > $HOMEROOT/CRQ/collected_data_$TIME/vxlicrep.txt
iexp_veritas=`grep -i EXPI $HOMEROOT/CRQ/collected_data_$TIME/vxlicrep.txt |wc -l`
if [ "iexp_veritas" -gt 1 ]
then
echo "STOP VERITAS lincese has expired !!!"
echo "STOP VERITAS lincese has expired !!!"
echo "STOP VERITAS lincese has expired !!!"
fi
fi
#
if [ -x /usr/sbin/vxdisk ]
then
/usr/sbin/vxdisk list > $HOMEROOT/CRQ/collected_data_$TIME/vxdisk_list.txt
fi
#
# if [ -x /usr/sbin/vxdmpadm ]
# then
#vxdmpadm listctlr all |grep -v "=====" |grep -v "CTLR-NAME ENCLR-TYPE" |awk '{print "vxdmpadm getdmpnode enclosure=" $4}' > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_listctlr_all.txt
# fi
#
if [ -x /usr/sbin/zoneadm ]
then
/usr/sbin/zoneadm list -vc > $HOMEROOT/CRQ/collected_data_$TIME/zoneadm_list.txt
fi
#
if [ -x /usr/bin/svcs ]
then
svcs -a > $HOMEROOT/CRQ/collected_data_$TIME/svcs.txt
svcs -xv > $HOMEROOT/CRQ/collected_data_$TIME/svcs_xv.txt
fi
#
if [ -x /usr/sbin/metastat ]
then
metastat > $HOMEROOT/CRQ/collected_data_$TIME/metastat.txt
fi
if [ -f /etc/mail/sendmail.cf ]
then
cp /etc/mail/sendmail.cf $HOMEROOT/CRQ/collected_data_$TIME/sendmail.cf
fi
if [ -f /etc/mail/submit.cf ]
then
cp /etc/mail/submit.cf $HOMEROOT/CRQ/collected_data_$TIME/submit.cf
fi
cp /etc/vfstab $HOMEROOT/CRQ/collected_data_$TIME/vfstab
cp /etc/hostname.* $HOMEROOT/CRQ/collected_data_$TIME/
if [ -f /etc/project ]
then
cp /etc/project $HOMEROOT/CRQ/collected_data_$TIME/project
fi
if [ -f /etc/nodename ]
then
cp /etc/nodename $HOMEROOT/CRQ/collected_data_$TIME/
fi
if [ -f /etc/netmasks ]
then
cp /etc/netmasks $HOMEROOT/CRQ/collected_data_$TIME/
fi
eeprom > $HOMEROOT/CRQ/collected_data_$TIME/eprom.txt
prtconf -vp > $HOMEROOT/CRQ/collected_data_$TIME/prtconf-vp.txt
echo |format > $HOMEROOT/CRQ/collected_data_$TIME/format.txt 2>&1
if [ `grep diag-switch?=true $HOMEROOT/CRQ/collected_data_$TIME/eprom.txt` ]
then
echo "Warning can cause problems with live upgrade"
echo "diag-switch?=true !!!!!"
echo "Warning can cause problesm with live upgrade"
fi
#
if [ -x /usr/cluster/bin/cluster ]
then
/usr/cluster/bin/cluster status > $HOMEROOT/CRQ/collected_data_$TIME/cluster_status.txt
/usr/cluster/bin/clrg status > $HOMEROOT/CRQ/collected_data_$TIME/clrg_status.txt
fi
if [ -x /usr/cluster/bin/scstat ]
then
echo " "
echo " Warning - this is a SUN CLUSTER !!!!!!!!!! "
echo " "
/usr/cluster/bin/scstat -q > $HOMEROOT/CRQ/collected_data_$TIME/scstat-q.txt
/usr/cluster/bin/scstat -n > $HOMEROOT/CRQ/collected_data_$TIME/scstat-n.txt
/usr/cluster/bin/scstat -g > $HOMEROOT/CRQ/collected_data_$TIME/scstat-g.txt
/usr/cluster/bin/scstat -D > $HOMEROOT/CRQ/collected_data_$TIME/scstat-D.txt
# /usr/cluster/bin/scstat > $HOMEROOT/CRQ/collected_data_$TIME/scstat_status.txt
fi
if [ -x /usr/cluster/bin/scinstall ]
then
/usr/cluster/bin/scinstall -pv > $HOMEROOT/CRQ/collected_data_$TIME/scinstall.txt
fi
if [ -x /usr/sbin/cfgadm ]
then
/usr/sbin/cfgadm -al > $HOMEROOT/CRQ/collected_data_$TIME/cfgadm.txt
/usr/sbin/cfgadm -vl > $HOMEROOT/CRQ/collected_data_$TIME/cfgadm_v.txt
fi
if [ -x /usr/sbin/fcinfo ]
then
/usr/sbin/fcinfo hba-port > $HOMEROOT/CRQ/collected_data_$TIME/fcinfo.txt
fi
#
# Checks for TRU64
#
elif [ "$VENDOR" = "Compaq" ]
then
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
scu show edt > $HOMEROOT/CRQ/collected_data_$TIME/scu.txt
if [ -x /sbin/hwmgr ]
then
/sbin/hwmgr view cluster > $HOMEROOT/CRQ/collected_data_$TIME/hwmgr_view_cluster.txt
/sbin/hwmgr view devices -cluster > $HOMEROOT/CRQ/collected_data_$TIME/hwmgr_view_devices.txt
fi
if [ -x /sbin/voldisk ]
then
/sbin/voldisk list > $HOMEROOT/CRQ/collected_data_$TIME/voldisk.txt
/sbin/volprint -hAt > $HOMEROOT/CRQ/collected_data_$TIME/volprint.txt
fi
#
# Run checks for Linux systems
#
elif [ "$VENDOR" = "Linux" ]
then
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
#Get tape dev info mmg
find /sys -name tape* >$HOMEROOT/CRQ/collected_data_$TIME/tapes.txt
#get installed packets mmg
rpm -qa >$HOMEROOT/CRQ/collected_data_$TIME/rpm_a.txt
# ifconif
ifconfig > $HOMEROOT/CRQ/collected_data_$TIME/ifconfig.txt
#Get kernel settings mmg
sysctl -a >$HOMEROOT/CRQ/collected_data_$TIME/sysclt_a.txt
#Get mirror config mmg
if [ /usr/sbin/hpacucli ]; then
hpacucli ctrl all show status >$HOMEROOT/CRQ/collected_data_$TIME/hp_disks_status.txt
hpacucli ctrl all show config >>$HOMEROOT/CRQ/collected_data_$TIME/hp_disks_status.txt
fi
#Check Multipath is running mmg
# chkconfig --list multipathd |grep on >/dev/null || echo "Warning multipathd not enabled"
# service multipathd status >/dev/null || echo "WARNING mulitpathd stopped"
#Update by mmg 20121107
/sbin/service multipathd status >/dev/null && /sbin/multipath -ll >$HOMEROOT/CRQ/collected_data_$TIME/multipath_disk_status.txt
[ -f /sbin/vxdmpadm ] && /sbin/vxdmpadm getsubpaths all >>$HOMEROOT/CRQ/collected_data_$TIME/multipath_disk_status.txt
#
#
#
fdisk -l > $HOMEROOT/CRQ/collected_data_$TIME/fdisk_disk_status.txt 2>&1
vgdisplay -v > $HOMEROOT/CRQ/collected_data_$TIME/vgdisplay_status.txt 2>&1
elif [ "$VENDOR" = "IBM" ]
then
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
if [ -x /usr/es/sbin/cluster/utilities/clRGinfo ]
then
/usr/es/sbin/cluster/utilities/clRGinfo > $HOMEROOT/CRQ/collected_data_$TIME/clRGinfo.txt
fi
lspv > $HOMEROOT/CRQ/collected_data_$TIME/lspv.txt
lsdev -Cc disk > $HOMEROOT/CRQ/collected_data_$TIME/lsdev_disk.txt
lsvg -o > $HOMEROOT/CRQ/collected_data_$TIME/lsvg.txt
lsdev -Cc adapter > $HOMEROOT/CRQ/collected_data_$TIME/lsdev_adapter.txt
errpt > $HOMEROOT/CRQ/collected_data_$TIME/errpt.txt
df -g > $HOMEROOT/CRQ/collected_data_$TIME/df_g.txt
cp /etc/filesystems $HOMEROOT/CRQ/collected_data_$TIME/filesystems
mount > $HOMEROOT/CRQ/collected_data_$TIME/mount.txt
if [ -x /usr/sbin/vxdmpadm ]
then
/usr/sbin/vxdmpadm listctlr all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_listctlr.txt
/usr/sbin/vxdmpadm getsubpaths all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_getsubpaths.txt
fi
fi
#
#Check number of days its been up for
#
PERIOD=`uptime|awk '{print $4}'|cut -c1-3`
days=` uptime |awk '{print $3}'`
if [ $PERIOD = "day" ]
then
if [ $days -gt 180 ]
then
echo "Box has been for over 180 days please reboot before patching"
fi
fi
#
#
uname -a > $HOMEROOT/CRQ/collected_data_$TIME/uname_a.txt
cp /etc/group $HOMEROOT/CRQ/collected_data_$TIME/group
cp /etc/passwd $HOMEROOT/CRQ/collected_data_$TIME/passwd
#
tar -cf collect_info.tar $HOMEROOT/CRQ/collected_data_$TIME
gzip -f collect_info.tar
exit 0
# Purpose : Script to collect data before any change on UNIX system
#
#--------------------------------------------------------------------
#
PATH=$PATH:/usr/contrib/bin
HOMEROOT=`grep "^root:" /etc/passwd|cut -d: -f6`
v=$(uname -s)
case $v in
HP-UX) VENDOR=HP ;;
SunOS) VENDOR=Sun ;;
OSF1) VENDOR=Compaq ;;
Linux) VENDOR=Linux ;;
AIX) VENDOR=IBM ;;
esac
#
TIME=`date +%d_%m:%H_%M`
#
mkdir $HOMEROOT/CRQ/collected_data_$TIME
#
# Commands that can run on any flavour
#
ps -ef > $HOMEROOT/CRQ/collected_data_$TIME/ps.txt
ps -ef|grep pmon > $HOMEROOT/CRQ/collected_data_$TIME/pmon.txt
who > $HOMEROOT/CRQ/collected_data_$TIME/who.txt
uptime > $HOMEROOT/CRQ/collected_data_$TIME/uptime.txt
netstat -nvr > $HOMEROOT/CRQ/collected_data_$TIME/netstatnr.txt
netstat -ni > $HOMEROOT/CRQ/collected_data_$TIME/netstatni.txt
netstat -n > $HOMEROOT/CRQ/collected_data_$TIME/netstatn.txt
ntpq -p > $HOMEROOT/CRQ/collected_data_$TIME/ntpq.txt
vmstat 2 5 > $HOMEROOT/CRQ/collected_data_$TIME/vmstat.txt
cp /etc/hosts $HOMEROOT/CRQ/collected_data_$TIME/hosts.txt
if [ -f /etc/pam.conf ]
then
cp /etc/pam.conf $HOMEROOT/CRQ/collected_data_$TIME/pam.conf
fi
if [ -f /opt/VRTSvcs/bin/hastatus ]
then
/opt/VRTSvcs/bin/hastatus -summ > $HOMEROOT/CRQ/collected_data_$TIME/hastatus.txt
else
echo VCS is not running > $HOMEROOT/CRQ/collected_data_$TIME/hastatus.txt
fi
#
if [ "$VENDOR" = "HP" ]
then
# collect data
/opt/ignite/bin/print_manifest > $HOMEROOT/CRQ/collected_data_$TIME/print_manifest.txt
swlist -l fileset -a state |grep -v config |grep -v ^# > $HOMEROOT/CRQ/collected_data_$TIME/swlist_state.txt
bdf > $HOMEROOT/CRQ/collected_data_$TIME/bdf.txt
ioscan -fn > $HOMEROOT/CRQ/collected_data_$TIME/ioscan.txt
version=`uname -r`
if [ "$version" = "B.11.31" ]
then
ioscan -m dsf > $HOMEROOT/CRQ/collected_data_$TIME/ioscan_dsf.txt
fi
swlist > $HOMEROOT/CRQ/collected_data_$TIME/swlist.txt
swapinfo > $HOMEROOT/CRQ/collected_data_$TIME/swapinfo.txt
# ps -ef > $HOMEROOT/CRQ/collected_data_$TIME/ps.txt
# who > $HOMEROOT/CRQ/collected_data_$TIME/who.txt
# uptime > $HOMEROOT/CRQ/collected_data_$TIME/uptime.txt
vgdisplay -v > $HOMEROOT/CRQ/collected_data_$TIME/vgdisplay.txt
icmcld=`grep cmcld $HOMEROOT/CRQ/collected_data_$TIME/ps.txt|wc -l`
if [ -f /etc/mail/sendmail.cf ]
then
cp /etc/mail/sendmail.cf $HOMEROOT/CRQ/collected_data_$TIME/sendmail.cf
fi
cp /etc/rc.log $HOMEROOT/CRQ/collected_data_$TIME/rc.log
cp /etc/fstab $HOMEROOT/CRQ/collected_data_$TIME/fstab
#
# Veritas
ivxconfigd=`grep vxconfigd $HOMEROOT/CRQ/collected_data_$TIME/ps.txt|wc -l`
if [ "ivxconfigd" -ne 0 ]
then
vxdisk list > $HOMEROOT/CRQ/collected_data_$TIME/vxdisk_list.txt
vxdmpadm listctlr all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_listctlr.txt
vxdmpadm getsubpaths all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_getsubpaths.txt
vxprint -hAt > $HOMEROOT/CRQ/collected_data_$TIME/vxprint.txt
vxlicrep > $HOMEROOT/CRQ/collected_data_$TIME/vxlicrep.txt
else
echo "vxconfigd not running" > $HOMEROOT/CRQ/collected_data_$TIME/vxdisk_list.txt
fi
#
setboot > $HOMEROOT/CRQ/collected_data_$TIME/setboot.txt
lvlnboot -v > $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.txt
#
#
#
if [ "icmcld" -ne 0 ]
then
/usr/sbin/cmviewcl > $HOMEROOT/CRQ/collected_data_$TIME/cmviewcl.txt
else
echo cmcld is not running so no service guard > $HOMEROOT/CRQ/collected_data_$TIME/cmviewcl.txt
fi
#
# Error checking highlight!
#
# Check for software that is not configured.
istates=`cat $HOMEROOT/CRQ/collected_data_$TIME/swlist_state.txt |wc -l`
if [ "istates" -gt 1 ]
then
echo "Warning some sofware is not configured !!!!"
echo " please check and configure"
cat $HOMEROOT/CRQ/collected_data_$TIME/swlist_state.txt
fi
#
# Check boot and lvlnboot is the same
grep bootpath $HOMEROOT/CRQ/collected_data_$TIME/setboot.txt|grep -v "HA" |awk '{print $4}' > $HOMEROOT/CRQ/collected_data_$TIME/set_boot.chk
grep "Boot Disk" $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.txt |awk '{print $2}'|sed "s/(//" |sed "s/)//" > $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.chk
diff $HOMEROOT/CRQ/collected_data_$TIME/set_boot.chk $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.chk >> /dev/null
if [ $? -ne 0 ]
then
echo "Error Bootpaths for setboot and lvlnboot are different stop change !!!!"
fi
#
#
#
grep "Boot: " $HOMEROOT/CRQ/collected_data_$TIME/lvlnboot.txt >> /dev/null
if [ $? -ne 0 ]
then
echo ""
echo "No boot in lvlnboot on lvol1 stop change !!!!"
echo ""
fi
#
#
#
if [ -f /usr/sbin/vparstatus ]
then
/usr/sbin/vparstatus > $HOMEROOT/CRQ/collected_data_$TIME/vparstatus.txt 2>&1
fi
if [ -f /usr/sbin/parstatus ]
then
/usr/sbin/parstatus > $HOMEROOT/CRQ/collected_data_$TIME/parstatus.txt 2>&1
fi
#
#
UNIX95=1 ps -e -o vsz,pid,ppid,user,args | sort -rn | head > $HOMEROOT/CRQ/collected_data_$TIME/highest_mem_proc.txt
UNIX95=1 ps -e -o pcpu,pid,ppid,user,args | sort -rn | head > $HOMEROOT/CRQ/collected_data_$TIME/highest_cpu_proc.txt
#
# Run check for Solaris systems
#
elif [ "$VENDOR" = "Sun" ]
then
# if [ -x $HOME/gloverm/hardwware-checks.ksh ]
# then
# $HOME/gloverm/hardwware-checks.ksh -q
# fi
/usr/platform/`uname -i`/sbin/prtdiag -v > $HOMEROOT/CRQ/collected_data_$TIME/prtdiag.txt
grep "failed " $HOMEROOT/CRQ/collected_data_$TIME/prtdiag.txt >> /dev/null
if [ $? -eq 0 ]
then
echo ""
echo "Fault found in prtdiag please check before doing any work !!!!"
echo ""
fi
ifconfig -a > $HOMEROOT/CRQ/collected_data_$TIME/ifconfig_a.txt
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
iostat -En > $HOMEROOT/CRQ/collected_data_$TIME/iostat.txt
#
#
if [ -x /usr/sbin/vxprint ]
then
/usr/sbin/vxprint -hAt > $HOMEROOT/CRQ/collected_data_$TIME/vxprint.txt
fi
#
if [ -x /usr/bin/kstat ]
then
/usr/bin/kstat -p > $HOMEROOT/CRQ/collected_data_$TIME/kstat.txt
fi
#
# if [ -x /usr/bin/mdb ]
# then
# echo "::memstat" | /usr/bin/mdb -k > $HOMEROOT/CRQ/collected_data_$TIME/mdb_memstat.txt
# fi
#
if [ -x /usr/sbin/zpool ]
then
zpool status > $HOMEROOT/CRQ/collected_data_$TIME/zpool_status.txt
zfs list > $HOMEROOT/CRQ/collected_data_$TIME/zfs_list.txt
fi
#
if [ -x /sbin/vxlicrep ]
then
/sbin/vxlicrep > $HOMEROOT/CRQ/collected_data_$TIME/vxlicrep.txt
iexp_veritas=`grep -i EXPI $HOMEROOT/CRQ/collected_data_$TIME/vxlicrep.txt |wc -l`
if [ "iexp_veritas" -gt 1 ]
then
echo "STOP VERITAS lincese has expired !!!"
echo "STOP VERITAS lincese has expired !!!"
echo "STOP VERITAS lincese has expired !!!"
fi
fi
#
if [ -x /usr/sbin/vxdisk ]
then
/usr/sbin/vxdisk list > $HOMEROOT/CRQ/collected_data_$TIME/vxdisk_list.txt
fi
#
# if [ -x /usr/sbin/vxdmpadm ]
# then
#vxdmpadm listctlr all |grep -v "=====" |grep -v "CTLR-NAME ENCLR-TYPE" |awk '{print "vxdmpadm getdmpnode enclosure=" $4}' > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_listctlr_all.txt
# fi
#
if [ -x /usr/sbin/zoneadm ]
then
/usr/sbin/zoneadm list -vc > $HOMEROOT/CRQ/collected_data_$TIME/zoneadm_list.txt
fi
#
if [ -x /usr/bin/svcs ]
then
svcs -a > $HOMEROOT/CRQ/collected_data_$TIME/svcs.txt
svcs -xv > $HOMEROOT/CRQ/collected_data_$TIME/svcs_xv.txt
fi
#
if [ -x /usr/sbin/metastat ]
then
metastat > $HOMEROOT/CRQ/collected_data_$TIME/metastat.txt
fi
if [ -f /etc/mail/sendmail.cf ]
then
cp /etc/mail/sendmail.cf $HOMEROOT/CRQ/collected_data_$TIME/sendmail.cf
fi
if [ -f /etc/mail/submit.cf ]
then
cp /etc/mail/submit.cf $HOMEROOT/CRQ/collected_data_$TIME/submit.cf
fi
cp /etc/vfstab $HOMEROOT/CRQ/collected_data_$TIME/vfstab
cp /etc/hostname.* $HOMEROOT/CRQ/collected_data_$TIME/
if [ -f /etc/project ]
then
cp /etc/project $HOMEROOT/CRQ/collected_data_$TIME/project
fi
if [ -f /etc/nodename ]
then
cp /etc/nodename $HOMEROOT/CRQ/collected_data_$TIME/
fi
if [ -f /etc/netmasks ]
then
cp /etc/netmasks $HOMEROOT/CRQ/collected_data_$TIME/
fi
eeprom > $HOMEROOT/CRQ/collected_data_$TIME/eprom.txt
prtconf -vp > $HOMEROOT/CRQ/collected_data_$TIME/prtconf-vp.txt
echo |format > $HOMEROOT/CRQ/collected_data_$TIME/format.txt 2>&1
if [ `grep diag-switch?=true $HOMEROOT/CRQ/collected_data_$TIME/eprom.txt` ]
then
echo "Warning can cause problems with live upgrade"
echo "diag-switch?=true !!!!!"
echo "Warning can cause problesm with live upgrade"
fi
#
if [ -x /usr/cluster/bin/cluster ]
then
/usr/cluster/bin/cluster status > $HOMEROOT/CRQ/collected_data_$TIME/cluster_status.txt
/usr/cluster/bin/clrg status > $HOMEROOT/CRQ/collected_data_$TIME/clrg_status.txt
fi
if [ -x /usr/cluster/bin/scstat ]
then
echo " "
echo " Warning - this is a SUN CLUSTER !!!!!!!!!! "
echo " "
/usr/cluster/bin/scstat -q > $HOMEROOT/CRQ/collected_data_$TIME/scstat-q.txt
/usr/cluster/bin/scstat -n > $HOMEROOT/CRQ/collected_data_$TIME/scstat-n.txt
/usr/cluster/bin/scstat -g > $HOMEROOT/CRQ/collected_data_$TIME/scstat-g.txt
/usr/cluster/bin/scstat -D > $HOMEROOT/CRQ/collected_data_$TIME/scstat-D.txt
# /usr/cluster/bin/scstat > $HOMEROOT/CRQ/collected_data_$TIME/scstat_status.txt
fi
if [ -x /usr/cluster/bin/scinstall ]
then
/usr/cluster/bin/scinstall -pv > $HOMEROOT/CRQ/collected_data_$TIME/scinstall.txt
fi
if [ -x /usr/sbin/cfgadm ]
then
/usr/sbin/cfgadm -al > $HOMEROOT/CRQ/collected_data_$TIME/cfgadm.txt
/usr/sbin/cfgadm -vl > $HOMEROOT/CRQ/collected_data_$TIME/cfgadm_v.txt
fi
if [ -x /usr/sbin/fcinfo ]
then
/usr/sbin/fcinfo hba-port > $HOMEROOT/CRQ/collected_data_$TIME/fcinfo.txt
fi
#
# Checks for TRU64
#
elif [ "$VENDOR" = "Compaq" ]
then
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
scu show edt > $HOMEROOT/CRQ/collected_data_$TIME/scu.txt
if [ -x /sbin/hwmgr ]
then
/sbin/hwmgr view cluster > $HOMEROOT/CRQ/collected_data_$TIME/hwmgr_view_cluster.txt
/sbin/hwmgr view devices -cluster > $HOMEROOT/CRQ/collected_data_$TIME/hwmgr_view_devices.txt
fi
if [ -x /sbin/voldisk ]
then
/sbin/voldisk list > $HOMEROOT/CRQ/collected_data_$TIME/voldisk.txt
/sbin/volprint -hAt > $HOMEROOT/CRQ/collected_data_$TIME/volprint.txt
fi
#
# Run checks for Linux systems
#
elif [ "$VENDOR" = "Linux" ]
then
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
#Get tape dev info mmg
find /sys -name tape* >$HOMEROOT/CRQ/collected_data_$TIME/tapes.txt
#get installed packets mmg
rpm -qa >$HOMEROOT/CRQ/collected_data_$TIME/rpm_a.txt
# ifconif
ifconfig > $HOMEROOT/CRQ/collected_data_$TIME/ifconfig.txt
#Get kernel settings mmg
sysctl -a >$HOMEROOT/CRQ/collected_data_$TIME/sysclt_a.txt
#Get mirror config mmg
if [ /usr/sbin/hpacucli ]; then
hpacucli ctrl all show status >$HOMEROOT/CRQ/collected_data_$TIME/hp_disks_status.txt
hpacucli ctrl all show config >>$HOMEROOT/CRQ/collected_data_$TIME/hp_disks_status.txt
fi
#Check Multipath is running mmg
# chkconfig --list multipathd |grep on >/dev/null || echo "Warning multipathd not enabled"
# service multipathd status >/dev/null || echo "WARNING mulitpathd stopped"
#Update by mmg 20121107
/sbin/service multipathd status >/dev/null && /sbin/multipath -ll >$HOMEROOT/CRQ/collected_data_$TIME/multipath_disk_status.txt
[ -f /sbin/vxdmpadm ] && /sbin/vxdmpadm getsubpaths all >>$HOMEROOT/CRQ/collected_data_$TIME/multipath_disk_status.txt
#
#
#
fdisk -l > $HOMEROOT/CRQ/collected_data_$TIME/fdisk_disk_status.txt 2>&1
vgdisplay -v > $HOMEROOT/CRQ/collected_data_$TIME/vgdisplay_status.txt 2>&1
elif [ "$VENDOR" = "IBM" ]
then
df -k > $HOMEROOT/CRQ/collected_data_$TIME/df.txt
if [ -x /usr/es/sbin/cluster/utilities/clRGinfo ]
then
/usr/es/sbin/cluster/utilities/clRGinfo > $HOMEROOT/CRQ/collected_data_$TIME/clRGinfo.txt
fi
lspv > $HOMEROOT/CRQ/collected_data_$TIME/lspv.txt
lsdev -Cc disk > $HOMEROOT/CRQ/collected_data_$TIME/lsdev_disk.txt
lsvg -o > $HOMEROOT/CRQ/collected_data_$TIME/lsvg.txt
lsdev -Cc adapter > $HOMEROOT/CRQ/collected_data_$TIME/lsdev_adapter.txt
errpt > $HOMEROOT/CRQ/collected_data_$TIME/errpt.txt
df -g > $HOMEROOT/CRQ/collected_data_$TIME/df_g.txt
cp /etc/filesystems $HOMEROOT/CRQ/collected_data_$TIME/filesystems
mount > $HOMEROOT/CRQ/collected_data_$TIME/mount.txt
if [ -x /usr/sbin/vxdmpadm ]
then
/usr/sbin/vxdmpadm listctlr all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_listctlr.txt
/usr/sbin/vxdmpadm getsubpaths all > $HOMEROOT/CRQ/collected_data_$TIME/vxdmpadm_getsubpaths.txt
fi
fi
#
#Check number of days its been up for
#
PERIOD=`uptime|awk '{print $4}'|cut -c1-3`
days=` uptime |awk '{print $3}'`
if [ $PERIOD = "day" ]
then
if [ $days -gt 180 ]
then
echo "Box has been for over 180 days please reboot before patching"
fi
fi
#
#
uname -a > $HOMEROOT/CRQ/collected_data_$TIME/uname_a.txt
cp /etc/group $HOMEROOT/CRQ/collected_data_$TIME/group
cp /etc/passwd $HOMEROOT/CRQ/collected_data_$TIME/passwd
#
tar -cf collect_info.tar $HOMEROOT/CRQ/collected_data_$TIME
gzip -f collect_info.tar
exit 0
No comments:
Post a Comment