#!

/bin/bash
##############################################################################
#
Copyright (c) J.S Unix Consultants Ltd
##############################################################################
#
#
# FILE
: linux-explorer.sh
# Last Change Date : 29-09-2010
# Author(s)
: Joe Santoro
# Date Started
: 15th April, 2004
# Email
: linuxexplo [ at ] unix-consultants.com
# Web
: http://www.unix-consultants.com/examples/scripts/linux/linu
x-explorer
#
# Usage
: ./linux-explorer.sh [-d] [-v] [-s] [-h] [-V]
#
# Purpose
: This script is a linux version of the Solaris explorer
#
(SUNWexplo) script.
#
#
Used to collect information about a linux system build for r
emote
#
support supposes.
#
This script is a general purpose script for ALL linux
#
systems and therefore NOT tied into any one distro.
#
##############################################################################
#
# J.S UNIX CONSULTANTS LTD MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
# SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE, OR NON-INFRINGEMENT. J.S UNIX CONSULTANTS LTD SHALL
# NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
# MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
#
##############################################################################
COPYRIGHT="Copyright (c) J.S Unix Consultants Ltd"
MYVERSION="0.105"
MYDATE="$(/bin/date +'%Y.%m.%d.%m.%H.%M')" # Date and time now
MYNAME=$(basename $0)
WHOAMI=$(/usr/bin/whoami)
# The user running the script
HOSTID=$(/usr/bin/hostid)
# The Hostid of this server
MYHOSTNAME=$(/bin/uname -n)
# The hostname of this server
MYSHORTNAME=$(echo $MYHOSTNAME | cut -f 1 -d'.')
TMPFILE="/tmp/$(basename $0).$$"
# Tempory File
TOPDIR="/opt/LINUXexplo"
# Top level output directory
VERBOSE=0

# Set to see the scripts progress used
# only if connected to a terminal sessi

on.
FULLSOFT=0

#
# Ensure that we are the root user
#
if [ "$WHOAMI" != "root" ] ; then

# Set to Verify Software installation
# this takes a very long time

echo
echo "ERROR: Sorry only the root user can run this script"
echo
exit 1
fi
#
# Set the path for the script to run.
#
PATH=/bin:/usr/sbin:/sbin:/usr/sbin:/usr/local/bin:$PATH
if [ -d /opt/VRTSvcs/bin ] ; then
PATH=$PATH:/opt/VRTSvcs/bin
fi
export PATH

# Remove any temporary files we create
trap '$RM -f $TMPFILE >/dev/null 2>&1; exit' 0 1 2 3 15

##############################################################################
#
#
Function : Usage
#
#
Notes : N/A
#
##############################################################################
function ShowUsage
{
#------------------------------------------------------------------# Show help message
#------------------------------------------------------------------echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
exit

"$MYNAME Version $MYVERSION - $COPYRIGHT "
" usage:
"
"
"
"
"

$MYNAME [option] "
-d
-v
-s
-h
-V

Target directory for explorer files"
Verbose output"
Verify Package Installation"
This help message"
Version Number of LINUXEXPLO"

0

}

##############################################################################
#

#
Function : Echo
#
#
Parameters : String to display what function is about to run
#
#
Output : Print what section we are about to collect data for
#
#
Notes : N/A
#
##############################################################################

function Echo ()
{
if [ -t 0 ] ; then
if [ ${VERBOSE} -ne 0 ] ; then
echo "$*"
echo "============================================="
fi
if [ ${VERBOSE} -gt 1 ] ; then
echo "Press Return to Continue.........."
read A
fi
fi
}
##############################################################################
#
#
Function : mywhich
#
#
Parameters : name of program
#
#
Output : path of executable
#
#
Notes : Return back the location of the executable
#
I need this as not all linux distros have the files
#
in the same location.
#
##############################################################################

function mywhich ()
{
local command=$1
local mypath=$(which $command 2>/dev/null)
if [ "$mypath" = "" ] ; then
echo "Command $command not found" >> $NOTFNDLOG
echo "NOT_FOUND"
elif [ ! -x "$mypath" ] ; then
echo "Command $command not executable" >> $NOTFNDLOG
echo "NOT_FOUND"
else

echo "$mypath"
fi
}

