Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
/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
on.
FULLSOFT=0
#
# Ensure that we are the root user
#
if [ "$WHOAMI" != "root" ] ; then
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
##############################################################################
#
#
Function : Usage
#
#
Notes : N/A
#
##############################################################################
function ShowUsage
{
#------------------------------------------------------------------# Show help message
#------------------------------------------------------------------echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
exit
##############################################################################
#
#
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)
v) VERBOSE="1"
;;
s) FULLSOFT="1"
;;
h) ShowUsage
;;
V) echo
echo "LINUXexplo Version : $MYVERSION"
echo
exit 0
;;
esac
done
##############################################################################
#
MAIN
##############################################################################
if [ ! -d $LOGDIR ] ; 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" ] ; then
if [[ "${LOGTOP}" != "/" && "${LOGTOP}" != "/var" && "${LOGTOP}" != "/usr" ]
] ; then
if [ ${VERBOSE} -gt 0 ] ; then
if [ -f /etc/sudoers ] ; then
$CP -p /etc/sudoers ${LOGDIR}/etc/sudoers
fi
##############################################################################
# Release Section
##############################################################################
Echo "Release Section"
$CP -p /etc/*-release ${LOGDIR}/system
if [ -f /etc/issue ] ; then
$CP -p "/etc/issue" ${LOGDIR}/system/issue
fi
if [ -f /etc/issue.net ] ; then
$CP -p /etc/issue.net ${LOGDIR}/etc/issue.net
fi
if [ -f /etc/motd ] ; 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
$MKDIR -p ${LOGDIR}${Dirname}
fi
if [ -e "$i" ] ; then
$CAT "$i" > ${LOGDIR}${Dirname}/${Filename} 2>&1
fi
done
$RM -f $TMPFILE
##############################################################################
#
Device Information
##############################################################################
if [ -x $CARDCTL ] ; then
$CARDCTL info
$CARDCTL status
# $CARDCTL ident
fi
if [ -x $LSPCI ] ; then
$LSPCI
> ${LOGDIR}/hardware/lspci.out 2>&1
$LSPCI -n
> ${LOGDIR}/hardware/lspci-n.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}.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 ] ; then
name=$( echo $i | sed 's/\//_/g' | sed 's/^_//g')
echo "Port Name : $(cat $i )" >> ${LOGDIR}/hardware/cat_${name}.
out
fi
done
if [ -x "$LSDEV" ] ; then
$LSDEV -type adaptor > ${LOGDIR}/hardware/lsdev_-type_adaptor.out 2>&1
fi
if [ -x "$ACPI" ] ; then
$ACPI -V > ${LOGDIR}/hardware/acpi-V.out 2>&1
fi
if [ -x $FREE ] ; then
$FREE
> ${LOGDIR}/hardware/free.out
$FREE -k > ${LOGDIR}/hardware/free_-k.out
fi
$LS -laR /dev > ${LOGDIR}/hardware/ls-laR_dev.out
if [ -d /udev ] ; then
$LS -laR /udev > ${LOGDIR}/hardware/ls-laR_udev.out
fi
# Tape information
if [ -f /etc/stinit.def ] ; then
$CP -p /etc/stinit.def ${LOGDIR}/etc/stinit.def
fi
# Global Devices list
if [ -x "$LSHAL" ] ; then
$LSHAL > ${LOGDIR}/hardware/lshal.out
fi
if [ -x /usr/share/rhn/up2date_client/hardware.py ] ; then
/usr/share/rhn/up2date_client/hardware.py > ${LOGDIR}/hardware/hardware.
py.out 2>&1
fi
if [ -x "$SMARTCTL" ] ; 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}.out
done
fi
##############################################################################
# Collect Hardware information from the hwinfo program if installed
##############################################################################
if [ -x $HWINFO ] ; then
$HWINFO
2>&1
> ${LOGDIR}/hardware/hwinfo.out
$HWINFO --isapnp
> ${LOGDIR}/hardware/hwinfo_--isapnp.out
$HWINFO --scsi
> ${LOGDIR}/hardware/hwinfo_--scsi.out
2>&1
2>&1
$HWINFO --framebuffer > ${LOGDIR}/hardware/hwinfo_--framebuffer.out
2>&1
fi
if [ -x "$PROCINFO" ] ; then
$PROCINFO > ${LOGDIR}/hardware/procinfo.out 2>&1
fi
if [ -x "$DMIDECODE" ] ; then
$DMIDECODE > ${LOGDIR}/hardware/dmidecode.out 2>&1
fi
if [ -x $LSHW ] ; then
$LSHW > ${LOGDIR}/hardware/lshw.out 2>&1
fi
##############################################################################
# Boot Section
##############################################################################
Echo "Boot Section"
if [ -x "/sbin/lilo" ] ; then
/sbin/lilo -q > $LOGDIR/system/lilo_-q 2>&1
fi
$LS -alR /boot > ${LOGDIR}/system/ls-alR_boot.out 2>&1
$MKDIR -p ${LOGDIR}/boot/grub
for i in /boot/grub/menu.lst /boot/grub/grub.conf \
/boot/grub.conf /boot/grub/device.map
do
if [ -f ${i} ] ; then
$CP -p ${i} ${LOGDIR}/${i}
fi
done
if [ -f /etc/inittab ] ; then
$CP -p /etc/inittab
fi
${LOGDIR}/etc/inittab
##############################################################################
# /etc Config Files Section
##############################################################################
Echo "/etc Config Files Section"
for i in $( $FIND /etc -name "*.conf" -o -name "*.cf" -o -name "*.cnf" )
do
dirname="$(dirname $i)"
filename="$(basename $i)"
if [ ! -d ${LOGDIR}/${dirname} ] ; then
$MKDIR -p ${LOGDIR}/${dirname}
fi
$CP -p $i ${LOGDIR}/${dirname}/${filename}
done
if [ -f /etc/nologin.txt ] ; then
$CP -p /etc/nologin.txt ${LOGDIR}/etc/nologin.txt
fi
$CP -p /etc/securetty
$CP -p /etc/shells
${LOGDIR}/etc/securetty
${LOGDIR}/etc/shells
if [ -f /etc/krb.realms ] ; then
$CP -p /etc/krb.realms ${LOGDIR}/etc/krb.realms
fi
##############################################################################
# Copy the /etc/profile.d scripts
##############################################################################
if [ -d /etc/profile.d ] ; then
$CP -Rp /etc/profile.d ${LOGDIR}/etc
fi
##############################################################################
# Copy the /etc/modprobe.d scripts
##############################################################################
if [ -d /etc/profile.d ] ; then
$CP -Rp /etc/modprobe.d ${LOGDIR}/etc
fi
##############################################################################
# New in Fedora 9
##############################################################################
if [ -d /etc/event.d ] ; then
$CP -Rp /etc/event.d ${LOGDIR}/etc
fi
##############################################################################
# Get all the pcmcia config information
##############################################################################
if [ -d /etc/pcmcia ] ; then
if [ ! -d ${LOGDIR}/pcmcia ] ; then
$MKDIR -p ${LOGDIR}/etc/pcmcia
fi
$CP -R -p /etc/pcmcia/*.opts
${LOGDIR}/etc/pcmcia
fi
##############################################################################
# Performance/System Section
##############################################################################
Echo "Performance/System Section"
if [ -e /proc/loadavg ] ; then
$CAT /proc/loadavg
> ${LOGDIR}/system/loadavg.out
fi
if [ -e /proc/stat ] ; then
$CAT /proc/stat
fi
> ${LOGDIR}/system/stat.out
$DATE
$FREE
$PS auxw
$PS -lef
$PSTREE
$HOSTNAME
$IPCS -a
$IPCS -u
$IPCS -l
$UPTIME
ulimit -a
>
>
>
>
>
>
>
>
>
>
>
if [ -x $VMSTAT ] ; then
$VMSTAT -s
fi
> ${LOGDIR}/system/vmstat_-s.out
${LOGDIR}/system/date.out
${LOGDIR}/system/free.out
${LOGDIR}/system/ps_auxw.out
${LOGDIR}/system/ps_-elf.out
${LOGDIR}/system/pstree.out
${LOGDIR}/system/hostname.out
${LOGDIR}/system/ipcs_-a.out
${LOGDIR}/system/ipcs_-u.out
${LOGDIR}/system/ipcs_-l.out
${LOGDIR}/system/uptime.out
${LOGDIR}/system/ulimit_-a.out
##############################################################################
# OK not sure where this should go so I've put it here instead
##############################################################################
if [ "$LSOF" != "" ] ; then
$LSOF > ${LOGDIR}/system/lsof.out
fi
2>&1
##############################################################################
# Kernel Section
##############################################################################
Echo "Kernel Section"
$SYSCTL -A
$UNAME -a
$RUNLEVEL
$WHO -r
>
>
>
>
${LOGDIR}/etc/sysctl_-A.out 2>&1
${LOGDIR}/system/uname_-a.out
${LOGDIR}/system/runlevel.out
${LOGDIR}/system/who_-r.out
if [ -f /etc/conf.modules ] ; then
$CP -p /etc/conf.modules
fi
${LOGDIR}/etc/conf.modules
if [ ! -d ${LOGDIR}/kernel/info ] ; 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
done
$LSMOD
if [ -x $KSYMS ] ; then
$KSYMS
> ${LOGDIR}/kernel/ksyms.out 2>&1
fi
$CP -p /lib/modules/$($UNAME -r)/modules.dep ${LOGDIR}/kernel/modules.dep
$MODPROBE -n -l -v
$DEPMOD -av
$CAT /proc/modules
##############################################################################
# Just incase we have a debian system
##############################################################################
if [ -f /etc/kernel-pkg.conf ] ; then
$CP -p /etc/kernel-pkg.conf ${LOGDIR}/etc/kernel-pkg.conf
fi
if [ -f /etc/kernel-img.conf ] ; then
$CP -p /etc/kernel-img.conf ${LOGDIR}/etc/kernel-img.conf
fi
##############################################################################
# Get the kernel configuration details from a 2.6 kernel
##############################################################################
if [ -f /proc/config.gz ] ; then
gunzip -c /proc/config.gz > ${LOGDIR}/kernel/config
fi
##############################################################################
# Hot Plug Section
##############################################################################
Echo "Hot Plug Section"
if [ -d /etc/hotplug ] ; then
if [ ! -d ${LOGDIR}/etc/hotplug ] ; then
$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_-h.out
${LOGDIR}/disks/df_-ki.out
${LOGDIR}/disks/df_-aki.out
${LOGDIR}/disks/df_-akih.out
2>&1
2>&1
2>&1
2>&1
2>&1
if [ -x $SWAPON ] ; then
$SWAPON -s > ${LOGDIR}/disks/swapon_-s.out
fi
2>&1
$MOUNT
$MOUNT -l
> ${LOGDIR}/disks/mount.out
> ${LOGDIR}/disks/mount_-l.out
2>&1
2>&1
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 ] ; then
$FDISK -l
fi
if [ -x $SFDISK ] ; then
$SFDISK -l
$SFDISK -s
fi
if [ -x $BLKID ] ; then
$BLKID
fi
for DISK in $DISKLIST
do
NEWDISK=$(/bin/echo $DISK | sed s'/\/dev\///g' )
if [ -x $HDPARM ]; then
$HDPARM -vIi $DISK
NEWDISK} 2>&1
fi
> ${LOGDIR}/disks/hdparm_-vIi_${
if [ -x $SFDISK ] ; then
$SFDISK -l $DISK
EWDISK}.out 2>&1
fi
> ${LOGDIR}/disks/sfdisk_-l_-${N
if [ -x $FDISK ] ; then
$FDISK -l $DISK
WDISK}.out 2>&1
fi
> ${LOGDIR}/disks/fdisk_-l_-${NE
done
if [ -x "$DUMPE2FS" ] ; 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
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
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
$SCSI_ID -g -p 0x83 -d /dev/${i} -s /block/${i} \
> ${LOGDIR}/disks/scsi_id_-g_-p_0x83_${disk_name}.out 2>&1
fi
done
fi
if [ -x $SYSTOOL ] ; then
$SYSTOOL -c scsi_host -v > ${LOGDIR}/disks/systool_-c_scsi_host_-v.out 2>&1
fi
##############################################################################
# If we are using multi-pathings then print out the
# multi-pathing information
##############################################################################
if [ -x "$MULTIPATH" ] ; then
$MULTIPATH -ll > ${LOGDIR}/disks/multipath_-ll.out 2>&1
$MULTIPATH -v2 > ${LOGDIR}/disks/multipath_-v2.out 2>&1
fi
if [ -x "$DMSETUP" ] ; then
$DMSETUP ls > ${LOGDIR}/disks/dmsetup_ls.out 2>&1
fi
# Check to see what iscsi devices have
if [ -x "$ISCSIADM" ] ; then
$ISCSIADM -m session > ${LOGDIR}/disks/iscsiadm_-m_session.out 2>&1
fi
# Check to see what emc powerpath devices we have
if [ -x "$POWERMT" ] ; then
mkdir -p ${LOGDIR}/disks/emcpower
$POWERMT check_registration
t_check_registration.out 2>&1
$POWERMT display path
t_display_path.out 2>&1
$POWERMT display ports
t_display_ports.out 2>&1
$POWERMT display paths class=all
t_display_paths_class=all.out 2>&1
$POWERMT display ports dev=all
t_display_ports_dev=all.out 2>&1
$POWERMT display dev=all
t_display_dev=all.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
>${LOGDIR}/disks/emcpower/fdisk_
fi
##############################################################################
# Veritas Volume Manager / Symantec Veritas Storage Foundation Information
##############################################################################
#
# Changes - "Vincent S. Cojot" - 04-11-2008
#
added licence checks
#
VxVM/VxFS Configuration Backups
#
Some minor bug fixes
#
##############################################################################
if [ -d /etc/vx/licenses/lic ] ; then
Echo "Veritas Volume Manager / Symantec Veritas Storage Foundation Section"
Echo "VxVM/VxFS/VCS/VVR licensing Section"
if [ ! -d ${LOGDIR}/etc/vx/licenses/lic ] ; 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.out 2>&1
fi
if [ -d /etc/vx/cbr/bk ] ; then
Echo "VxVM/VxFS Configuration Backups"
if [ ! -d ${LOGDIR}/etc/vx/cbr/bk ] ; then
$MKDIR -p ${LOGDIR}/etc/vx/cbr/bk
fi
$CP -Rp /etc/vx/cbr/bk ${LOGDIR}/etc/vx/cbr/
fi
if [ -d /dev/vx ] ; then
Echo "VxVM live configuration"
if [ ! -d ${LOGDIR}/disks/vxvm ] ; 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 2>&1
if [ -x $VXDISK ] ; then
$VXDISK list
st.out
2>&1
$VXDISK -o alldgs list
> ${LOGDIR}/disks/vxvm/vxdisk_li
> ${LOGDIR}/disks/vxvm/vxdisk_-o
_alldgs_list.out
2>&1
$VXPRINT
Ath.out
2>&1
$VXPRINT
h.out
2>&1
$VXPRINT
hr.out
2>&1
$VXPRINT
th.out
2>&1
$VXPRINT
thrL.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 ] ; then
$VXDG -q list
list.out 2>&1
fi
> ${LOGDIR}/disks/vxvm/vxdg_-q_-
done
##############################################################################
# NFS Information
##############################################################################
# Copy NFS config files around
if [ -f /etc/auto.master ] ; then
$CP -p /etc/auto*
${LOGDIR}/etc
fi
# lets see what we have really exported
if [ -x $EXPORTFS ] ; then
$EXPORTFS -v
> ${LOGDIR}/disks/exportfs_-v.out 2>&1
fi
# This is what we have configured to be exported
if [ -f /etc/exports ] ; then
$CP -p /etc/exports
${LOGDIR}/etc/exports
fi
if [ -x "$NFSSTAT" ] ; then
$NFSSTAT -a > ${LOGDIR}/disks/nfsstat_-a.out 2>&1
fi
##############################################################################
# Raid Information
##############################################################################
if [ -f /etc/raidtab ] ; then
$CP -p /etc/raidtab ${LOGDIR}/etc/raidtab
fi
$MKDIR ${LOGDIR}/disks/raid
if [ -x "$LSRAID" ] ; 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 >
/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 > /dev/null 2>&1
if [ ! -s ${LOGDIR}/disks/raid/mdadm--detail_${name}.out ] ; then
$RM -f ${LOGDIR}/disks/raid/mdadm--detail_${name}.out
fi
done
fi
##############################################################################
# LVM Information
##############################################################################
LVMDIR=${LOGDIR}/disks/lvm
$MKDIR -p ${LVMDIR}
if [ -x "$LVDISPLAY" ] ; then
$LVDISPLAY -vv > ${LVMDIR}/lvdisplay_-vv.out
$VGDISPLAY -vv > ${LVMDIR}/vgdisplay_-vv.out
$VGSCAN -vv
> ${LVMDIR}/vgscan_-vv.out
$LVMDISKSCAN -v > ${LVMDIR}/lvmdiskscan_-v.out
$PVSCAN -v
> ${LVMDIR}/pvscan_-v.out
$PVDISPLAY -v > ${LVMDIR}/pvdisplay_-v.out
$VGS -v
> ${LVMDIR}/vgs-v.out
$PVSCAN -v
> ${LVMDIR}/pvscan-v.out
fi
if [ -x "$LVM" ] ; then
$LVM dumpconfig > ${LVMDIR}/lvm_dumpconfig.out
$LVM lvs
> ${LVMDIR}/lvm_lvs.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, $2, $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}, ${Minor}" | awk '{print $(N
F)}')
echo "$Device = $List " >> ${LOGDIR}/disks/dm-info.out
done
##############################################################################
# Software Section
##############################################################################
Echo "Software Section"
$MKDIR -p ${LOGDIR}/software/rpm-packages
if [ -x "$RPM" ] ; then
if [ -x "$CHKCONFIG" ] ; then
$CHKCONFIG --list > ${LOGDIR}/software/chkconfig--list.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"
# Make a copy of the yum config files so that we can compare them
YUMDIR=${LOGDIR}/software/yum
if [ -d /etc/yum.repos.d ] ; then
$MKDIR -p $YUMDIR/yum.repos.d
$CP /etc/yum.repos.d/* $YUMDIR/yum.repos.d/
fi
if [ -x "$YUM" ] ; then
$YUM list installed > ${YUMDIR}/yum_list_installed.out 2>&1
$YUM info installed > ${YUMDIR}/yum_info_installed.out 2>&1
$YUM -v repolist all > ${YUMDIR}/yum_-v_repolist_all.out 2>&1
fi
##############################################################################
# Some Debian specific info here for packages
##############################################################################
if [ -f /var/lib/dpkg/available ] ; then
$MKDIR -p ${LOGDIR}/var/lib/dpkg
if [ -d /etc/apt ] ; then
$MKDIR -p ${LOGDIR}/etc/apt
fi
if [ -f /etc/apt/sources.list ] ; then
$CP -p /etc/apt/sources.list ${LOGDIR}/etc/apt/sources.list
fi
if [ -f /etc/apt/apt.conf ] ; then
$CP -p /etc/apt/apt.conf ${LOGDIR}/etc/apt/apt.conf
fi
if [ -f /etc/apt/apt.conf ] ; then
$CP -p /etc/apt/apt.conf ${LOGDIR}/etc/apt/apt.conf
fi
if [ -f /var/lib/dpkg/status ] ; then
$CP -p /var/lib/dpkg/status ${LOGDIR}/var/lib/dpkg/status
fi
if [ -x "$DPKG" ] ; then
$DPKG --list
> ${LOGDIR}/software/dpkg_--list
.out
$DPKG -al
> ${LOGDIR}/software/dpkg_-al.ou
$DPKG --get-selections
> ${LOGDIR}/software/dpkg_-get-s
t
elections.out
fi
if [ -x "$DPKG_QUERY" ] ; then
$DPKG_QUERY -W
-W.out
> ${LOGDIR}/software/dpkg-query_
fi
if [ -x /usr/bin/apt-config ] ; then
/usr/bin/apt-config dump
dump.out
fi
> ${LOGDIR}/software/apt-config_
fi
##############################################################################
# Some SuSE specific info here for packages
##############################################################################
if [ -x "$ZYPPER" ] ; 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 - so we can work out what packages are installed
# Provided by Adam Bills
##############################################################################
GENTOPKGS=${LOGDIR}/software/gento_kgs.out
if [ -d /var/db/pkg ] ; then
( find /var/db/pkg -type f -name environment.bz2 | while read x; do bzca
t $x | \
awk -F= '{
if ($1 == "CATEGORY"){
printf "%s ", $2;
}
if ($1 == "PN"){
printf "%s ",$2;
}
if ($1 == "PV"){
print $2;
}
}' ; done
) >> $GENTOPKGS
fi
# Show the bootup info
if [ -x $RC_UPDATE ] ; then
$RC_UPDATE show >> ${LOGDIR}/software/rc-update_show.out
fi
##############################################################################
# sysconfig Section
##############################################################################
Echo "sysconfig Section"
if [ -d /etc/sysconfig ] ; then
if [ ! -d ${LOGDIR}/etc/sysconfig ] ; then
$MKDIR -p ${LOGDIR}/etc/sysconfig
fi
$CP -p -R /etc/sysconfig/*
${LOGDIR}/etc/sysconfig
fi
##############################################################################
# RHN Section
##############################################################################
if [ -d /etc/sysconfig/rhn ] ; then
Echo "RedHat Network Section"
RDIR=${LOGDIR}/rhn
$MKDIR -p ${RDIR}
if [ -d /etc/rhn ] ; then
$CP -pR /etc/rhn/ ${LOGDIR}/etc/rhn/
if [ -f /etc/sysconfig/rhn/systemid ] ; then
if [ -x /usr/bin/xsltproc ] ; then
/usr/bin/xsltproc $UTILDIR/text.xsl $RDIR/systemid \
> $ROOT/$RHNDIR/systemid 2>&1
fi
fi
fi
fi
# if [ -x /usr/bin/rhn-schema-version ] ; then
#
/usr/bin/rhn-schema-version >$RDIR}/
# fi
# if [ -x /usr/bin/rhn-charsets ] ; then
#
/usr/bin/rhn-charsets
# fi
##############################################################################
# Systems Log Section
##############################################################################
Echo "Systems Log Section"
$CP -R -p /var/log/* ${LOGDIR}/logs
$XM
$XM
$XM
$XM
$XM
list
info
logs
dmesg
vcpu-list
>
>
>
>
>
$VIRT/xen/xm_list.out
$VIRT/xen/xm_info.out
$VIRT/xen/xm_log.out
$VIRT/xen/xm_dmesg.out
$VIRT/xen/xm_vcpu-list.out
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
myHost}.out
2>&1
o_${myHost}.out
2>&1
> $VIRT/xen/xm_network-l
> $VIRT/xen/xm_uptime_${
> $VIRT/xen/virsh_dominf
done
fi
fi
##############################################################################
# VirtLib Information
##############################################################################
#-----------------------------------------------------------------------# Virtlib
#-----------------------------------------------------------------------if [ -x $VIRSH ] ; 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
$VIRSH dumpxml
line}.out 2>&1
done
$VIRSH list --all >
|
|
|
|
\
\
\
while read line
${VIRT}/libvirt/virsh_list_--all.out 2>&1
fi
##############################################################################
#
yp services
##############################################################################
Echo "YP Services Section"
YPDIR=${LOGDIR}/yp
$MKDIR -p ${YPDIR}
if [ -x "$YPWHICH" ] ; then
$YPWHICH -m > ${YPDIR}/ypwhich-m.out 2>&1
fi
if [ -f /etc/domainname ] ; then
$CP -p /etc/domainname ${LOGDIR}/etc/
$LS -lR /var/yp/$(cat /etc/domainname) > ${YPDIR}/ls_-lR.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 ] ; then
$CP -p /etc/HOSTNAME ${LOGDIR}/etc/HOSTNAME
fi
if [ -f /etc/hostname ] ; then
$CP -p /etc/hostname ${LOGDIR}/etc/hostname
fi
if [ -f /etc/networks ] ; then
$CP -p /etc/networks ${LOGDIR}/etc/networks
fi
if [ -f /etc/hosts.allow ] ; then
$CP -p /etc/hosts.allow ${LOGDIR}/etc/hosts.allow
fi
if [ -f /etc/hosts.deny ] ; then
$CP -p /etc/hosts.deny ${LOGDIR}/etc/hosts.deny
fi
if [ -f /etc/shells ] ; then
$CP -p /etc/shells ${LOGDIR}/etc/shells
fi
if [ -f /etc/network/interfaces ] ; then
if [ ! -d ${LOGDIR}/etc/network/interfaces ] ; 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
${LOGDIR}/network/netstat_-rn.out
${LOGDIR}/network/netstat_-lan.out
${LOGDIR}/network/netstat_-lav.out
${LOGDIR}/network/netstat_-tulpn.out
${LOGDIR}/network/netstat_-ape.out
${LOGDIR}/network/netstat_-uan.out
${LOGDIR}/network/netstat_-s.out
${LOGDIR}/network/route_-nv.out
if [ -x "$IP" ] ; then
$IP add
$IP route
$IP link
$IP rule
fi
>
>
>
>
${LOGDIR}/network/ip_add.out
${LOGDIR}/network/ip_route.out
${LOGDIR}/network/ip_link.out
${LOGDIR}/network/ip_rule.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
$IWCONFIG
> ${LOGDIR}/network/iwconfig.out 2>&1
fi
if [ -x "${MIITOOL}" ] ; then
${MIITOOL}
> ${LOGDIR}/network/mii-tool.out 2>&1
fi
#
# Collect bridging information
#
if [ -x "${BRCTL}" ] ; then
$BRCTL show > ${LOGDIR}/network/brctl_show.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
$BRCTL showstp $myBridge > ${LOGDIR}/network/btctl_showstp_${myBridge}.
out 2>&1
done
fi
##############################################################################
> ${LOGDIR}/network/iptables-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" ] ; then
$IPCHAINS -L -n > ${LOGDIR}/network/ipchains_-L_-n.out
fi
##############################################################################
# Lets now check the network cards speeds
##############################################################################
if [ -x "$ETHTOOL" ] ; 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}.out
2>&1
$ETHTOOL -i $i >> ${LOGDIR}/network/ethtool_ipv${version
}_-i_${i}.out 2>&1
$ETHTOOL -S $i >> ${LOGDIR}/network/ethtool_ipv${version
}_-S_${i}.out 2>&1
done
done
fi
##############################################################################
# xinetd Section
##############################################################################
Echo "xinetd Section"
if [ -d /etc/xinet.d ] ; then
XINETD=${LOGDIR}/etc/xinet.d
$MKDIR -p ${XINETD}
for i in $($LS -d /etc/xinetd.d/* )
do
filename=$(basename $i)
$CP -p $i ${XINETD}/$filename
done
fi
if [ -f /etc/xinetd.log ] ; then
$CP -p /etc/xinetd.log ${LOGDIR}/etc/xinetd.log
fi
##############################################################################
# DNS Section
##############################################################################
Echo "DNS Section"
if [ -f /etc/named.boot ] ; then
$CP -p /etc/named.boot ${LOGDIR}/etc/named.boot
fi
DNSDIR=""
# if [ -f "/etc/named.conf" ] ; then
#
DNSDIR=$($GREP -i directory /etc/named.conf | \
#
$GREP -v ^# | \
#
$GAWK '{ print $2 ;}' | \
#
$SED s/\"//g|/bin/sed s/\;//g
#
)
# fi
if [ "${DNSDIR}" != "" ] ; then
if [ ! -d ${LOGDIR}${DNSDIR} ] ; then
$MKDIR -p ${LOGDIR}${DNSDIR}
fi
cd ${DNSDIR}
$TAR cf - . 2>/dev/null | ( cd ${LOGDIR}${DNSDIR} ; tar xpf - ) > /dev/
null 2>&1
fi
##############################################################################
# Cluster Section
##############################################################################
CLUSTERDIR=${LOGDIR}/clusters
Echo "Cluster Section"
#--------------------------------------------------------------------
${LOGDIR}/etc/ocfs2/cluster.conf
$MKDIR -p ${CLUSTERDIR}/ocfs2
$CP -p /etc/ocfs2/cluster.conf
${CLUSTERDIR}/ocfs2/cluster.conf
fi
-f
-l
-I
-v
-x
$CLUSVCADM -v
$CLUSVCADM -S
>
>
>
>
>
>
$MyClusterDir/clustat.out
$MyClusterDir/clustat_-f.out
$MyClusterDir/clustat_-l.out
$MyClusterDir/clustat_-I.out
$MyClusterDir/clustat_-v.out
$MyClusterDir/clustat_-x.out
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
> $MyClusterDir/clusvcadm_-x.out
> $MyClusterDir/clusvcadm_-S.out
2>&1
2>&1
fi
#
# List out Quorum devices
#
if [ -x $MKQDISK ] ; then
$MKQDISK -L >> $MyClusterDir/mkqdisk_-L.out
fi
2>&1
#
# Copy the cluster config files over
#
if [ -f /etc/cluster.xml ] ; then
$CP -p /etc/cluster.xml
${LOGDIR}/etc/cluster.xml
$CP -p /etc/cluster.xml
$MyClusterDir/cluster.xml
fi
if [ -d /etc/cluster ] ; then
$CP -Rp /etc/cluster/*
${LOGDIR}/etc/cluster/
$CP -p /etc/cluster/*
$MyClusterDir/
fi
>
>
>
>
>
>
>
${VCSDIR}/hastatus_-sum.out
${VCSDIR}/hares_-list.out
${VCSDIR}/hagrp_-list.out
${VCSDIR}/hatype_-list.out
${VCSDIR}/hauser_-list.out
${VCSDIR}/lltstat_-vvn.out
${VCSDIR}/gabconfig_-a.out
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
${LOGDIR}/etc
${LOGDIR}/etc
${LOGDIR}/etc
fi
#-------------------------------------------------------------------# CRM/PaceMaker Cluster
#-------------------------------------------------------------------Echo "CRM Cluster Section"
CRMDIR=${CLUSTERDIR}/crm
if [ -x $CRM_MON ] ; then
$MKDIR -p ${CRMDIR}
$CRM_MON --version > ${CRMDIR}/crm_mon_--version.out
if [ -x $CRM ] ; then
$CRM status
$CRM configure show
> ${CRMDIR}/crm_status.out
> ${CRMDIR}/crm_configure_show.o
ut
$CRM configure show xml
> ${CRMDIR}/crm_configure_show_x
$CRM ra classes
$CRM ra list ocf heartbeat
> ${CRMDIR}/crm_ra_classes.out
> ${CRMDIR}/crm_ra_list_ocf_hear
> ${CRMDIR}/crm_ra_list_ocf_pace
ml.out
tbeat.out
maker.out
fi
if [ -x $CRM_VERIFY ] ; then
$CRM_VERIFY -L
fi
> ${CRMDIR}/crm_verify_-L.out
if [ -x $CIBADMIN ] ; then
$CIBADMIN -Ql > ${CRMDIR}/cibadmin_-Ql.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 ] ; then
$MKDIR -p ${LOGDIR}/var/spool/cron
cd /var/spool/cron
$TAR cf - . | ( cd ${LOGDIR}/var/spool/cron ; tar xpf - )
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 ] ; then
/usr/bin/lpstat -t
> ${PRINTDIR}/lpstat_-t.out 2>&1
fi
if [ -x /usr/sbin/lpc ] ; then
/usr/sbin/lpc status
> ${PRINTDIR}/lpstat_status.out 2>&1
fi
if [ -f /etc/printcap ] ; 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
if [ -x /usr/bin/lpq.cups ] ; then
/usr/bin/lpq.cups
> ${PRINTDIR}/lpq.cups.out 2>&1
fi
##############################################################################
# openldap Section
##############################################################################
Echo "Openldap Section"
if [ -d /etc/openldap ] ; 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.d/* ${LOGDIR}/etc/pam/
##############################################################################
# Sendmail Section
##############################################################################
Echo "Sendmail Section"
$MKDIR -p ${LOGDIR}/etc/mail
if [ -f /etc/sendmail.cf ] ; then
$CP -p /etc/sendmail.cf ${LOGDIR}/etc/sendmail.cf
fi
if [ -f /etc/sendmail.cw ] ; then
$CP -p /etc/sendmail.cw ${LOGDIR}/etc/sendmail.cw
fi
if [ -d /etc/mail ] ; then
for i in $($LS -d /etc/mail/* | $GREP -v \.db) ; do
$CP -R -p $i ${LOGDIR}/etc/mail
done
fi
if [ -f /etc/aliases ] ; then
$CP -p /etc/aliases ${LOGDIR}/etc/aliases
fi
if [ -f /etc/mail/aliases ] ; then
$CP -p /etc/mail/aliases ${LOGDIR}/etc/mail/aliases
fi
##############################################################################
# Postfix Section
##############################################################################
Echo "Postfix Section"
if [ -d /etc/postfix ] ; then
POSTDIR=${LOGDIR}/etc/postfix
$MKDIR -p $POSTDIR
$CP -p -R /etc/postfix/* ${POSTDIR}
$POSTCONF -v
> ${POSTDIR}/postconf_-v.out 2>&1
$POSTCONF -l
> ${POSTDIR}/postconf_-l.out 2>&1
fi
##############################################################################
# Exim Section
##############################################################################
Echo "Exim Section"
if [ -d /etc/exim ] ; 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
$DATE
> ${TIMEDIR}/date
if [ -f /etc/timezone ] ; then
$CP -p /etc/timezone ${TIMEDIR}/timezone
fi
if [ -f /usr/share/zoneinfo ] ; then
$CP -p /usr/share/zoneinfo ${TIMEDIR}/zoneinfo
fi
if [ -f /etc/ntp.drift ] ; then
$CP -p /etc/ntp.drift ${TIMEDIR}/ntp.drift
fi
if [ -x $HWCLOCK ] ; then
$HWCLOCK --show > ${TIMEDIR}/hwclock_--show.out
fi
if [ -x $NTPQ ] ; then
$NTPQ -p > ${TIMEDIR}/ntpq_-p.out 2>&1
fi
if [ -f /etc/ntp/step-tickers ] ; then
$CP -p /etc/ntp/step-tickers ${LOGDIR}/etc
fi
if [ -f /etc/ntp/ntpservers ] ; then
$CP -p /etc/ntp/ntpservers ${LOGDIR}/etc
fi
##############################################################################
# PPP Section
##############################################################################
Echo "PPP Section"
PPPDIR=${LOGDIR}/etc/ppp
if [ ! -d ${PPPDIR} ] ; then
$MKDIR -p ${PPPDIR}
$MKDIR -p ${PPPDIR}/peers
fi
if [ -d /etc/ppp ] ; then
$CP -R -p /etc/ppp/*
fi
${PPPDIR} 2>&1
if [ -d /etc/wvdial ] ; then
$CP -p /etc/ppp/options.*
$CP -p -R /etc/ppp/peers/*
fi
##############################################################################
# Apache Section
##############################################################################
##############################################################################
# Samba Section
##############################################################################
Echo "Samba Section"
SAMBADIR=${LOGDIR}/disks/samba
if [ ! -d ${SAMBADIR} ] ; then
$MKDIR -p ${SAMBADIR}
fi
if [ -x $TESTPARM ] ; then
echo "y" | $TESTPARM > ${SAMBADIR}/testparm.out 2>&1
fi
if [ -x $WBINFO ] ; then
$WBINFO -g > ${SAMBADIR}/wbinfo_-g.out 2>&1
$WBINFO -u > ${SAMBADIR}/wbinfo_-g.out 2>&1
fi
##############################################################################
# Openssh Section
##############################################################################
Echo "Openssh Section"
SSHDIR=${LOGDIR}/etc/ssh
$MKDIR -p ${SSHDIR}
if [ -f /etc/nologin ] ; then
$CP -p /etc/nologin ${LOGDIR}/etc/nologin
fi
if [ -d /etc/ssh/ssh_config ] ; then
$CP -p /etc/ssh/ssh_config ${SSHDIR}/ssh_config
fi
if [ -d /etc/ssh/sshd_config ] ; 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 ] ; then
$CP -R -p /etc/X11
fi
${LOGDIR}/etc
if [ -x $SYSP
$SYSP
$SYSP
$SYSP
fi
> ${XDIR}/sysp_-c.out
> ${XDIR}/sysp_-s_mouse.out
> ${XDIR}/sysp_-s_keyboard.out
] ; then
-c
-s mouse
-s keyboard
if [ -x $_3DDIAG ] ; then
$_3DDIAG
> ${XDIR}/3Ddiag.out
fi
##############################################################################
# This section is for removing any information
# about hardcoded passwords inserted in files.
##############################################################################
if [ -f /etc/wvdial.conf ] ; then
$CAT /etc/wvdial.conf | sed -e /^Password/d > ${LOGDIR}/etc/wvdial.conf
fi
##############################################################################
# Tar Up Support Directory
###############################################