#!/bin/ksh ############################## # Written by: Matt Baker ############################## # Tested on following: # CPU: Sparc # OS: Solaris 2.X # ##################################################################### # The items retrieved are described below. The data # is stored in each nodes subdir in the CFIG_DIR. # # This program does not negate the need for backups, but does much to # enhance system management by providing: system config, online copies # of important system files, system stats, and license inventory. # # Submitted by: Matthew Baker # Matthew.Baker@med.ge.com # ############################## # ACTIONS: # # -make dirs (if needed) # -uncompress files (if needed) # -get mount point ls's # -get arrays # -get stats # -get perf # -get ps # -get package info # -get opt list # -get network # -get disks # -get metadata (/dev/md) # -get volume info (vx) # -get veritas cluster # -get DR and AP configs # -get EMC # -get printers # -get init files # -get files # -get kernels # -compress files # ############################## ###################################################### #****** You must enter save directoriy here**********# ###################################################### # set CFIG_DIR later in the file, search CFIG_DIR= DMZ_SERVERS="barium coyote dacs1 ftp100 ftp900 husky hyena mdf2 puma reuters1 reuters2 scorpion thud tiger vulture" NODE=$(hostname) FILES=" /.cshrc /.dtprofile /.kshrc /.forward /.login /.kshrc /.kshrc_local /.profile /.profile_local /.defaults /.rhosts /.xinitrc /.X11startup /.Xauthority /.Xdefaults /etc/.login /etc/aliases /etc/atm.conf /etc/autopush /etc/auto_direct /etc/auto_master /etc/auto_home /etc/autopush.conf /etc/auto.direct /etc/auto.master /etc/cron.d/cron.allow /etc/cron.d/cron.deny /etc/cron.d/at.allow /etc/cron.d/at.deny /etc/devlink.tab /etc/defaultdomain /etc/defaultrouter /etc/dhcp/dhcptags /etc/driver_aliases /etc/driver_classes /etc/dumpdates /etc/ethers /etc/group /etc/hosts /etc/hosts.equiv /etc/hosts.lpd /etc/hostname.lpfn0 /etc/inittab /etc/login /etc/logindevperm /etc/issue /etc/magic /etc/minor_perm /etc/motd /etc/name_to_major /etc/name_to_sysnum /etc/named.boot /etc/nodename /etc/notrouter /etc/nsr.res /etc/nsswitch.conf /etc/pam.conf /etc/passwd /etc/path_to_inst /etc/powerpath_registration /etc/power.conf /etc/printcap /etc/printers.conf /etc/profile /etc/release /etc/remote /etc/resolv.conf /etc/routes /etc/rpc /etc/servers /etc/sernum /etc/setup.conf /etc/shadow /etc/snmpd.conf /etc/strsetup.conf /etc/staticroute /etc/stronginfo /etc/sysconfigtab /etc/syslog.conf /etc/system /etc/ttydefs /etc/ttysrch /etc/vfstab /etc/TIMEZONE /etc/default/cron /etc/default/login /etc/default/init /etc/default/su /etc/dfs/dfstab /etc/dfs/sharetab /etc/inet/hosts /etc/inet/inetd.conf /etc/inet/netmasks /etc/inet/networks /etc/inet/ntp.conf /etc/inet/ntp.server /etc/inet/protocols /etc/inet/services /etc/mail/aliases /etc/mail/sendmail.cf /etc/Navisphere/agent.config /etc/opt/SUNWmd/md.tab /etc/vx/volboot /etc/vx/disks.exclude /etc/vx/cntrls.exclude /kernel/drv/emcpower.conf /kernel/drv/atf.conf /kernel/drv/atfi.conf /kernel/drv/fcaw.conf /kernel/drv/fca.conf /kernel/drv/lpfc.conf /kernel/drv/sd.conf /kernel/drv/st.conf /usr/symapps/data/group/class.bcv /var/adm/dmesg.output /var/adm/install/contents /var/sadm/softinfo/INST_RELEASE /var/symapi/db/symapi_db.bin /var/symapi/config/netcnfg /var/opt/oracle/oratab /var/spool/cron/crontabs/root /sbin/rc0 /sbin/rc1 /sbin/rc2 /sbin/rc3 /sbin/rc4 /sbin/rc5 /sbin/rc6 /sbin/rcS " ############# # end of VARS ############# ############# #check to see if superuser ############# if [[ $(id | tr '(' " " | tr ')' " " | awk '{print $2}') != root ]] then print "Sorry, you must be root to run." exit 1 fi print "\n---------------------------------" print "Running $0\n" ############################## # make directories for the node ############################## make_dir () { print "\n---------------------------------" print "Making directories if needed.\n" GROUP="bin" PERMISSION="777" # make parent if [ ! -d $CFIG_DIR ] then mkdir -m $PERMISSION -p $CFIG_DIR chgrp $GROUP $CFIG_DIR fi cd $CFIG_DIR # make node if needed if [ ! -d $NODE ] then mkdir -m $PERMISSION $NODE else chmod $PERMISSION $NODE fi chgrp $GROUP $NODE # make subdirs if needed for DIR in AP_DR Arrays Cluster Disks EMC-symm EMC-clar Etc Files Init Kernel Mail Md Perf Vx do if [ ! -d $NODE/$DIR ] then mkdir -m $PERMISSION -p $CFIG_DIR/$NODE/$DIR chgrp $GROUP $CFIG_DIR/$NODE/$DIR fi done } ############################## # compress ############################## compress_dir () { print "\n---------------------------------" print "Compressing files.\n" cd $CFIG_DIR/$NODE compress */* > /dev/null 2>&1 cd .. } ############################## # uncompress if needed ############################## uncompress_dir () { print "\n---------------------------------" print "Uncompressing files if needed.\n" # loop on directories only cd $CFIG_DIR/$NODE uncompress */*.Z > /dev/null 2>&1 cd .. } ############################## # get mount point ls's ############################## mntptls () { print "\n---------------------------------" print "Get mount point ls.\n" ####################### # Get only local mounts ####################### for MOUNT in `df -kl \ | egrep -v 'swap|proc|fd|mnttab|cdrom|Filesystem' \ | awk '{print $6}'` do OUT=`print $MOUNT | cut -d/ -f2` ####### # do for root ####### if [ -z "$OUT" ] then OUT="root" fi ls -l $MOUNT > $CFIG_DIR/$NODE/Disks/$NODE.ls.$OUT done ####################### # Get only local disks ####################### for DEV_MOUNT in `df -kl \ | egrep -v 'swap|proc|fd|mnttab|cdrom|Filesystem' \ | awk '{print $1}'` do # # fstyp complains of broken pipe if output is sent to head # DEV_MOUNT_DIR="$(print $DEV_MOUNT |sed -e 's/\//_/g')" fstyp -v $DEV_MOUNT > /tmp/$$.1 head -25 /tmp/$$.1 > $CFIG_DIR/$NODE/Disks/$NODE.fstyp.$DEV_MOUNT_DIR done ls -lR /dev > $CFIG_DIR/$NODE/Disks/$NODE.dev ls -lR /devices > $CFIG_DIR/$NODE/Disks/$NODE.devices ls -l /usr/spool > $CFIG_DIR/$NODE/Disks/$NODE.spool } ############################## # get disk info ############################## disks () { print "\n---------------------------------" print "Getting disk info.\n" ######### # get only local disks, and only unique disks ######### for DISK in `format < /dev/null | awk '/ \ $CFIG_DIR/$NODE/Disks/$NODE.format_inq.$DISK 2>&1 echo current | format -M /dev/rdsk/${DISK}s2 > \ $CFIG_DIR/$NODE/Disks/$NODE.format_current.$DISK 2>&1 echo verify | format -M /dev/rdsk/${DISK}s2 > \ $CFIG_DIR/$NODE/Disks/$NODE.format_verify.$DISK 2>&1 devinfo -i /dev/rdsk/${DISK}s2 > \ $CFIG_DIR/$NODE/Disks/$NODE.devinfo_i.$DISK devinfo -p /dev/rdsk/${DISK}s2 > \ $CFIG_DIR/$NODE/Disks/$NODE.devinfo_p.$DISK prtvtoc /dev/rdsk/${DISK}s2 > \ $CFIG_DIR/$NODE/Disks/$NODE.prtvtoc.$DISK # value needed for mkfs in 2.8, gave min of 1024 (value has no effect on output) # also, 2.8 write output to stderr, WHY??? if [[ $(uname -r) == 5.8 ]] then mkfs -m /dev/rdsk/${DISK}s2 1024 > \ $CFIG_DIR/$NODE/Disks/$NODE.mkfs_m.$DISK 2>&1 else mkfs -m /dev/rdsk/${DISK}s2 1024 > \ $CFIG_DIR/$NODE/Disks/$NODE.mkfs_m.$DISK 2>&1 fi done format < /dev/null > $CFIG_DIR/$NODE/Disks/$NODE.format_disks iostat -eEn > $CFIG_DIR/$NODE/Disks/$NODE.disks_iostat_eEn } ############################## # get metadata info ############################## meta_info () { print "\n---------------------------------" print "Getting metadata info.\n" MD_THERE="`ls /dev/md/dsk/d? 2> /dev/null`" if [ -n "$MDVX_THERE" ] then '(ls -lR /dev/md)' > $CFIG_DIR/$NODE/Md/$NODE.dev_md /usr/opt/SUNWmd/sbin/metastat > $CFIG_DIR/$NODE/Md/$NODE.metastat /usr/opt/SUNWmd/sbin/metastat -p > $CFIG_DIR/$NODE/Md/$NODE.metastat_p /usr/opt/SUNWmd/sbin/metadb > $CFIG_DIR/$NODE/Md/$NODE.metadb else print "** NO metadevices on node" fi } ############################## # get volume info ############################## vol_info () { print "\n---------------------------------" print "Getting volume info.\n" # assumes if the license file /etc/vx/elm/?? exists, then veritas is loaded VX_THERE="`ls /etc/vx/elm/* 2> /dev/null`" if [ -n "$VX_THERE" ] then print "** VX on $NODE" PATH=$PATH:/opt/VRTS/bin ls -lR /vol > $CFIG_DIR/$NODE/Vx/$NODE.etc_vol /usr/sbin/vxdctl list > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxboot_list /usr/sbin/vxiod > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxiod /usr/sbin/vxprint > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint /usr/sbin/vxprint -ht > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_ht /usr/sbin/vxprint -hat > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_hat /usr/sbin/vxprint -Ahqt > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_Ahqt /usr/sbin/vxprint -hvpsm > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_hvpsm /usr/sbin/vxprint -Agts > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_Agts /usr/sbin/vxprint -Am > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_Am /usr/sbin/vxprint -S > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_S /usr/sbin/vxdisk list > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxdisk_list /usr/sbin/vxdisk -o alldgs list > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxdisk_alldgs_list /usr/sbin/vxdg -q list > $CFIG_DIR/$NODE/Vx/$NODE.vxdg_q_list /usr/sbin/vxdg list > $CFIG_DIR/$NODE/Vx/$NODE.vxdg_list /usr/lib/vxvm/bin/vxparms > $CFIG_DIR/$NODE/Vx/$NODE.vxparms #vxprint of root disks #pre 3.x /usr/sbin/vxprint -ht -e '("rootdisk" in v_plex.pl_sd.sd_disk)||("rootdisk" in pl_sd.sd_disk)||("rootdisk" in sd_disk)' \ > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_ht_rootdisk #3.x: 'r' added /usr/sbin/vxprint -hrt -e '("rootdisk" in v_plex.pl_sd.sd_disk)||("rootdisk" in pl_sd.sd_disk)||("rootdisk" in sd_disk)' \ > $CFIG_DIR/$NODE/Vx/$NODE.vx.vxprint_hrt_rootdisk #groups GROUPS="`/usr/sbin/vxprint -ht | grep \^dg | awk '{print $2}'`" for GROUP in $GROUPS do /usr/sbin/vxdg -g $GROUP free > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${GROUP}_vxdg_free /usr/sbin/vxdg list $GROUP > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${GROUP}_vxdg_list /usr/sbin/vxstat -g $GROUP > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${GROUP}_vxstat /usr/sbin/vxstat -g $GROUP -d > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${GROUP}_vxstat_d /usr/sbin/vxprint -g $GROUP -mvps > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${GROUP}_vxprint_mvps /usr/sbin/vxprint -g $GROUP -hmvpsrQq > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${GROUP}_vxprint_hmvpsrQq /usr/sbin/vxprint -g $GROUP -hmvpsQq > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${GROUP}_vxprint_hmvpsQq for VOL in $(ls /dev/vx/dsk/$GROUP/*) do VOL_NAME=$(print $VOL | awk -F/ '{print $NF}') /usr/lib/vxvm/bin/vxparms -s $VOL > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.vxparms_s_vol.${GROUP}.${VOL_NAME} done # # section from veritas docs # diag="/etc/vx/diag.d/vxprivutil" dgname="$GROUP" dsk=`vxdg list $dgname | grep "config disk" | grep clean | line | \ awk '{ print $3 }'` extpr=`vxdisk list ${dsk} | grep "^private" | awk -F= '{print $2}'` extprno=`echo ${extpr} | awk '{ print $1 }` nos=`echo $dsk | \ sed -n 's/.*\(c[0-9][0-9]*t[0-9][0-9]*d[0-9][0-9]*\).*/\1/p'` privpath=`echo ${nos}s${extprno}` $diag dumpconfig /dev/rdsk/$privpath > $CFIG_DIR/$NODE/Vx/$NODE.vx.$dgname.vxprivutil-dumpconfig cat /$dgname.dump | \ vxprint -D - -d -F "Disk %last_da_name=%name - %diskid" > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.$dgname.vxprint_diskids done #disk drives DEVICES="`/usr/sbin/vxdisk list | grep -v DEVICE | awk '{print $1}'`" for DEVICE in $DEVICES do /usr/sbin/vxdisk -s list $DEVICE > \ $CFIG_DIR/$NODE/Vx/$NODE.vx.${DEVICE}_voldisk_list done #vxdmp if [[ -e /usr/sbin/vxdmpadm ]] then /usr/sbin/vxdmpadm listctlr all > \ $CFIG_DIR/$NODE/Vx/$NODE.vxdmpadm_listctrl_all # get the veritas version - vxdmpadm displays different VXVM=$(pkginfo -l VRTSvxvm | \ awk '/VERSION/ {print $2}'| awk -F, '{print $1}') if [[ -z $VXVM ]] then VXVM=$(pkginfo -l SUNWvxvm | \ awk '/VERSION/ {print $2}' |awk -F, '{print $1}') fi if (( $VXVM >= 3.1 )) then DMPCTLRS="`/usr/sbin/vxdmpadm listctlr all | grep -v STATE | \ grep -v "==========" | awk '{print $1}'`" else DMPCTLRS="`/usr/sbin/vxdmpadm listctlr all | grep -v STATE | \ grep -v "==========" | awk -F= '/\=/ {print $2}'`" fi for DMPCTLR in $DMPCTLRS do /usr/sbin/vxdmpadm getsubpaths ctlr=$DMPCTLR > \ $CFIG_DIR/$NODE/Vx/$NODE.vxdmpadm_getsubpaths_$DMPCTLR done fi #licenses cp -r /etc/vx/elm/ $CFIG_DIR/$NODE/Vx/$NODE_etc_vx_elm vxlicense -p > $CFIG_DIR/$NODE/Vx/$NODE.licenses-vxlicense_p vxlicrep > $CFIG_DIR/$NODE/Vx/$NODE.licenses-vxlicrep else print "** NO VX on node" fi } ############################## # get array info ############################## arrays () { print "\n---------------------------------" print "Getting array info.\n" SSAADM_THERE="`ls -l /dev/dsk/c*s2 2> /dev/null | grep '/SUNW,pln@'`" #SSAADM_THERE="`ls -l /dev/dsk/c*s2 2> /dev/null | grep '/SUNW,soc@'`" #SSAADM_THERE="`ls /usr/sbin/ssaadm | grep -v No`" 2> /dev/null if [ -n "$SSADM_THERE" ] then #have 1xx arrays for ARRAY in `ls -l /dev/dsk/c*s2 2> /dev/null | grep '/SUNW,pln@' | \ awk '{print $9}' | cut -c10- | cut -dt -f 1 | sort -u` do /usr/sbin/ssaadm disp $ARRAY > \ $CFIG_DIR/$NODE/Arrays/$NODE.ssaadm.$ARRAY done fi LUXADM_THERE="`ls -l /dev/dsk/c*s2 2> /dev/null | grep '/sf@'`" #LUXADM_THERE="`ls -l /dev/dsk/c*s2 2> /dev/null | grep '/SUNW,socal@'`" #LUXADM_THERE="`ls -l /dev/es/ses* 2> /dev/null'`" #LUXADM_THERE="`ls /usr/sbin/luxadm | grep -v No`" 2> /dev/null if [ -n "$LUXADM_THERE" ] then #have 1000/5000 arrays luxadm probe > $CFIG_DIR/$NODE/Arrays/$NODE.luxadm_probe for ARRAY in `luxadm probe | awk -F: '/Logical/ {print $2}' | sort -u` do LXOUTFILE=`print $ARRAY | tr '/' '_' ` luxadm disp $ARRAY > \ $CFIG_DIR/$NODE/Arrays/$NODE.luxadm.${LXOUTFILE}_disp sleep 1 luxadm -v disp $ARRAY > \ $CFIG_DIR/$NODE/Arrays/$NODE.luxadm.${LXOUTFILE}_disp_v sleep 1 luxadm disp -r $ARRAY > \ $CFIG_DIR/$NODE/Arrays/$NODE.luxadm.${LXOUTFILE}_disp_r sleep 1 luxadm -e dump_map $ARRAY > \ $CFIG_DIR/$NODE/Arrays/$NODE.luxadm.${LXOUTFILE}_dump_map done fi #SSMADM_THERE="`ls /opt/SUNWssmu/bin/ssmadmin | grep -v No`" 2> /dev/null #SSMADM_THERE="`ls -l /dev/dsk/c*s2 2> /dev/null | grep '/SUNW,isp'`" if [[ -e /opt/SUNWssmu/bin/ssmadmin ]] then /opt/SUNWssmu/bin/ssmadmin -view > \ $CFIG_DIR/$NODE/Arrays/$NODE.ssmadmin 2>&1 fi } ############################## # get veritas cluster ############################## cluster () { print "\n---------------------------------" print "Getting cluster info.\n" CLUSTER_THERE="`pkginfo VRTSvcs 2> /dev/null`" if [ -n "$CLUSTER_THERE" ] then # # get pertitent cluster config files # CLUSTER_FILES="/etc/gabtab /etc/llttab /etc/llthosts /etc/VRTSvcs/conf/config/main.cf /etc/VRTSvcs/conf/config/main.cmd /etc/VRTSvcs/conf/config/types.cf /etc/VRTSvcs/conf/sysname" for CFILE in $CLUSTER_FILES do ################################## # change the '/' to '_' for file name # /etc/fstab becomes: hostname._etc_fstab ################################## OUTFILE=`print $CFILE | tr '/' '_' ` cp $CFILE $CFIG_DIR/$NODE/Cluster/$NODE.$OUTFILE done cp -r /opt/VRTSvcs/bin/triggers $CFIG_DIR/$NODE/Cluster/$NODE.opt_VRTSvcs_bin_triggers cp -r /etc/VRTSvcs/conf $CFIG_DIR/$NODE/Cluster/$NODE.etc_VRTSvcs_conf cp /dev/null $CFIG_DIR/$NODE/Cluster/$NODE.getmac-llt for NTW_DEV in $(grep ^link /etc/llttab | awk '{print $3}') do /opt/VRTSllt/getmac $NTW_DEV >> \ $CFIG_DIR/$NODE/Cluster/$NODE.getmac-llt done cp /dev/null $CFIG_DIR/$NODE/Cluster/$NODE.getmac-virtuals for VIRT in $(echo /etc/hostname.* | cut -c15- |\ sed s/'[0-9]'// ) do VIRT="/dev/$(print ${VIRT}:0)" /opt/VRTSllt/getmac $VIRT >> \ $CFIG_DIR/$NODE/Cluster/$NODE.getmac-virtuals done eeprom scsi-initiator-id > \ $CFIG_DIR/$NODE/Cluster/$NODE.eeprom_scsi-initiator-id eeprom local-mac-address? > \ $CFIG_DIR/$NODE/Cluster/$NODE.eeprom_local-mac-address /sbin/lltconfig -a list > \ $CFIG_DIR/$NODE/Cluster/$NODE.lltconfig_a /sbin/lltstat > \ $CFIG_DIR/$NODE/Cluster/$NODE.lltstat /sbin/lltstat -c > \ $CFIG_DIR/$NODE/Cluster/$NODE.lltstat_C /sbin/lltstat -l > \ $CFIG_DIR/$NODE/Cluster/$NODE.lltstat_l /sbin/lltstat -v> \ $CFIG_DIR/$NODE/Cluster/$NODE.lltstat_v /sbin/lltstat -p> \ $CFIG_DIR/$NODE/Cluster/$NODE.lltstat_p /sbin/lltstat -n> \ $CFIG_DIR/$NODE/Cluster/$NODE.lltstat_n /sbin/lltstat -nvv> \ $CFIG_DIR/$NODE/Cluster/$NODE.lltstat_nvv /sbin/gabconfig -a > \ $CFIG_DIR/$NODE/Cluster/$NODE.gabconfig_a /sbin/gabconfig -l > \ $CFIG_DIR/$NODE/Cluster/$NODE.gabconfig_l /opt/VRTSvcs/bin/hagrp -list > \ $CFIG_DIR/$NODE/Cluster/$NODE.hargrp_list /opt/VRTSvcs/bin/hagrp -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.hargrp_display /opt/VRTSvcs/bin/hagrp -resources > \ $CFIG_DIR/$NODE/Cluster/$NODE.hagrp_resources /opt/VRTSvcs/bin/hagrp -dep > \ $CFIG_DIR/$NODE/Cluster/$NODE.hagrp_dep /opt/VRTSvcs/bin/haattr -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.haattr_display /opt/VRTSvcs/bin/hatype -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.hatype_display /opt/VRTSvcs/bin/haagent -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.haagent_display /opt/VRTSvcs/bin/hasys -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.hasys_display /opt/VRTSvcs/bin/hasys -list > \ $CFIG_DIR/$NODE/Cluster/$NODE.hasys_list /opt/VRTSvcs/bin/hastatus -summary > \ $CFIG_DIR/$NODE/Cluster/$NODE.hastatus_summary /opt/VRTSvcs/bin/hares -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.hares_display /opt/VRTSvcs/bin/hares -list > \ $CFIG_DIR/$NODE/Cluster/$NODE.hares_list /opt/VRTSvcs/bin/hauser -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.hauser_display /opt/VRTSvcs/bin/haclus -display > \ $CFIG_DIR/$NODE/Cluster/$NODE.haclus_display /opt/VRTSvcs/bin/haclus -value > \ $CFIG_DIR/$NODE/Cluster/$NODE.haclus_value mkdir $CFIG_DIR/$NODE/Cluster/$NODE.hagetcf.dir /opt/VRTSvcs/bin/hagetcf <<- EOF $CFIG_DIR/$NODE/Cluster/$NODE.hagetcf.dir EOF /opt/VRTSvcs/bin/hares -dep > \ $CFIG_DIR/$NODE/Cluster/$NODE.hares_dep for RESOURCE in $(/opt/VRTSvcs/bin/hares -dep \ | sed 1,3d \ | awk '{print $3}' ) do /opt/VRTSvcs/bin/hares -dep $RESOURCE > \ $CFIG_DIR/$NODE/Cluster/$NODE.hares_dep_$RESOURCE done /opt/VRTSvcs/bin/hacf -verify /etc/VRTSvcs/conf/config > \ $CFIG_DIR/$NODE/Cluster/$NODE.hacf_verify /opt/VRTSvcs/bin/hacf -generate /etc/VRTSvcs/conf/config > \ $CFIG_DIR/$NODE/Cluster/$NODE.hacf_generate /opt/VRTSvcs/bin/hacf -cftocmd /etc/VRTSvcs/conf/config -dest /tmp mv /tmp/main.cmd $CFIG_DIR/$NODE/Cluster/$NODE.hacf_cftocmd else print "** NO Cluster on node" fi } ############################## # get stats info ############################## stat () { print "\n---------------------------------" print "Getting stat info.\n" df > $CFIG_DIR/$NODE/Etc/$NODE.df df -k > $CFIG_DIR/$NODE/Etc/$NODE.df_k df -kl > $CFIG_DIR/$NODE/Etc/$NODE.df_kl df -t > $CFIG_DIR/$NODE/Etc/$NODE.df_t df -g > $CFIG_DIR/$NODE/Etc/$NODE.df_g dmesg > $CFIG_DIR/$NODE/Etc/$NODE.dmesg eeprom > $CFIG_DIR/$NODE/Etc/$NODE.eeprom hostid > $CFIG_DIR/$NODE/Etc/$NODE.hostid isalist > $CFIG_DIR/$NODE/Etc/$NODE.isalist isainfo -v > $CFIG_DIR/$NODE/Etc/$NODE.isainfo_v isainfo -kv > $CFIG_DIR/$NODE/Etc/$NODE.isainfo_kv ipcs -a > $CFIG_DIR/$NODE/Etc/$NODE.ipcs_a locale > $CFIG_DIR/$NODE/Etc/$NODE.locale lpstat -t > $CFIG_DIR/$NODE/Etc/$NODE.lpstat_t lpstat -lt > $CFIG_DIR/$NODE/Etc/$NODE.lpstat_lt lpfilter -f all -l > $CFIG_DIR/$NODE/Etc/$NODE.lpfilter_f_all_l lpusers -l > $CFIG_DIR/$NODE/Etc/$NODE.lpusers_l lpsystem -l > $CFIG_DIR/$NODE/Etc/$NODE.lpsystem_l lpsystem -A > $CFIG_DIR/$NODE/Etc/$NODE.lpsystem_A mailstats > $CFIG_DIR/$NODE/Etc/$NODE.mailstats m64config -res \? <<- EOF > $CFIG_DIR/$NODE/Etc/$NODE.m64config_res_question yes EOF m64config -propt > $CFIG_DIR/$NODE/Etc/$NODE.m64config_propt /sccm/admin/sau/scripts/memconf -v > $CFIG_DIR/$NODE/Etc/$NODE.memconf_v modinfo > $CFIG_DIR/$NODE/Etc/$NODE.modinfo mpstat > $CFIG_DIR/$NODE/Etc/$NODE.mpstat nlsadmin -V > $CFIG_DIR/$NODE/Etc/$NODE.nsladmin_V pagesize > $CFIG_DIR/$NODE/Etc/$NODE.pagesize pmadm -l > $CFIG_DIR/$NODE/Etc/$NODE.pmadm_l priocntl -l > $CFIG_DIR/$NODE/Etc/$NODE.priocntl_l prtfru > $CFIG_DIR/$NODE/Etc/$NODE.prtfru prtfru -l > $CFIG_DIR/$NODE/Etc/$NODE.prtfru_l prtfru -c > $CFIG_DIR/$NODE/Etc/$NODE.prtfru_c prtconf -v > $CFIG_DIR/$NODE/Etc/$NODE.prtconf_v prtconf -vp > $CFIG_DIR/$NODE/Etc/$NODE.prtconf_vp prtconf -vp | grep banner-name > $CFIG_DIR/$NODE/Etc/$NODE.banner_cpu_arch psrinfo > $CFIG_DIR/$NODE/Etc/$NODE.psrinfo psrinfo -v > $CFIG_DIR/$NODE/Etc/$NODE.psrinfo_v rpcinfo -p > $CFIG_DIR/$NODE/Etc/$NODE.rpcinfo_p sacadm -l > $CFIG_DIR/$NODE/Etc/$NODE.sacadm_l swap -l > $CFIG_DIR/$NODE/Etc/$NODE.swapon_l swap -s > $CFIG_DIR/$NODE/Etc/$NODE.swapon_s sysdef > $CFIG_DIR/$NODE/Etc/$NODE.sysdef sysdef -d > $CFIG_DIR/$NODE/Etc/$NODE.sysdef_d showrev -a > $CFIG_DIR/$NODE/Etc/$NODE.showrev_a showrev -p > $CFIG_DIR/$NODE/Etc/$NODE.showrev_p uname -a > $CFIG_DIR/$NODE/Etc/$NODE.uname_a /usr/proc/bin/ptree root > $CFIG_DIR/$NODE/Etc/$NODE.ptree_root /usr/proc/bin/ptree -a > $CFIG_DIR/$NODE/Etc/$NODE.ptree_a /sccm/admin/sau/scripts/nddconfig show > $CFIG_DIR/$NODE/Etc/$NODE.nddconfig_show #ignore corefile in 2.8 /usr/lib/sendmail -d0.1 -bt < /dev/null > $CFIG_DIR/$NODE/Etc/$NODE.sendmail_config 2> /dev/null ARCH=$(uname -m) if [[ $ARCH = sun4u ]] then /usr/platform/`uname -m`/sbin/prtdiag > $CFIG_DIR/$NODE/Etc/$NODE.prtdiag else /usr/sbin/prtconf -V > $CFIG_DIR/$NODE/Etc/$NODE.prtconf_V_openboot fi } ############################## # get perf info ############################## perf () { print "\n---------------------------------" print "Getting perf info.\n" vmstat 1 10 > $CFIG_DIR/$NODE/Perf/$NODE.vmstat_1_10 vmstat -s > $CFIG_DIR/$NODE/Perf/$NODE.vmstat_s vmstat -i > $CFIG_DIR/$NODE/Perf/$NODE.vmstat_i vmstat -c 1 10 > $CFIG_DIR/$NODE/Perf/$NODE.vmstat_c_1_10 lockstat sleep 5 > $CFIG_DIR/$NODE/Etc/$NODE.lockstat_sleep_5 kstat -p > $CFIG_DIR/$NODE/Etc/$NODE.kstat_p netstat -k > $CFIG_DIR/$NODE/Perf/$NODE.netstat_k netstat -s > $CFIG_DIR/$NODE/Perf/$NODE.netstat_s iostat 1 10 > $CFIG_DIR/$NODE/Perf/$NODE.iostat_1_10 iostat -xtnc 5 10 > $CFIG_DIR/$NODE/Perf/$NODE.iostat_xtnc_5_10 iostat -xnp 5 10 > $CFIG_DIR/$NODE/Perf/$NODE.iostat_xnp_5_10 sar -A > $CFIG_DIR/$NODE/Perf/$NODE.sar_A sar -A -f /var/adm/sa/sa$(date +%d) > $CFIG_DIR/$NODE/Perf/$NODE.sar_A-previousday uptime > $CFIG_DIR/$NODE/Perf/$NODE.uptime echo "map kernelmap" | /usr/sbin/crash > $CFIG_DIR/$NODE/Perf/$NODE.crash_kernelmap echo kmastat | /usr/sbin/crash > $CFIG_DIR/$NODE/Perf/$NODE.crash_kmstat /sccm/admin/sau/scripts/get_kernel_values > $CFIG_DIR/$NODE/Perf/$NODE.adb_kernel_values LPFC_CMD=/usr/sbin/lpfc/lputil if [[ -f $LPFC_CMD ]] then CNT=0 NUM_HBA=$($LPFC_CMD count) # we will loop for each one as you can mix different type # but this is probably not the best thing to do while (( CNT < $NUM_HBA )) do $LPFC_CMD status $CNT > $CFIG_DIR/$NODE/Perf/$NODE.lpfc_${CNT}_status $LPFC_CMD linkstat $CNT > $CFIG_DIR/$NODE/Perf/$NODE.lpfc_${CNT}_linkstat let CNT=$CNT+1 done fi } ############################## # get ps listing ############################## get_ps () { print "\n---------------------------------" print "Getting ps list.\n" ps -elfy > $CFIG_DIR/$NODE/Etc/$NODE.ps_elfy ps -elfy | grep d$ > $CFIG_DIR/$NODE/Etc/$NODE.ps_elfy_daemons /usr/ucb/ps -auxww | grep d$ > $CFIG_DIR/$NODE/Etc/$NODE.ucb_ps_auxww } ############################## # get pkginfo ############################## package () { print "\n---------------------------------" print "Getting pkginfo.\n" pkginfo > $CFIG_DIR/$NODE/Etc/$NODE.pkginfo pkginfo -l > $CFIG_DIR/$NODE/Etc/$NODE.pkginfo_l } ############################## # get opt ############################## opt_list () { print "\n---------------------------------" print "Getting opt list.\n" ls -l /opt > $CFIG_DIR/$NODE/Etc/$NODE.opt_root ls -l /opt1 > $CFIG_DIR/$NODE/Etc/$NODE.opt1 ls -l /opt2 > $CFIG_DIR/$NODE/Etc/$NODE.opt2 ls -l /opt3 > $CFIG_DIR/$NODE/Etc/$NODE.opt3 ls -l /usr/opt > $CFIG_DIR/$NODE/Etc/$NODE.opt_usr ls -l /var/opt > $CFIG_DIR/$NODE/Etc/$NODE.opt_var } ############################## # get network ############################## network () { print "\n---------------------------------" print "Getting network.\n" netstat -i > $CFIG_DIR/$NODE/Etc/$NODE.netstat_i netstat -r > $CFIG_DIR/$NODE/Etc/$NODE.netstat_r netstat -an > $CFIG_DIR/$NODE/Etc/$NODE.netstat_an netstat -rn > $CFIG_DIR/$NODE/Etc/$NODE.netstat_rn INTERFACE="`netstat -i | grep $NODE | awk '{print $1}' | sort -u`" for INT in $INTERFACE do ifconfig $INT > $CFIG_DIR/$NODE/Etc/$NODE.ifconfig_$INT cp /etc/hostname.$INT $CFIG_DIR/$NODE/Etc/$NODE.hostname.$INT cp /etc/dhcp.\* $CFIG_DIR/$NODE/Etc done } ############################## # get DR & AP configs ############################## dr_and_ap () { print "\n---------------------------------" print "Getting DR & AP configs.\n" CFG_THERE="`ls -l /usr/sbin/cfgadm 2> /dev/null`" if [ -n "$CFG_THERE" ] then cfgadm > $CFIG_DIR/$NODE/AP_DR/$NODE.cfgadm cfgadm -v > $CFIG_DIR/$NODE/AP_DR/$NODE.cfgadm_v else print "** NO DR on node" fi AP_THERE="`ls -l /usr/sbin/apconfig 2> /dev/null`" if [ -n "$AP_THERE" ] then apinst > $CFIG_DIR/$NODE/AP_DR/$NODE.apinst apconfig -v > $CFIG_DIR/$NODE/AP_DR/$NODE.apconfig_v apconfig -D > $CFIG_DIR/$NODE/AP_DR/$NODE.apconfig_D apconfig -S > $CFIG_DIR/$NODE/AP_DR/$NODE.apconfig_S apconfig -N > $CFIG_DIR/$NODE/AP_DR/$NODE.apconfig_N else print "** NO AP on node" fi } ############################## # get EMC ############################## emc () { print "\n---------------------------------" print "Getting EMC.\n" CLAR_THERE="`ls -l /opt/Navisphere/bin/navicli 2> /dev/null`" SYMM_THERE="`ls -l /usr/symcli/bin/syminq 2> /dev/null`" if [ -n "$SYMM_THERE" ] then cp /usr/emc/API/symapi/config/symapi_licenses.dat $CFIG_DIR/$NODE/EMC-symm/$NODE.symapi_licenses.dat cp /usr/emc/ECC/data/swdata/license.dat $CFIG_DIR/$NODE/EMC-symm/$NODE.license.dat cp /opt/emc/emc_key_file $CFIG_DIR/$NODE/EMC-symm/$NODE.emc_key_file modinfo | grep emcpower > $CFIG_DIR/$NODE/EMC-symm/$NODE.modinfo_emcpower egrep -i lpfc /var/adm/messages* | grep WWPN | grep NOTICE | head -n2 > \ $CFIG_DIR/$NODE/EMC-symm/$NODE.lpfc-interfaces cp $CFIG_DIR/$NODE/EMC-symm/$NODE.lpfc-interfaces $CFIG_DIR/$NODE/Files/$NODE.lpfc-interfaces egrep -i fcaw /var/adm/messages* | grep WWPN | head -n2 > \ $CFIG_DIR/$NODE/EMC-symm/$NODE.fcaw-interfaces cp $CFIG_DIR/$NODE/EMC-symm/$NODE.fcaw-interfaces $CFIG_DIR/$NODE/Files/$NODE.fcaw-interfaces /etc/powermt save file=$CFIG_DIR/$NODE/EMC-symm/$NODE.powemt_save /etc/powermt check_registration > $CFIG_DIR/$NODE/EMC-symm/$NODE.powemt_registration /etc/powermt display dev=all > $CFIG_DIR/$NODE/EMC-symm/$NODE.powermt_display_all /etc/powercf -p > $CFIG_DIR/$NODE/EMC-symm/$NODE.powercf_p /usr/symcli/bin/symcli > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcli /usr/symcli/bin/symcli -def > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcli_def /usr/symcli/bin/syminq > $CFIG_DIR/$NODE/EMC-symm/$NODE.syminq /usr/symcli/bin/syminq -v > $CFIG_DIR/$NODE/EMC-symm/$NODE.syminq_v /usr/symcli/bin/syminq -sym > $CFIG_DIR/$NODE/EMC-symm/$NODE.syminq_sym /usr/symcli/bin/symcfg list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_list /usr/symcli/bin/symcfg list -v > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_list_v /usr/symcli/bin/symcfg -connections list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_connections_list /usr/symcli/bin/symcfg -connections -capacity list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_connections_capacity_list /usr/symcli/bin/symcfg -services list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_services_list /usr/symcli/bin/symcfg -semaphores list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_semaphores_list /usr/symcli/bin/symcfg -v -applications -host $NODE list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_applications_host_list_v /usr/symcli/bin/symcfg -dir all list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_dir_all_list /usr/symcli/bin/symcfg -v -dir all list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symcfg_v_dir_all_list /usr/symcli/bin/symdev list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symdev_list /usr/symcli/bin/symdev list -v > $CFIG_DIR/$NODE/EMC-symm/$NODE.symdev_list_v /usr/symcli/bin/sympd list > $CFIG_DIR/$NODE/EMC-symm/$NODE.sympd_list /usr/symcli/bin/sympd -resv list > $CFIG_DIR/$NODE/EMC-symm/$NODE.sympd_resv_list /usr/symcli/bin/symgate list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symgate_list /usr/symcli/bin/symgate -v list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symgate_list_v /usr/symcli/bin/symdg > $CFIG_DIR/$NODE/EMC-symm/$NODE.symdg for GROUP in $(/usr/symcli/bin/symdg list | sed 1,6d | awk '{print $1}') do /usr/symcli/bin/symld -g $GROUP list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symld_list_$GROUP /usr/symcli/bin/symld -g $GROUP -v list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symld_list_v_$GROUP /usr/symcli/bin/symmir -g $GROUP query > $CFIG_DIR/$NODE/EMC-symm/$NODE.symmir_query_$GROUP /usr/symcli/bin/symmir -g $GROUP verify > $CFIG_DIR/$NODE/EMC-symm/$NODE.symmir_verify_$GROUP done /usr/symcli/bin/symstat -i 5 -c 10 > $CFIG_DIR/$NODE/EMC-symm/$NODE.symstat /usr/symcli/bin/symstat -i 5 -c 10 -type MEMIO > $CFIG_DIR/$NODE/EMC-symm/$NODE.symstat_MEMIO /usr/symcli/bin/symstat -i 5 -c 10 -type PREFETCH -DA ALL > $CFIG_DIR/$NODE/EMC-symm/$NODE.symstat_PREFETCH /usr/symcli/bin/symstat -i 5 -c 10 -type REQUESTS > $CFIG_DIR/$NODE/EMC-symm/$NODE.symstat_REQUESTS /usr/symcli/bin/symstat -i 5 -c 10 -type CACHE > $CFIG_DIR/$NODE/EMC-symm/$NODE.symstat_CACHE /usr/symcli/bin/symbcv list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symbcv /usr/symcli/bin/symbcv list pd > $CFIG_DIR/$NODE/EMC-symm/$NODE.symbcv_pd /usr/symcli/bin/symvg list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symvg for VG in $(/usr/symcli/bin/symvg list | awk '/Enabled/ {print $1}') do /usr/symcli/bin/symlv -g $VG list > $CFIG_DIR/$NODE/EMC-symm/$NODE.symlv.$VG.list for LV in $(/usr/symcli/bin/symlv -g $VG list | awk '/Enabled/ {print $1}') do /usr/symcli/bin/symlv -g $VG show $LV > $CFIG_DIR/$NODE/EMC-symm/$NODE.symlv.$VG.show.$LV done done else print "** NO EMC Symmetrix on node" fi if [ -n "$CLAR_THERE" ] then cp -r /kernel/drv/atf_dbg $CFIG_DIR/$NODE/EMC-clar cp /etc/Navisphere/agent.config $CFIG_DIR/$NODE/EMC-clar/$NODE.agent.conf PATH=$PATH:/opt/Navisphere/bin export RaidAgentHost=clar9-1a export RaidAgentHost=clar9-1b navicli getagent > $CFIG_DIR/$NODE/EMC-clar/$NODE.getagent navicli getatf > $CFIG_DIR/$NODE/EMC-clar/$NODE.getatf navicli getcache > $CFIG_DIR/$NODE/EMC-clar/$NODE.getcache navicli getcontrol > $CFIG_DIR/$NODE/EMC-clar/$NODE.getcontrol navicli getcrus > $CFIG_DIR/$NODE/EMC-clar/$NODE.getcrus navicli getdisk > $CFIG_DIR/$NODE/EMC-clar/$NODE.getdisk navicli getlog > $CFIG_DIR/$NODE/EMC-clar/$NODE.getlog navicli getloop > $CFIG_DIR/$NODE/EMC-clar/$NODE.getloop navicli getlun > $CFIG_DIR/$NODE/EMC-clar/$NODE.getlun navicli getrg > $CFIG_DIR/$NODE/EMC-clar/$NODE.getrg navicli getsptime > $CFIG_DIR/$NODE/EMC-clar/$NODE.getsptime navicli ndu -list > $CFIG_DIR/$NODE/EMC-clar/$NODE.ndu-list navicli networkadmin -get > $CFIG_DIR/$NODE/EMC-clar/$NODE.networkadmin-get navicli remoteconfig -getconfig > $CFIG_DIR/$NODE/EMC-clar/$NODE.remoteconfig-getconfig navicli port -list > $CFIG_DIR/$NODE/EMC-clar/$NODE.port-list navicli storagegroup -list > $CFIG_DIR/$NODE/EMC-clar/$NODE.storagegroup-list else print "** NO EMC Clariion on node" fi } ############################## # get print files ############################## printers () { print "\n---------------------------------" print "Getting printer files.\n" cp -r /etc/lp $CFIG_DIR/$NODE/Files/Printer for PRINTER in $(lpstat -a | awk '{print $1}' | sort) do lpstat -lp $PRINTER > $CFIG_DIR/$NODE/Files/Printer/${PRINTER}_config done } ############################## # get init files ############################## init_files () { print "\n---------------------------------" print "Getting init files.\n" for DIR in init.d rc0.d rc1.d rc2.d rc3.d rcS.d do cp -r /etc/$DIR $CFIG_DIR/$NODE/Init/$DIR done } ############################## # get mail files ############################## mail_files () { print "\n---------------------------------" print "Getting mail files.\n" cp -r /usr/lib/mail $CFIG_DIR/$NODE/Mail/usr_lib_mail cp -r /etc/mail $CFIG_DIR/$NODE/Mail/etc_mail } ############################## # get files ############################## all_files () { print "\n---------------------------------" print "Getting files.\n" for FILE in $FILES do ################################## # change the / to _ for file name # /etc/fstab becomes: hostname._etc_fstab ################################## if [[ -f $FILE ]] then OUTFILE=`print $FILE | tr '/' '_' ` cp $FILE $CFIG_DIR/$NODE/Files/$NODE.$OUTFILE fi done ####### # get user crontabs ####### cp -r /var/spool/cron/crontabs $CFIG_DIR/$NODE/Files/crontabs print "" } ############################## # kernel files ############################## kernel () { KERN_SPARC=/usr/sys/sun4c/conf ARCH=$(uname -m) if [[ $ARCH = sun4c ]] then print "\n---------------------------------" print "Getting sun4c kernel files.\n" print "......Doing $NODE" CAP=`print $NODE | tr [a-z] [A-Z]` cp KERN_SPARC/$CAP $CFIG_DIR/$NODE/Kernel elif [[ $ARCH = sun4d ]] then print "\n---------------------------------" print "Getting sun4d kernel symbols.\n" /usr/ccs/bin/nm /dev/ksyms > \ $CFIG_DIR/$NODE/Kernel/$NODE.nm_dev_ksyms /usr/ccs/bin/nm /platform/$ARCH/kernel/unix > \ $CFIG_DIR/$NODE/Kernel/$NODE.nm_32unix else [[ $ARCH = sun4u ]] print "\n---------------------------------" print "Getting sun4u kernel symbols.\n" /usr/ccs/bin/nm /dev/ksyms > \ $CFIG_DIR/$NODE/Kernel/$NODE.nm_dev_ksyms /usr/ccs/bin/nm /platform/$ARCH/kernel/sparcV9/unix > \ $CFIG_DIR/$NODE/Kernel/$NODE.nm_64unix 2> /dev/null fi } ############################## # RUN the program ############################## if [[ -n $(print $DMZ_SERVERS | grep -w $NODE) ]] then # # DMZ servers, must use scp to get output, save to dir # CFIG_DIR=/var/tmp else # # all other nodes: internal servers # CFIG_DIR=/sccm/cfig/cfig/current fi if [[ ! -d $CFIG_DIR ]] then mkdir -p $CFIG_DIR fi make_dir uncompress_dir cd $CFIG_DIR/$NODE mntptls disks emc arrays cluster stat perf get_ps package dr_and_ap printers kernel opt_list network vol_info meta_info init_files mail_files all_files compress_dir if [[ -n $(print $DMZ_SERVERS | grep -w $NODE) ]] then cd $CFIG_DIR tar cf $NODE.adm_cfig.tar $NODE chmod 777 $NODE.adm_cfig.tar rm -rf $NODE fi print "" print "---------------------------------" print "Done." print "---------------------------------"