##############################################################################
#
#
Function : findCmds
#
#
Parameters : None
#
#
Output : None
#
#
Notes :
Goes and find each of the commands I want to use and
#
stores the information into the various variables which
#
is the uppercase version of the command itself.
#
#
I need this as not all linux distros have the files
#
in the same location.
#
##############################################################################
function findCmds
{
# Standard commands
AWK=$(mywhich
BASENAME=$(mywhich
CAT=$(mywhich
CHKCONFIG=$(mywhich
CP=$(mywhich
CUT=$(mywhich
CHMOD=$(mywhich
DATE=$(mywhich
DF=$(mywhich
DMESG=$(mywhich
ECHO=$(mywhich
FILE=$(mywhich
FIND=$(mywhich
FREE=$(mywhich
GREP=$(mywhich
EGREP=$(mywhich
LS=$(mywhich
MKDIR=$(mywhich
LAST=$(mywhich
LOCALE=$(mywhich
PSTREE=$(mywhich
PS=$(mywhich
RM=$(mywhich
SLEEP=$(mywhich
MOUNT=$(mywhich
MV=$(mywhich
SORT=$(mywhich
TAIL=$(mywhich
UNAME=$(mywhich
UPTIME=$(mywhich
WHO=$(mywhich

awk
basename
cat
chkconfig
cp
cut
chmod
date
df
dmesg
echo
file
find
free
grep
egrep
ls
mkdir
last
locale
pstree
ps
rm
sleep
mount
mv
sort
tail
uname
uptime
who

)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)

ZIP=$(mywhich zip GZIP=$(mywhich gzip GAWK=$(mywhich gawk SED=$(mywhich sed GUNZIP=$(mywhich gunzip ) ) ) ) ) # Selinux SESTATUS=$(mywhich sestatus ) GETSEBOOL=$(mywhich getsebool ) SEMANAGE=$(mywhich semanage ) # Samba TESTPARM=$(mywhich testparm WBINFO=$(mywhich wbinfo ) ) # Apache APACHECTL=$(mywhich apachectl ) APACHE2CTL=$(mywhich apache2ctl ) # Packages APTCONFIG=$(mywhich RPM=$(mywhich ZYPPER=$(mywhich DPKG=$(mywhich DPKG_QUERY=$(mywhich EMERGE=$(mywhich YUM=$(mywhich apt-config rpm zypper dpkg dpkg-query emerge yum ) ) ) ) ) ) ) # Kernel Info MODINFO=$(mywhich modinfo SYSCTL=$(mywhich sysctl KSYMS=$(mywhich ksyms # H/W Info ACPI=$(mywhich CARDCTL=$(mywhich DUMPE2FS=$(mywhich DMIDECODE=$(mywhich FDISK=$(mywhich BLKID=$(mywhich HDPARM=$(mywhich HOSTNAME=$(mywhich HWINFO=$(mywhich HWCLOCK=$(mywhich LSMOD=$(mywhich LSPCI=$(mywhich LSPNP=$(mywhich IPVSADM=$(mywhich LSUSB=$(mywhich LSDEV=$(mywhich LSHAL=$(mywhich LSRAID=$(mywhich MDADM=$(mywhich PROCINFO=$(mywhich POWERMT=$(mywhich SMARTCTL=$(mywhich SFDISK=$(mywhich HWPARM=$(mywhich acpi cardclt dumpe2fs dmidecode fdisk blkid hdparm hostname hwinfo hwclock lsmod lspci lspnp ipvsadm lsusb lsdev lshal lsraid mdadm procinfo powermt smartclt sfdisk hwparm ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) .

SCSI_ID=$(mywhich ISCSIADM=$(mywhich MULTIPATH=$(mywhich DMSETUP=$(mywhich NTPQ=$(mywhich SYSP=$(mywhich _3DDIAG=$(mywhich LSHW=$(mywhich SYSTOOL=$(mywhich SWAPON=$(mywhich # Disks LVM=$(mywhich LVDISPLAY=$(mywhich VGS=$(mywhich PVSCAN=$(mywhich VGSCAN=$(mywhich VGDISPLAY=$(mywhich LVMDISKSCAN=$(mywhich PVSCAN=$(mywhich DEBUGREISERFS=$(mywhich HDPARM=$(mywhich EXPORTFS=$(mywhich REPQUOTA=$(mywhich scsi_id iscsiadm multipath dmsetup ntpq sysp 3Ddiag lshw systool swapon ) ) ) ) ) ) ) ) ) ) lvm lvdisplay vgs pvs vgscan vgdisplay lvmdiskscan pvscan debugreiserfs hdparm exportfs repquota TUNE2FS=$(mywhich tune2fs # Veritas FS PVDISPLAY=$(mywhich VXDG=$(mywhich VXDISK=$(mywhich VXPRINT=$(mywhich VXLICREP=$(mywhich pvdisplay vxdg vxdisk vxprint vxlicrep # Veritas Cluster HASTATUS=$(mywhich HARES=$(mywhich HAGRP=$(mywhich HATYPE=$(mywhich HAUSER=$(mywhich LLTSTAT=$(mywhich GABCONFIG=$(mywhich HACF=$(mywhich hastatus hares hagrp hatype hauser lltstat gabconfig hacf ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) # Redhat Cluster CLUSTAT=$(mywhich clustat ) CLUSVCADM=$(mywhich clusvcadm ) MKQDISK=$(mywhich mkqdisk ) # CRM Cluster CRM=$(mywhich CRM_MON=$(mywhich CRM_VERIFY=$(mywhich CIBADMIN=$(mywhich crm ) crm_mon ) crm_verify ) cibadmin ) # Network IFCONFIG=$(mywhich ifconfig ) IWCONFIG=$(mywhich iwconfig ) NETSTAT=$(mywhich netstat ) .

NFSSTAT=$(mywhich ROUTE=$(mywhich YPWHICH=$(mywhich IP=$(mywhich MIITOOL=$(mywhich IPTABLES=$(mywhich IPCHAINS=$(mywhich ETHTOOL=$(mywhich BRCTL=$(mywhich nfsstat route ypwhich ip mii-tool iptables ipchains ethtool brctl ) ) ) ) ) ) ) ) ) # Tuning IOSTAT=$(mywhich VMSTAT=$(mywhich IPCS=$(mywhich MODPROBE=$(mywhich DEPMOD=$(mywhich iostat vmstat ipcs modprobe depmod ) ) ) ) ) # Other RUNLEVEL=$(mywhich LSOF=$(mywhich LPQ=$(mywhich TAR=$(mywhich XVINFO=$(mywhich POSTCONF=$(mywhich runlevel lsof lpq tar xvinfo postconf ) ) ) ) ) ) # Virtual Server XM=$(mywhich xm VIRSH=$(mywhich virsh ) ) # Gentoo RC_UPDATE=$(mywhich rc-update ) } ############################################################################## # Get the command line options ############################################################################## while getopts "d:vhV" OPT do case "$OPT" in d) if [ $OPTARG = "/" ] . then echo "ERROR: root directory selected as target! " echo "Exiting. ." exit 1 elif [ $OPTARG != "" ] .. then TOPDIR=${OPTARG%%/} fi .

h) ShowUsage .${MYSHORTNAME}-${MYDATE}" TARFILE="${LOGDIR}.. then tput clear fi fi LOGTOP="${TOPDIR}/linux" LOGDIR="${LOGTOP}/explorer.${HOSTID}. then . s) FULLSOFT="1" .v) VERBOSE="1" . then /bin/mkdir -p $LOGDIR fi # go away and find ALL my commands for this script findCmds Echo "Creating Explorer Directory : $LOGDIR" if [ -d "$LOGTOP" ] . V) echo echo "LINUXexplo Version : $MYVERSION" echo exit 0 .tar. then if [[ "${LOGTOP}" != "/" && "${LOGTOP}" != "/var" && "${LOGTOP}" != "/usr" ] ] . then if [ -t 0 ] ..out" if [ ! -d $LOGDIR ] . then if [ ${VERBOSE} -gt 0 ] ...gz" NOTFNDLOG="${LOGDIR}/command_not_found. esac done ############################################################################## # MAIN ############################################################################## if [ ${VERBOSE} -gt 0 ] .

for Dir in etc system disks lp var logs hardware boot clusters virtual do if [ ! -d ${LOGDIR}/${Dir} ] . then $MKDIR -p $LOGDIR if [ $? -ne 0 ] . then $MKDIR -p ${LOGDIR}/${Dir} if [ $? -ne 0 ] . then echo "ERROR: This script is only for Linux systems " exit 1 fi # Make the directory I'm going to store my files if [ ! -d $LOGDIR ] . then echo "ERROR: Creating directory $LOGDIR" exit 1 else $CHMOD 750 ${LOGDIR}/${Dir} fi fi done ############################################################################## # We need the password file and the group file so that we can work out who # owns what file. then echo "ERROR: Creating directory $LOGDIR" exit 1 else $CHMOD 750 $LOGDIR fi fi echo "$MYVERSION" > ${LOGDIR}/rev # Create the default directories I'm going to use. # Notice we are not copying the shadow file !! ############################################################################## .echo "Removing ${LOGTOP}" fi $RM -rf ${LOGTOP} fi fi # echo "LOGDIR : ###BOT_TEXT###quot;${TOPDIR}/linux/${MYHOSTNAME}-${DATE}/output###BOT_TEXT###quot; " # make sure this is a linux system if [ "$($UNAME -s)" != "Linux" ] .

net fi if [ -f /etc/motd ] .net ] .$CP -p /etc/passwd ${LOGDIR}/etc/passwd $CP -p /etc/group ${LOGDIR}/etc/group if [ -f /etc/sudoers ] .net ${LOGDIR}/etc/issue. then $CP -p /etc/issue. then $MKDIR -p ${LOGDIR}${Dirname} fi . then $CP -p /etc/motd ${LOGDIR}/etc/motd fi ############################################################################## # Hardware/Proc Section ############################################################################## Echo "Hardware/Proc Section" # Collecting information from the proc directory $MKDIR -p ${LOGDIR}/proc $FIND /proc -type f -print 2>/dev/null | \ $GREP -v "/proc/kcore" | \ $GREP -v "/proc/bus/usb" | \ $GREP -v "/proc/xen/xenbus" | \ $GREP -v "/proc/acpi/event" | \ $GREP -v "pagemap" | \ $GREP -v "clear_refs" | \ $GREP -v "/proc/kmsg" > $TMPFILE for i in $($CAT $TMPFILE) do Dirname=$(dirname $i) Filename=$(basename $i) if [ ! -d ${LOGDIR}${Dirname} ] . then $CP -p "/etc/issue" ${LOGDIR}/system/issue fi if [ -f /etc/issue. then $CP -p /etc/sudoers ${LOGDIR}/etc/sudoers fi ############################################################################## # Release Section ############################################################################## Echo "Release Section" $CP -p /etc/*-release ${LOGDIR}/system if [ -f /etc/issue ] .

out fi done # Get a listing of the /dev directory $MKDIR ${LOGDIR}/dev $LS -laR /dev > ${LOGDIR}/dev/ls_-laR_dev.out 2>&1 > ${LOGDIR}/hardware/cardctl-ident.out if [ -x "$LSUSB" ] . then $LSUSB -xv > ${LOGDIR}/hardware/lsusb_-xv. then $CAT "$i" > ${LOGDIR}${Dirname}/${Filename} 2>&1 fi done $RM -f $TMPFILE ############################################################################## # Device Information ############################################################################## if [ -x $CARDCTL ] .out 2>&1 done fi # Get the port names from the HDA cards for i in /sys/class/scsi_host/host*/device/fc_host\:host*/port_name do if [ -f $i ] .out 2>&1 $LSPCI -n > ${LOGDIR}/hardware/lspci-n. then name=$( echo $i | sed 's/\//_/g' | sed 's/^_//g') echo "Port Name : $(cat $i )" >> ${LOGDIR}/hardware/cat_${name}.out 2>&1 fi .out 2>&1 if [ -x $LSPCI ] . then $CARDCTL info $CARDCTL status # $CARDCTL ident fi > ${LOGDIR}/hardware/cardctl-info.if [ -e "$i" ] .out 2>&1 $LSUSB -tv > ${LOGDIR}/hardware/lsusb_-tv.out 2>&1 > ${LOGDIR}/hardware/cardctl-status. then $LSPCI > ${LOGDIR}/hardware/lspci.out 2>&1 $LSPCI | while read line do Bus=$(/bin/echo $line 2>/dev/null | awk '{ print $1 }') $LSPCI -vv -s $Bus > ${LOGDIR}/hardware/lspci_-vv_-s_${Bus}.

py ] .out 2>&1 fi if [ -x "$ACPI" ] .def fi # Global Devices list if [ -x "$LSHAL" ] . then /usr/share/rhn/up2date_client/hardware.if [ -x "$LSDEV" ] .out fi $LS -laR /dev > ${LOGDIR}/hardware/ls-laR_dev.out . then $HWINFO 2>&1 > ${LOGDIR}/hardware/hwinfo. then $FREE > ${LOGDIR}/hardware/free. then $LSHAL > ${LOGDIR}/hardware/lshal. then $ACPI -V > ${LOGDIR}/hardware/acpi-V.out done fi ############################################################################## # Collect Hardware information from the hwinfo program if installed ############################################################################## if [ -x $HWINFO ] .py > ${LOGDIR}/hardware/hardware.def ] .out $FREE -k > ${LOGDIR}/hardware/free_-k. then $LSDEV -type adaptor > ${LOGDIR}/hardware/lsdev_-type_adaptor.out 2>&1 fi if [ -x "$SMARTCTL" ] .out 2>&1 fi if [ -x $FREE ] .out fi # Tape information if [ -f /etc/stinit.out fi if [ -x /usr/share/rhn/up2date_client/hardware. py. then $CP -p /etc/stinit.out if [ -d /udev ] . then for device in $( $LS /dev/hd[a-z] /dev/sd[a-z] /dev/st[0-9] /dev/sg[0-9] 2> /dev/null) do name=$( echo $device | sed 's/\//_/g' ) ${SMARTCTL} -a $device 2>/dev/null 1> ${LOGDIR}/hardware/smartct l-a_${name}. then $LS -laR /udev > ${LOGDIR}/hardware/ls-laR_udev.def ${LOGDIR}/etc/stinit.

map do if [ -f ${i} ] .out 2>&1 fi if [ -x "$PROCINFO" ] .conf /boot/grub/device.cnf" ) do . then $CP -p /etc/inittab fi ${LOGDIR}/etc/inittab ############################################################################## # /etc Config Files Section ############################################################################## Echo "/etc Config Files Section" for i in $( $FIND /etc -name "*.lst /boot/grub/grub. then $DMIDECODE > ${LOGDIR}/hardware/dmidecode.conf \ /boot/grub. then $CP -p ${i} ${LOGDIR}/${i} fi done if [ -f /etc/inittab ] .out 2>&1 fi if [ -x "$DMIDECODE" ] .conf" -o -name "*.out 2>&1 fi ############################################################################## # Boot Section ############################################################################## Echo "Boot Section" if [ -x "/sbin/lilo" ] . then $LSHW > ${LOGDIR}/hardware/lshw.out 2>&1 fi if [ -x $LSHW ] .out $HWINFO --scsi > ${LOGDIR}/hardware/hwinfo_--scsi.$HWINFO --isapnp > ${LOGDIR}/hardware/hwinfo_--isapnp.cf" -o -name "*.out 2>&1 $MKDIR -p ${LOGDIR}/boot/grub for i in /boot/grub/menu.out 2>&1 2>&1 $HWINFO --framebuffer > ${LOGDIR}/hardware/hwinfo_--framebuffer. then $PROCINFO > ${LOGDIR}/hardware/procinfo. then /sbin/lilo -q > $LOGDIR/system/lilo_-q 2>&1 fi $LS -alR /boot > ${LOGDIR}/system/ls-alR_boot.

d scripts ############################################################################## if [ -d /etc/profile. then $CP -p /etc/krb.txt fi $CP -p /etc/securetty $CP -p /etc/shells ${LOGDIR}/etc/securetty ${LOGDIR}/etc/shells if [ -f /etc/krb. then $CP -Rp /etc/profile. then $CP -Rp /etc/modprobe.txt ${LOGDIR}/etc/nologin.realms ] . then $CP -p /etc/nologin.d ${LOGDIR}/etc fi ############################################################################## # Copy the /etc/modprobe.d ] .d ${LOGDIR}/etc fi ############################################################################## # New in Fedora 9 ############################################################################## if [ -d /etc/event.realms ${LOGDIR}/etc/krb.d ] .d ] .d ${LOGDIR}/etc fi ############################################################################## # Get all the pcmcia config information ############################################################################## if [ -d /etc/pcmcia ] . then .d scripts ############################################################################## if [ -d /etc/profile. then if [ ! -d ${LOGDIR}/pcmcia ] .realms fi ############################################################################## # Copy the /etc/profile.txt ] .dirname="$(dirname $i)" filename="$(basename $i)" if [ ! -d ${LOGDIR}/${dirname} ] . then $CP -Rp /etc/event. then $MKDIR -p ${LOGDIR}/${dirname} fi $CP -p $i ${LOGDIR}/${dirname}/${filename} done if [ -f /etc/nologin.

out ${LOGDIR}/system/ipcs_-a. then $CAT /proc/stat fi > ${LOGDIR}/system/stat.out ${LOGDIR}/system/ipcs_-l. then $VMSTAT -s fi > ${LOGDIR}/system/vmstat_-s.out fi if [ -e /proc/stat ] .out ############################################################################## # OK not sure where this should go so I've put it here instead ############################################################################## if [ "$LSOF" != "" ] .out ${LOGDIR}/system/ps_auxw. then $CAT /proc/loadavg > ${LOGDIR}/system/loadavg.out 2>&1 ${LOGDIR}/system/uname_-a.out ${LOGDIR}/system/date.out ${LOGDIR}/system/who_-r.out ${LOGDIR}/system/ulimit_-a.out ${LOGDIR}/system/free. then $LSOF > ${LOGDIR}/system/lsof.out ${LOGDIR}/system/pstree.out fi 2>&1 ############################################################################## # Kernel Section ############################################################################## Echo "Kernel Section" $SYSCTL -A $UNAME -a $RUNLEVEL $WHO -r > > > > ${LOGDIR}/etc/sysctl_-A.out ${LOGDIR}/system/ps_-elf.out ${LOGDIR}/system/ipcs_-u.out .out ${LOGDIR}/system/uptime.opts ${LOGDIR}/etc/pcmcia fi ############################################################################## # Performance/System Section ############################################################################## Echo "Performance/System Section" if [ -e /proc/loadavg ] .out ${LOGDIR}/system/runlevel.$MKDIR -p ${LOGDIR}/etc/pcmcia fi $CP -R -p /etc/pcmcia/*.out $DATE $FREE $PS auxw $PS -lef $PSTREE $HOSTNAME $IPCS -a $IPCS -u $IPCS -l $UPTIME ulimit -a > > > > > > > > > > > if [ -x $VMSTAT ] .out ${LOGDIR}/system/hostname.

conf ] .if [ -f /etc/conf. then $MKDIR -p ${LOGDIR}/kernel/info fi $LSMOD | while read line do kernmod=$( echo $line | $AWK '{ print $1 }' ) $MODINFO $kernmod > ${LOGDIR}/kernel/info/${kernmod}.out 2>&1 > ${LOGDIR}/kernel/modules.dep ${LOGDIR}/kernel/modules. then $CP -p /etc/kernel-img.6 kernel ############################################################################## if [ -f /proc/config.out 2>&1 ############################################################################## # Just incase we have a debian system ############################################################################## if [ -f /etc/kernel-pkg.conf fi ############################################################################## # Get the kernel configuration details from a 2. then .conf ${LOGDIR}/etc/kernel-img.conf ] .gz ] . then gunzip -c /proc/config.gz > ${LOGDIR}/kernel/config fi ############################################################################## # Hot Plug Section ############################################################################## Echo "Hot Plug Section" if [ -d /etc/hotplug ] .out 2>&1 if [ -x $KSYMS ] .conf fi if [ -f /etc/kernel-img. then if [ ! -d ${LOGDIR}/etc/hotplug ] .out 2>&1 done $LSMOD > ${LOGDIR}/kernel/lsmod. then $CP -p /etc/kernel-pkg.out 2>&1 fi $CP -p /lib/modules/$($UNAME -r)/modules.modules fi ${LOGDIR}/etc/conf.conf ${LOGDIR}/etc/kernel-pkg.modules if [ ! -d ${LOGDIR}/kernel/info ] .out 2>&1 > ${LOGDIR}/kernel/depmod_-av.dep $MODPROBE -n -l -v $DEPMOD -av $CAT /proc/modules > ${LOGDIR}/kernel/modprobe_-n-l-v. then $CP -p /etc/conf. then $KSYMS > ${LOGDIR}/kernel/ksyms.modules ] .

out 2>&1 2>&1 $CAT /proc/mounts > ${LOGDIR}/disks/mounts. then $SWAPON -s > ${LOGDIR}/disks/swapon_-s. then $SFDISK -l $SFDISK -s fi > ${LOGDIR}/disks/sfdisk_-l.out 2>&1 2>&1 2>&1 2>&1 2>&1 if [ -x $SWAPON ] .out 2>&1 if [ -x $SFDISK ] . then $FDISK -l fi > ${LOGDIR}/disks/fdisk_-l.$MKDIR -p ${LOGDIR}/etc/hotplug fi cd /etc/hotplug $CP -Rp * ${LOGDIR}/etc/hotplug/ fi ############################################################################## # Disk Section ############################################################################## Echo "Disk Section" # Check to see what is mounted $DF $DF $DF $DF $DF -k -h -ki -aki -akih > > > > > ${LOGDIR}/disks/df_-k.out ${LOGDIR}/disks/df_-akih.out 2>&1 > ${LOGDIR}/disks/sfdisk_-s.out ${LOGDIR}/disks/df_-h.out ${LOGDIR}/disks/df_-aki.out 2>&1 # fstab Information $CP -p /etc/fstab ${LOGDIR}/disks/fstab # Display any quotas that my have been set $REPQUOTA -av > ${LOGDIR}/disks/repquota_-av 2>&1 ############################################################################## # Disk Format Information ############################################################################## DISKLIST=$($FDISK -l 2>/dev/null | grep "^/dev" | sed 's/[0-9]//g' | awk '{ pri nt $1 }' | sort -u) if [ -x $FDISK ] .out 2>&1 if [ -x $BLKID ] . then $BLKID > ${LOGDIR}/disks/blkid.out > ${LOGDIR}/disks/mount_-l.out 2>&1 .out fi 2>&1 $MOUNT $MOUNT -l > ${LOGDIR}/disks/mount.out ${LOGDIR}/disks/df_-ki.

out 2>&1 fi > ${LOGDIR}/disks/sfdisk_-l_-${N if [ -x $FDISK ] .out 2>&1 fi > ${LOGDIR}/disks/fdisk_-l_-${NE done if [ -x "$DUMPE2FS" ] .out 2>&1 $SCSI_ID -g -p 0x83 -d /dev/${i} -s /block/${i} \ > ${LOGDIR}/disks/scsi_id_-g_-p_0x83_${disk_name}. then $HDPARM -vIi $DISK NEWDISK} 2>&1 fi > ${LOGDIR}/disks/hdparm_-vIi_${ if [ -x $SFDISK ] . then disk_name=$(/bin/echo /dev/${i} | sed 's/\//_/g') $SCSI_ID -g -p 0x80 -d /dev/${i} -s /block/${i} \ > ${LOGDIR}/disks/scsi_id_-g_-p_0x80_${disk_name}.out 2>&1 done fi ############################################################################## # Collect Detailed SCSI information about the disks ############################################################################## if [ -x "$SCSI_ID" ] . then for i in $($LS sd[a-z] 2>/dev/null) do if [ -b /dev/${i} ] . then $SFDISK -l $DISK EWDISK}. then PARTS=$($FDISK -l 2>/dev/null | grep "^/dev" | awk '{ print $1 }') for parts in $PARTS do name=$(/bin/echo $parts | sed 's/\//_/g') $DUMPE2FS $parts > ${LOGDIR}/disks/dumpe2fs${name }.out 2>&1 fi . then $FDISK -l $DISK WDISK}.fi for DISK in $DISKLIST do NEWDISK=$(/bin/echo $DISK | sed s'/\/dev\///g' ) if [ -x $HDPARM ].

out 2>&1 $POWERMT display paths class=all t_display_paths_class=all. then $MULTIPATH -ll > ${LOGDIR}/disks/multipath_-ll. then $ISCSIADM -m session > ${LOGDIR}/disks/iscsiadm_-m_session. then $DMSETUP ls > ${LOGDIR}/disks/dmsetup_ls.out 2>&1 fi ############################################################################## # If we are using multi-pathings then print out the # multi-pathing information ############################################################################## if [ -x "$MULTIPATH" ] . then mkdir -p ${LOGDIR}/disks/emcpower $POWERMT check_registration t_check_registration.out 2>&1 $POWERMT display path t_display_path. then $SYSTOOL -c scsi_host -v > ${LOGDIR}/disks/systool_-c_scsi_host_-v.out 2>&1 done >${LOGDIR}/disks/emcpower/fdisk_ .out 2>&1 >${LOGDIR}/disks/emcpower/powerm >${LOGDIR}/disks/emcpower/powerm >${LOGDIR}/disks/emcpower/powerm >${LOGDIR}/disks/emcpower/powerm >${LOGDIR}/disks/emcpower/powerm >${LOGDIR}/disks/emcpower/powerm # Get the partition details for the EMC devices for emcdevice in $(ls /dev/emcpower*) do emc_disk_name=$(/bin/echo ${emcdevice} | sed 's/\//_/g') $FDISK -l $emcdevice -l_${emc_disk_name}.done fi if [ -x $SYSTOOL ] .out 2>&1 $MULTIPATH -v2 > ${LOGDIR}/disks/multipath_-v2.out 2>&1 $POWERMT display ports t_display_ports.out 2>&1 $POWERMT display dev=all t_display_dev=all.out 2>&1 $POWERMT display ports dev=all t_display_ports_dev=all.out 2>&1 fi if [ -x "$DMSETUP" ] .out 2>&1 fi # Check to see what iscsi devices have if [ -x "$ISCSIADM" ] .out 2>&1 fi # Check to see what emc powerpath devices we have if [ -x "$POWERMT" ] .

fi ############################################################################## # Veritas Volume Manager / Symantec Veritas Storage Foundation Information ############################################################################## # # Changes .out 2>&1 if [ -x $VXDISK ] .out 2>&1 $VXDISK -o alldgs list > ${LOGDIR}/disks/vxvm/vxdisk_li > ${LOGDIR}/disks/vxvm/vxdisk_-o .04-11-2008 # added licence checks # VxVM/VxFS Configuration Backups # Some minor bug fixes # ############################################################################## if [ -d /etc/vx/licenses/lic ] . then Echo "VxVM live configuration" if [ ! -d ${LOGDIR}/disks/vxvm ] . then $MKDIR -p ${LOGDIR}/etc/vx/licenses/lic fi $CP -Rp /etc/vx/licenses/lic ${LOGDIR}/etc/vx/licenses/ $VXLICREP -e > ${LOGDIR}/system/vxlicrep_-e. then $MKDIR -p ${LOGDIR}/etc/vx/cbr/bk fi $CP -Rp /etc/vx/cbr/bk ${LOGDIR}/etc/vx/cbr/ fi if [ -d /dev/vx ] ."Vincent S. then Echo "VxVM/VxFS Configuration Backups" if [ ! -d ${LOGDIR}/etc/vx/cbr/bk ] . then $VXDISK list st. Cojot" . then Echo "Veritas Volume Manager / Symantec Veritas Storage Foundation Section" Echo "VxVM/VxFS/VCS/VVR licensing Section" if [ ! -d ${LOGDIR}/etc/vx/licenses/lic ] .out 2>&1 fi if [ -d /etc/vx/cbr/bk ] . then $MKDIR -p ${LOGDIR}/disks/vxvm $MKDIR -p ${LOGDIR}/disks/vxvm/logs $MKDIR -p ${LOGDIR}/disks/vxvm/disk_groups fi $LS -laR /dev/vx > ${LOGDIR}/disks/vxvm/ls-lR_dev_vx.

out VOL=$(cat ${LOGDIR}/disks/vxvm/disk_groups/vxprint_-vng_${i}.o ut 2>&1 done fi ############################################################################## # Get the filesystems Characteristics ############################################################################## for i in $($DF -kl | grep ^/dev | awk '{ print $1 }') do if [ -x $TUNE2FS ] . then $VXDG -q list list._alldgs_list.out 2>&1 $VXPRINT h.out 2>&1 fi -Ath > ${LOGDIR}/disks/vxvm/vxprint_- -h > ${LOGDIR}/disks/vxvm/vxprint_- -hr > ${LOGDIR}/disks/vxvm/vxprint_- -th > ${LOGDIR}/disks/vxvm/vxprint_- -thrL > ${LOGDIR}/disks/vxvm/vxprint_- if [ -x $VXDG ] .out 2>&1 fi > ${LOGDIR}/disks/vxvm/vxdg_-q_- #-----------------------------------------------------------------------# Collect individual volume information #-----------------------------------------------------------------------for i in $($VXDG -q list|awk '{print $1}') do $VXDG list $i > ${LOGDIR}/disks/vxvm/disk_groups/vxdg_list_$ {i}.out ) $VXPRINT -hmQqg $i $VOL \ > ${LOGDIR}/disks/vxvm/disk_groups/vxprint_-hmQqg_4vxmk= ${i}.out 2>&1 $VXPRINT Ath.out 2>&1 $VXPRINT thrL.out $VXPRINT -vng $i > ${LOGDIR}/disks/vxvm/disk_groups/vxprint_-vn g_${i}.out 2>&1 $VXPRINT th.out 2>&1 $VXPRINT hr. then name=$(/bin/echo $i | sed 's/\//_/g') $TUNE2FS -l $i > ${LOGDIR}/disks/tunefs_-l_${name}.out 2>&1 $VXPRINT -hmQqg $i \ > ${LOGDIR}/disks/vxvm/disk_groups/vxprint_-hmQqg=${i}.out $VXDG -g $i free > ${LOGDIR}/disks/vxvm/disk_groups/vxdg_-g_fre e_${i}.out 2>&1 fi .

then $EXPORTFS -v > ${LOGDIR}/disks/exportfs_-v.out ] .out . then $CP -p /etc/raidtab ${LOGDIR}/etc/raidtab fi $MKDIR ${LOGDIR}/disks/raid if [ -x "$LSRAID" ] . then $RM -f ${LOGDIR}/disks/raid/mdadm--detail_${name}.out > /dev/null 2>&1 done fi if [ -x "$MDADM" ] . then for i in $( $LS /dev/md[0-9]* 2>/dev/null ) do name=$( echo $i | sed 's/\//_/g' ) $MDADM --detail $i > ${LOGDIR}/disks/raid/mdadm_--detail_${n ame}.out 2>&1 fi # This is what we have configured to be exported if [ -f /etc/exports ] . then $NFSSTAT -a > ${LOGDIR}/disks/nfsstat_-a. then for i in $( $LS /dev/md[0-9]* 2>/dev/null ) do name=$(/bin/echo $i | sed 's/\//_/g') $LSRAID -a $i > ${LOGDIR}/disks/raid/lsraid_-a_${name}.out 2>&1 fi ############################################################################## # Raid Information ############################################################################## if [ -f /etc/raidtab ] .master ] . then $CP -p /etc/exports ${LOGDIR}/etc/exports fi if [ -x "$NFSSTAT" ] . then $CP -p /etc/auto* ${LOGDIR}/etc fi # lets see what we have really exported if [ -x $EXPORTFS ] .done ############################################################################## # NFS Information ############################################################################## # Copy NFS config files around if [ -f /etc/auto.out > /dev/null 2>&1 if [ ! -s ${LOGDIR}/disks/raid/mdadm--detail_${name}.

out $LVMDISKSCAN -v > ${LVMDIR}/lvmdiskscan_-v. $3}' | while read line do Major=$(echo $line | awk '{print $1}' ) Minor=$(echo $line | awk '{print $2}' ) Device=$(echo $line | awk '{print $3}' ) List=$(ls -la /dev/mapper | grep "${Major}.fi done fi ############################################################################## # LVM Information ############################################################################## LVMDIR=${LOGDIR}/disks/lvm $MKDIR -p ${LVMDIR} if [ -x "$LVDISPLAY" ] .out $VGS -v > ${LVMDIR}/vgs-v.out $LVM lvs > ${LVMDIR}/lvm_lvs. ${Minor}" | awk '{print $(N F)}') echo "$Device = $List " >> ${LOGDIR}/disks/dm-info.out $VGSCAN -vv > ${LVMDIR}/vgscan_-vv. then $LVM dumpconfig > ${LVMDIR}/lvm_dumpconfig.out fi 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 ############################################################################## # DM Information ############################################################################## # Work out which dm device is being used by each filesystem grep dm-[0-9] /proc/diskstats | awk '{print $1. then $LVDISPLAY -vv > ${LVMDIR}/lvdisplay_-vv.out done ############################################################################## # Software Section ############################################################################## Echo "Software Section" . $2.out $PVDISPLAY -v > ${LVMDIR}/pvdisplay_-v.out $PVSCAN -v > ${LVMDIR}/pvscan_-v.out $VGDISPLAY -vv > ${LVMDIR}/vgdisplay_-vv.out fi if [ -x "$LVM" ] .out $PVSCAN -v > ${LVMDIR}/pvscan-v.

out 2>&1 fi # # Short Description of all packages installed # echo "Package_Name Version Size Descript > ${LOGDIR}/software/rpm-qa--queryformat.out echo "================================================================== =================" >> ${LOGDIR}/software/rpm-qa--queryformat.out ion" $RPM -qa --queryformat '%-25{NAME} %-16{VERSION} %-10{RELEASE} %-10{DIS TRIBUTION} %-10{SIZE} %-10{INSTALLTIME:date} %{SUMMARY}\n' | sort >> ${LOGDIR}/ software/rpm-qa--queryformat. then $RPM -Va > ${LOGDIR}/software/rpm-Va.. then $CHKCONFIG --list > ${LOGDIR}/software/chkconfig--list.out 2 >&1 if [ $? -ne 0 ] .. then echo "ERROR: ${line} problem" fi done # print a list os installed packages sorted by install time: $RPM -qa -last | tac > ${LOGDIR}/software/rpm-packages/rpm_-qa_-last.out 2>&1 # # Long Description of all packages installed # $RPM -qa > ${LOGDIR}/software/rpm_-qa 2>&1 $CAT ${LOGDIR}/software/rpm_-qa | while read line do $RPM -qi $line > ${LOGDIR}/software/rpm-packages/${line}.out ############################################################# # If you enable verification then this then it's going to # take a some time to complete.. ############################################################# if [ ${FULLSOFT} -gt 0 ] . then $CP -p /usr/lib/rpm/rpmrc ${LOGDIR}/software/rpmrc fi # Make a copy of the yum config files so that we can compare them YUMDIR=${LOGDIR}/software/yum .out 2>&1 fi fi if [ -f /usr/lib/rpm/rpmrc ] ....$MKDIR -p ${LOGDIR}/software/rpm-packages if [ -x "$RPM" ] .. then if [ -x "$CHKCONFIG" ] .

out 2>&1 $YUM info installed > ${YUMDIR}/yum_info_installed.conf ] . then $CP -p /var/lib/dpkg/status ${LOGDIR}/var/lib/dpkg/status fi if [ -x "$DPKG" ] .out 2>&1 $YUM -v repolist all > ${YUMDIR}/yum_-v_repolist_all. then $MKDIR -p $YUMDIR/yum.out fi if [ -x "$DPKG_QUERY" ] .conf fi if [ -f /etc/apt/apt.repos.out 2>&1 fi ############################################################################## # Some Debian specific info here for packages ############################################################################## if [ -f /var/lib/dpkg/available ] .list ] .list ${LOGDIR}/etc/apt/sources. then $DPKG_QUERY -W -W.d $CP /etc/yum.list fi if [ -f /etc/apt/apt. then $CP -p /etc/apt/sources.out $DPKG -al > ${LOGDIR}/software/dpkg_-al. then $MKDIR -p ${LOGDIR}/etc/apt fi if [ -f /etc/apt/sources.d ] .ou $DPKG --get-selections > ${LOGDIR}/software/dpkg_-get-s t elections.repos.out > ${LOGDIR}/software/dpkg-query_ .repos.conf ${LOGDIR}/etc/apt/apt.repos. then $CP -p /etc/apt/apt.conf ] . then $DPKG --list > ${LOGDIR}/software/dpkg_--list .if [ -d /etc/yum.d/ fi if [ -x "$YUM" ] . then $MKDIR -p ${LOGDIR}/var/lib/dpkg if [ -d /etc/apt ] .conf fi if [ -f /var/lib/dpkg/status ] . then $CP -p /etc/apt/apt.d/* $YUMDIR/yum.conf ${LOGDIR}/etc/apt/apt. then $YUM list installed > ${YUMDIR}/yum_list_installed.

$2. then /usr/bin/apt-config dump dump.fi if [ -x /usr/bin/apt-config ] . } if ($1 == "PV"){ print $2. } }' . $2. then $RC_UPDATE show >> ${LOGDIR}/software/rc-update_show.out if [ -d /var/db/pkg ] . do bzca t $x | \ awk -F= '{ if ($1 == "CATEGORY"){ printf "%s ".out fi > ${LOGDIR}/software/apt-config_ fi ############################################################################## # Some SuSE specific info here for packages ############################################################################## if [ -x "$ZYPPER" ] . then ( find /var/db/pkg -type f -name environment. done ) >> $GENTOPKGS fi # Show the bootup info if [ -x $RC_UPDATE ] .out . } if ($1 == "PN"){ printf "%s ". then $ZYPPER $ZYPPER $ZYPPER $ZYPPER $ZYPPER $ZYPPER $ZYPPER $ZYPPER $ZYPPER $ZYPPER repos locks patches packages patterns products services licenses targetos list-updates > > > > > > > > > > ${LOGDIR}/software/zypper_repos ${LOGDIR}/software/zypper_locks ${LOGDIR}/software/zypper_patches ${LOGDIR}/software/zypper_packages ${LOGDIR}/software/zypper_patterns ${LOGDIR}/software/zypper_products ${LOGDIR}/software/zypper_services ${LOGDIR}/software/zypper_licenses ${LOGDIR}/software/zypper_targetos ${LOGDIR}/software/zypper_list-updates 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 fi ############################################################################## # This Section is for Gentoo .bz2 | while read x.so we can work out what packages are installed # Provided by Adam Bills ############################################################################## GENTOPKGS=${LOGDIR}/software/gento_kgs.

then # /usr/bin/rhn-charsets # fi ############################################################################## # Systems Log Section ############################################################################## Echo "Systems Log Section" $CP -R -p /var/log/* ${LOGDIR}/logs . then $MKDIR -p ${LOGDIR}/etc/sysconfig fi $CP -p -R /etc/sysconfig/* ${LOGDIR}/etc/sysconfig fi ############################################################################## # RHN Section ############################################################################## if [ -d /etc/sysconfig/rhn ] . then $CP -pR /etc/rhn/ ${LOGDIR}/etc/rhn/ if [ -f /etc/sysconfig/rhn/systemid ] .fi ############################################################################## # sysconfig Section ############################################################################## Echo "sysconfig Section" if [ -d /etc/sysconfig ] .xsl $RDIR/systemid \ > $ROOT/$RHNDIR/systemid 2>&1 fi fi fi fi # if [ -x /usr/bin/rhn-schema-version ] . then Echo "RedHat Network Section" RDIR=${LOGDIR}/rhn $MKDIR -p ${RDIR} if [ -d /etc/rhn ] . then if [ ! -d ${LOGDIR}/etc/sysconfig ] . then if [ -x /usr/bin/xsltproc ] . then # /usr/bin/rhn-schema-version >$RDIR}/ # fi # if [ -x /usr/bin/rhn-charsets ] . then /usr/bin/xsltproc $UTILDIR/text.

out 2>&1 else echo "getsebool not installed " > ${LOGDIR}/selinux/getsebool_-a. then $SESTATUS -bv > ${SELINUXDIR}/sestatus_-bv. then Echo "Xen Section" $MKDIR -p ${VIRT}/xen XENETC=${LOGDIR}/xen if [ ! -d $XENETC ] .$DMESG > ${LOGDIR}/logs/dmesg. then $SEMANAGE fcontexts -l > ${SELINUXDIR}/semanage_fcontexts_-l.out 2>&1 fi if [ -x $GETSEBOOL ] . then .out 2> &1 fi ############################################################################## # Virtual Servers Information ############################################################################## VIRT=${LOGDIR}/virtual #-----------------------------------------------------------------------# Xen #-----------------------------------------------------------------------if [ -d /etc/xen ] .out 2>&1 fi if [ -x $SEMANAGE ] . then mkdir -p $XENETC fi $CP -Rp /etc/xen/* ${XENETC}/ $MKDIR -p ${VIRT}/xen if [ -x $XM ] . then $GETSEBOOL -a > ${LOGDIR}/selinux/getsebool_-a.out $LAST > ${LOGDIR}/logs/lastlog ############################################################################## # SELINUX ############################################################################## Echo "SElinux Section" SELINUXDIR=${LOGDIR}/selinux $MKDIR -p ${SELINUXDIR} if [ -x $SESTATUS ] .

out 2>&1 $XM network-list $myHost > $VIRT/xen/xm_network-l $XM uptime $myHost > $VIRT/xen/xm_uptime_${ $VIRSH dominfo $myHost > $VIRT/xen/virsh_dominf done fi fi ############################################################################## # VirtLib Information ############################################################################## #-----------------------------------------------------------------------# Virtlib #-----------------------------------------------------------------------if [ -x $VIRSH ] .out 2>&1 fi ############################################################################## # yp services ############################################################################## Echo "YP Services Section" YPDIR=${LOGDIR}/yp $MKDIR -p ${YPDIR} if [ -x "$YPWHICH" ] .out $VIRT/xen/xm_dmesg.out 2>&1 2>&1 2>&1 2>&1 2>&1 for myHost in $($XM list 2>/dev/null | egrep -v "VCPUs |^Domain -0") do ist_${myHost}.out 2>&1 done $VIRSH list --all > | | | | \ \ \ while read line $line >> ${VIRT}/libvirt/virsh_dominfo_${ $line >> ${VIRT}/libvirt/virsh_dumpxml_${ ${VIRT}/libvirt/virsh_list_--all.$XM $XM $XM $XM $XM list info logs dmesg vcpu-list > > > > > $VIRT/xen/xm_list.out 2>&1 $VIRSH dumpxml line}. then Echo "LibVirt Section" $MKDIR -p ${VIRT}/libvirt $VIRSH list --all 2>/dev/null grep -v "Id Name" egrep -v "\--|^$" awk '{print $2}' do $VIRSH dominfo line}.out 2>&1 myHost}.out $VIRT/xen/xm_info.out 2>&1 o_${myHost}.out $VIRT/xen/xm_log.out $VIRT/xen/xm_vcpu-list.out 2>&1 fi . then $YPWHICH -m > ${YPDIR}/ypwhich-m.

then $CP -p /etc/hosts. then $CP -p /etc/domainname ${LOGDIR}/etc/ $LS -lR /var/yp/$(cat /etc/domainname) > ${YPDIR}/ls_-lR.allow ${LOGDIR}/etc/hosts. then $CP -p /etc/shells ${LOGDIR}/etc/shells fi if [ -f /etc/network/interfaces ] .allow fi if [ -f /etc/hosts. then $CP -p /etc/hosts.deny ] . then $CP -p /etc/networks ${LOGDIR}/etc/networks fi if [ -f /etc/hosts.out 2>&1 fi ############################################################################## # Networking Section ############################################################################## Echo "Networking Section" for i in $($LS -d /etc/host* ) do filename=$(basename $i) $CP -p $i ${LOGDIR}/etc/${filename} done for i in $( $LS -d /etc/ftp* 2>/dev/null ) do filename=$(basename $i) $CP -p $i ${LOGDIR}/etc/$filename done $CP -p /etc/services ${LOGDIR}/etc/services if [ -f /etc/HOSTNAME ] .deny ${LOGDIR}/etc/hosts.allow ] .deny fi if [ -f /etc/shells ] .if [ -f /etc/domainname ] . then $CP -p /etc/hostname ${LOGDIR}/etc/hostname fi if [ -f /etc/networks ] . then $CP -p /etc/HOSTNAME ${LOGDIR}/etc/HOSTNAME fi if [ -f /etc/hostname ] . then .

out ${LOGDIR}/network/route_-nv.out ${LOGDIR}/network/ip_rule. then $IWCONFIG > ${LOGDIR}/network/iwconfig.out ${LOGDIR}/network/ip_link.if [ ! -d ${LOGDIR}/etc/network/interfaces ] .out ${LOGDIR}/network/netstat_-lav.out if [ -x "$IP" ] . then $BRCTL show > ${LOGDIR}/network/brctl_show.out ${LOGDIR}/network/netstat_-rn.out 2>&1 fi # # Collect bridging information # if [ -x "${BRCTL}" ] .out 2>&1 $BRCTL showstp $myBridge > ${LOGDIR}/network/btctl_showstp_${myBridge}. then $MKDIR -p ${LOGDIR}/etc/network/interfaces fi $CP -p /etc/network/interfaces ${LOGDIR}/etc/network/interfaces fi $MKDIR -p ${LOGDIR}/network $IFCONFIG -a $NETSTAT -rn $NETSTAT -lan $NETSTAT -lav $NETSTAT -tulpn $NETSTAT -ape $NETSTAT -uan $NETSTAT -s $ROUTE -nv > > > > > > > > > ${LOGDIR}/network/ifconfig_-a.out 2>&1 for myBridge in $($BRCTL show | grep -v "STP enabled" | grep ^[a-zA-Z] | aw k '{ print $1}') do $BRCTL showmacs $myBridge > ${LOGDIR}/network/btctl_showmacs_${myBridge} .out 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 if [ -x "$IWCONFIG" ] . then ${MIITOOL} > ${LOGDIR}/network/mii-tool.out ${LOGDIR}/network/ip_route.out ${LOGDIR}/network/netstat_-s.out ${LOGDIR}/network/netstat_-uan.out ${LOGDIR}/network/netstat_-ape. out 2>&1 done fi ############################################################################## .out 2>&1 fi if [ -x "${MIITOOL}" ] . then $IP add $IP route $IP link $IP rule fi > > > > ${LOGDIR}/network/ip_add.out ${LOGDIR}/network/netstat_-lan.out ${LOGDIR}/network/netstat_-tulpn.

then $IPCHAINS -L -n > ${LOGDIR}/network/ipchains_-L_-n. then XINETD=${LOGDIR}/etc/xinet.out fi ############################################################################## # Lets now check the network cards speeds ############################################################################## if [ -x "$ETHTOOL" ] .d .out > ${LOGDIR}/network/iptables-L.# Get the iptable information ############################################################################## if [ -x "$IPTABLES" ] . then for version in 4 6 do INTERFACES=$( cat /proc/net/dev | grep "[0-9]:" | awk -F: '{prin t $1 }' ) for i in $INTERFACES do $ETHTOOL $i > ${LOGDIR}/network/ethtool_ipv${version }_${i}. then $IPTABLES -L $IPTABLES -t filter -nvL L.out 2>&1 $ETHTOOL -S $i >> ${LOGDIR}/network/ethtool_ipv${version }_-S_${i}.out 2>&1 $ETHTOOL -i $i >> ${LOGDIR}/network/ethtool_ipv${version }_-i_${i}.out $IPTABLES -t nat -nvL .out $IPTABLES -t mangle -nvL L.out > ${LOGDIR}/network/iptables-t_filter-nv > ${LOGDIR}/network/iptables-t_mangle-nv > ${LOGDIR}/network/iptables_-t_nat_-nvL else echo "no iptables in kernel" > ${LOGDIR}/network/iptables-NO-IP-TABLES fi ############################################################################## # List the ipchains rules ############################################################################## if [ -x "$IPCHAINS" ] .d ] .out 2>&1 done done fi ############################################################################## # xinetd Section ############################################################################## Echo "xinetd Section" if [ -d /etc/xinet.

}' | \ # $SED s/###BOT_TEXT###quot;//g|/bin/sed s/\.) > /dev/ null 2>&1 fi ############################################################################## # Cluster Section ############################################################################## CLUSTERDIR=${LOGDIR}/clusters Echo "Cluster Section" #-------------------------------------------------------------------- . then $CP -p /etc/named.$MKDIR -p ${XINETD} for i in $($LS -d /etc/xinetd. then if [ ! -d ${LOGDIR}${DNSDIR} ] .boot ] .//g # ) # fi if [ "${DNSDIR}" != "" ] . tar xpf .boot ${LOGDIR}/etc/named.boot fi DNSDIR="" # if [ -f "/etc/named. then # DNSDIR=$($GREP -i directory /etc/named. then $CP -p /etc/xinetd. then $MKDIR -p ${LOGDIR}${DNSDIR} fi cd ${DNSDIR} $TAR cf .log ] . 2>/dev/null | ( cd ${LOGDIR}${DNSDIR} .log fi ############################################################################## # DNS Section ############################################################################## Echo "DNS Section" if [ -f /etc/named.conf | \ # $GREP -v ^# | \ # $GAWK '{ print $2 .log ${LOGDIR}/etc/xinetd.conf" ] ..d/* ) do filename=$(basename $i) $CP -p $i ${XINETD}/$filename done fi if [ -f /etc/xinetd.

out > $MyClusterDir/clusvcadm_-S.xml $CP -p /etc/cluster.out 2>&1 2>&1 fi # # List out Quorum devices # if [ -x $MKQDISK ] . then $CP -Rp /etc/cluster/* ${LOGDIR}/etc/cluster/ .conf ${CLUSTERDIR}/ocfs2/cluster.out 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 > $MyClusterDir/clusvcadm_-x.out fi 2>&1 # # Copy the cluster config files over # if [ -f /etc/cluster.xml $MyClusterDir/cluster.xml ${LOGDIR}/etc/cluster.conf $MKDIR -p ${CLUSTERDIR}/ocfs2 $CP -p /etc/ocfs2/cluster.conf ${LOGDIR}/etc/ocfs2/cluster.out $MyClusterDir/clustat_-l.conf fi #-------------------------------------------------------------------# Redhat Cluster #-------------------------------------------------------------------if [ -x $CLUSTAT ] .out $MyClusterDir/clustat_-I.out $MyClusterDir/clustat_-x.out $MyClusterDir/clustat_-f.out $MyClusterDir/clustat_-v.xml fi if [ -d /etc/cluster ] .xml ] .conf ] . then if [ ! -d ${LOGDIR}/etc/ocfs2 ] . then $MKQDISK -L >> $MyClusterDir/mkqdisk_-L. then $MKDIR -p ${LOGDIR}/etc/ocfs2 fi $CP -p /etc/ocfs2/cluster. then Echo "Veritas Cluster Section" MyClusterDir=${CLUSTERDIR}/redhat mkdir -p ${CLUSTERDIR}/redhat $CLUSTAT $CLUSTAT $CLUSTAT $CLUSTAT $CLUSTAT $CLUSTAT -f -l -I -v -x $CLUSVCADM -v $CLUSVCADM -S > > > > > > $MyClusterDir/clustat.# Oracles OCFS2 cluster filesystems #-------------------------------------------------------------------if [ -f /etc/ocfs2/cluster. then $CP -p /etc/cluster.

out ${VCSDIR}/gabconfig_-a.out ${VCSDIR}/hatype_-list. then . then $MKDIR -p ${LOGDIR}/var/VRTSvcs/log $CP -p /var/VRTSvcs/log/* ${LOGDIR}/var/VRTSvcs/log fi $HASTATUS -sum $HARES -list $HAGRP -list $HATYPE -list $HAUSER -list $LLTSTAT -vvn $GABCONFIG -a > > > > > > > ${VCSDIR}/hastatus_-sum.out 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 2>&1 $HACF -verify /etc/VRTSvcs/conf/config/main.out ${VCSDIR}/hauser_-list.out ${VCSDIR}/lltstat_-vvn.cf > ${VCSDIR}/hacf-verify.out 2 >&1 $CP -p /etc/llthosts $CP -p /etc/llttab $CP -p /etc/gabtab ${LOGDIR}/etc ${LOGDIR}/etc ${LOGDIR}/etc fi #-------------------------------------------------------------------# CRM/PaceMaker Cluster #-------------------------------------------------------------------Echo "CRM Cluster Section" CRMDIR=${CLUSTERDIR}/crm if [ -x $CRM_MON ] . then $MKDIR -p ${VCSDIR} fi $MKDIR -p ${LOGDIR}/etc/VRTSvcs/conf/config $CP -p /etc/VRTSvcs/conf/config/* ${LOGDIR}/etc/VRTSvcs/conf/config if [ -d /var/VRTSvcs/log ] .cf ] .out ${VCSDIR}/hagrp_-list.$CP -p /etc/cluster/* $MyClusterDir/ fi #-------------------------------------------------------------------# Veritas Cluster #-------------------------------------------------------------------if [ -f /etc/VRTSvcs/conf/config/main.out ${VCSDIR}/hares_-list. then Echo "Veritas Cluster Section" VCSDIR=${CLUSTERDIR}/veritas if [ ! -d $VCSDIR ] .

out > ${CRMDIR}/crm_configure_show. then $CRM_VERIFY -L fi > ${CRMDIR}/crm_verify_-L.out fi if [ -x $CRM_VERIFY ] .) fi ############################################################################## # Printer Section ############################################################################## Echo "Printer Section" PRINTDIR=${LOGDIR}/lp $MKDIR -p ${PRINTDIR} $MKDIR -p ${PRINTDIR}/general $MKDIR -p ${LOGDIR}/etc/printcap if [ -x /usr/bin/lpstat ] .out 2>&1 . | ( cd ${LOGDIR}/var/spool/cron . tar xpf .out fi fi ############################################################################## # Crontab Section ############################################################################## Echo "Crontab Section" $MKDIR -p ${LOGDIR}/etc/cron $CP -R -p /etc/cron* ${LOGDIR}/etc if [ -d /var/spool/cron ] .out if [ -x $CRM ] .out if [ -x $CIBADMIN ] .$MKDIR -p ${CRMDIR} $CRM_MON --version > ${CRMDIR}/crm_mon_--version.o ut $CRM configure show xml > ${CRMDIR}/crm_configure_show_x $CRM ra classes $CRM ra list ocf heartbeat > ${CRMDIR}/crm_ra_classes.out maker. then $CRM status $CRM configure show > ${CRMDIR}/crm_status.. then $MKDIR -p ${LOGDIR}/var/spool/cron cd /var/spool/cron $TAR cf .out tbeat. then /usr/bin/lpstat -t > ${PRINTDIR}/lpstat_-t.out > ${CRMDIR}/crm_ra_list_ocf_hear $CRM ra list ocf pacemaker > ${CRMDIR}/crm_ra_list_ocf_pace ml. then $CIBADMIN -Ql > ${CRMDIR}/cibadmin_-Ql.

cups > ${PRINTDIR}/lpq.cf ] .out 2>&1 if [ -x /usr/bin/lpq.d/* ${LOGDIR}/etc/pam/ ############################################################################## # Sendmail Section ############################################################################## Echo "Sendmail Section" $MKDIR -p ${LOGDIR}/etc/mail if [ -f /etc/sendmail. then $CP -p /etc/sendmail.cups. then /usr/sbin/lpc status > ${PRINTDIR}/lpstat_status.out 2>&1 fi ############################################################################## # openldap Section ############################################################################## Echo "Openldap Section" if [ -d /etc/openldap ] .cf ${LOGDIR}/etc/sendmail.cf fi . then $MKDIR -p ${LOGDIR}/etc/openldap $CP -p -R /etc/openldap/* ${LOGDIR}/etc/openldap fi ############################################################################## # pam Section ############################################################################## Echo "Pam Section" $MKDIR -p ${LOGDIR}/etc/pam $CP -p -R /etc/pam. then /usr/bin/lpq. then $CP /etc/printcap fi ${LOGDIR}/etc/printcap if [ -d /etc/cups ] . then $MKDIR -p ${LOGDIR}/etc/cups $CP -p -R /etc/cups/* ${LOGDIR}/etc/cups fi /usr/bin/lpq > ${PRINTDIR}/general/lpq.out 2>&1 fi if [ -f /etc/printcap ] .cups ] .fi if [ -x /usr/sbin/lpc ] .

if [ -f /etc/sendmail. then EXIMDIR=${LOGDIR}/etc $CP -p -R /etc/exim ${EXIMDIR} fi ############################################################################## # Time Section ############################################################################## Echo "Time Section" TIMEDIR=${LOGDIR}/etc/time if [ ! -d ${TIMEDIR} ] . then $MKDIR -p ${TIMEDIR} fi .out 2>&1 fi ############################################################################## # Exim Section ############################################################################## Echo "Exim Section" if [ -d /etc/exim ] .cw ${LOGDIR}/etc/sendmail.out 2>&1 $POSTCONF -l > ${POSTDIR}/postconf_-l.cw fi if [ -d /etc/mail ] . then $CP -p /etc/aliases ${LOGDIR}/etc/aliases fi if [ -f /etc/mail/aliases ] .db) .cw ] . then for i in $($LS -d /etc/mail/* | $GREP -v \. then $CP -p /etc/mail/aliases ${LOGDIR}/etc/mail/aliases fi ############################################################################## # Postfix Section ############################################################################## Echo "Postfix Section" if [ -d /etc/postfix ] . do $CP -R -p $i ${LOGDIR}/etc/mail done fi if [ -f /etc/aliases ] . then POSTDIR=${LOGDIR}/etc/postfix $MKDIR -p $POSTDIR $CP -p -R /etc/postfix/* ${POSTDIR} $POSTCONF -v > ${POSTDIR}/postconf_-v. then $CP -p /etc/sendmail.

then $CP -p /etc/ntp/ntpservers ${LOGDIR}/etc fi ############################################################################## # PPP Section ############################################################################## Echo "PPP Section" PPPDIR=${LOGDIR}/etc/ppp if [ ! -d ${PPPDIR} ] .* $CP -p -R /etc/ppp/peers/* fi ${PPPDIR} > /dev/null 2>&1 ${PPPDIR}/peers ############################################################################## # Apache Section ############################################################################## . then $MKDIR -p ${PPPDIR} $MKDIR -p ${PPPDIR}/peers fi if [ -d /etc/ppp ] .drift ] . then $CP -p /etc/timezone ${TIMEDIR}/timezone fi if [ -f /usr/share/zoneinfo ] .drift fi if [ -x $HWCLOCK ] . then $CP -p /etc/ntp/step-tickers ${LOGDIR}/etc fi if [ -f /etc/ntp/ntpservers ] . then $CP -p /etc/ntp. then $HWCLOCK --show > ${TIMEDIR}/hwclock_--show.out 2>&1 fi if [ -f /etc/ntp/step-tickers ] .out fi if [ -x $NTPQ ] .drift ${TIMEDIR}/ntp. then $CP -p /usr/share/zoneinfo ${TIMEDIR}/zoneinfo fi if [ -f /etc/ntp. then $CP -p /etc/ppp/options. then $CP -R -p /etc/ppp/* fi ${PPPDIR} 2>&1 if [ -d /etc/wvdial ] . then $NTPQ -p > ${TIMEDIR}/ntpq_-p.$DATE > ${TIMEDIR}/date if [ -f /etc/timezone ] .

out 2>&1 fi ############################################################################## # Openssh Section ############################################################################## Echo "Openssh Section" SSHDIR=${LOGDIR}/etc/ssh $MKDIR -p ${SSHDIR} if [ -f /etc/nologin ] . then $WBINFO -g > ${SAMBADIR}/wbinfo_-g. then $CP -p /etc/nologin ${LOGDIR}/etc/nologin fi .out 2>&1 fi if [ -x $APACHE2CTL ] . then $MKDIR -p ${SAMBADIR} fi if [ -x $TESTPARM ] . then $MKDIR -p ${APACHEDIR} fi if [ -x $APACHECTL ] . then $APACHE2CTL status > ${APACHEDIR}/apache2ctl_status. then echo "y" | $TESTPARM > ${SAMBADIR}/testparm. then $APACHECTL status > ${APACHEDIR}/apachectl_status.out 2>&1 fi ############################################################################## # Samba Section ############################################################################## Echo "Samba Section" SAMBADIR=${LOGDIR}/disks/samba if [ ! -d ${SAMBADIR} ] .out 2>&1 fi if [ -x $WBINFO ] .Echo "Apache Section" if [ -d /etc/httpd ] . then APACHEDIR=${LOGDIR}/httpd else APACHEDIR=${LOGDIR}/apache fi if [ ! -d $APACHEDIR ] .out 2>&1 $WBINFO -u > ${SAMBADIR}/wbinfo_-g.

then $_3DDIAG > ${XDIR}/3Ddiag. then $CP -p /etc/ssh/ssh_config ${SSHDIR}/ssh_config fi if [ -d /etc/ssh/sshd_config ] .conf | sed -e /^Password/d > ${LOGDIR}/etc/wvdial. then -c -s mouse -s keyboard if [ -x $_3DDIAG ] .out > ${XDIR}/sysp_-s_mouse.if [ -d /etc/ssh/ssh_config ] . then $CP -R -p /etc/X11 fi ${LOGDIR}/etc if [ -x $SYSP $SYSP $SYSP $SYSP fi > ${XDIR}/sysp_-c. then $CAT /etc/wvdial.out ] .conf ] . then $CP -p /etc/ssh/sshd_config ${SSHDIR}/sshd_config fi ############################################################################## # X11 Section ############################################################################## Echo "X11 Section" XDIR=${LOGDIR}/X $MKDIR -p $XDIR if [ -d /etc/X11 ] .out > ${XDIR}/sysp_-s_keyboard. ############################################################################## if [ -f /etc/wvdial.out fi ############################################################################## # This section is for removing any information # about hardcoded passwords inserted in files.conf fi ############################################################################## # Tar Up Support Directory ###############################################ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ .