Sie sind auf Seite 1von 61

#!

/bin/bash
##############################################################################
#
#
# FILE
: linux-explorer.sh
# Last Change Date : 30-03-2015
# 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 [option]
#
-d
Target directory for explorer files
#
-k
Do not delete files created by this script
#
-t
[hardware] [software] [configs] [cluster] [disks
] [network] [all]
#
-v
Verbose output
#
-s
Verify Package Installation
#
-h
This help message
#
-V
Version Number of LINUXEXPLO
#
##############################################################################
#
# Purpose
: This script is a linux version of the Solaris explorer
#
(SUNWexplo) script.
#
#
Used to collect information about a linux system build for
#
remote support purposes.
#
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.206"
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
CHECKTYPE=""
# Nothing selected
CWDIR=""
#
VERBOSE=0
on.

# Set to see the scripts progress used


# only if connected to a terminal sessi

FULLSOFT=0

# Set to Verify Software installation


# this takes a very long time

KEEPFILES="0"
s script

# Default to remove files created by thi

unset GZIP
e.

# Ensure that GZIP is unset for later us

# Set the path for the script to run.


PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:$PATH
export PATH
EXPLCFG=/etc/linuxExplo.cfg
##############################################################################
#
#
Function : spinningCursor
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
spinningCursor()
{
case $toggle in
1)
echo -n $1" [ \ ]"
echo -ne "\r"
toggle="2"
;;
2)

echo -n $1" [ | ]"


echo -ne "\r"
toggle="3"
;;

3)

echo -n $1" [ / ]"


echo -ne "\r"
toggle="4"
;;

*)

echo -n $1" [ - ]"


echo -ne "\r"
toggle="1"
;;

esac
}

##############################################################################
#
#
Function : MakeDir
#
Parameters :
#
Output :
#
Notes :
#

##############################################################################
function MakeDir
{
myDir="$1"
if [ ! -d $myDir ] ; then
$MKDIR -p $myDir
if [ $? -ne 0 ] ; then
echo "ERROR: Creating directory $LOGDIR"
exit 1
fi
else
$CHMOD 750 $myDir
fi
}

##############################################################################
#
#
Function : config_function
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function config_functions
{
boot_section
}
##############################################################################
#
#
Function : cluster_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function cluster_functions
{
MakeDir ${LOGDIR}/clusters
redhat_cluster_info
veritas_cluster_info
pacemake_cluster_info
}
##############################################################################
#
#
Function : disk_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################

function disk_functions
{
MakeDir ${LOGDIR}/hardware/disks
MakeDir ${LOGDIR}/hardware/disks/raid
disk_info
brtfs_info
lvm_info
zfs_info
filesystem_info
raid_info
disk_dm_info
nfs_info
emc_powerpath_info
netapp_info
veritas_vm
}
##############################################################################
#
#
Function : backup_products_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function backup_products_functions
{
netbackup
}

##############################################################################
#
#
Function : hardware_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function hardware_functions
{
MakeDir ${LOGDIR}/hardware
hardware_checks
disk_functions
network_functions
}
##############################################################################
#
#
Function : log_functions
#
Parameters :
#
Output :

#
Notes :
#
##############################################################################
function log_functions
{
MakeDir ${LOGDIR}/logs
selinux_info
system_logs_info
proc_sys_info
}
##############################################################################
#
#
Function : network_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function network_functions
{
MakeDir ${LOGDIR}/networks
network_info
iptables_info
ipchains_info
ethtool_info
yp_info
}
##############################################################################
#
#
Function : software_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function software_functions
{
MakeDir ${LOGDIR}/software
rpm_info
deb_info
pacman_info
suse_zypper_info
gentoo_pkgs_info
spacewalk_info
rhn_info
samba_info
apache_info
}

##############################################################################
#
#
Function : virt_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function virt_functions
{
MakeDir ${LOGDIR}/virtual
VIRT=${LOGDIR}/virtual
xen_info
libvirt_info
docker_info
}
##############################################################################
#
#
Function : general_functions
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function general_functions
{
# Create the default directories I'm going to use.
MakeDir ${LOGDIR}/boot
MakeDir ${LOGDIR}/clusters
MakeDir ${LOGDIR}/etc
MakeDir ${LOGDIR}/hardware
MakeDir ${LOGDIR}/hardware/disks
MakeDir ${LOGDIR}/lp
MakeDir ${LOGDIR}/logs
MakeDir ${LOGDIR}/mail
MakeDir ${LOGDIR}/system
MakeDir ${LOGDIR}/software
MakeDir ${LOGDIR}/var
MakeDir ${LOGDIR}/virtual
system_logs_info
printing_info
postfix_info
exim_info
dovecot_info
time_info
apache_info
samba_info
x11_info
}

##############################################################################
#
#
Function : myselection
#
Parameters :
#
Output :
#
Notes :
#
##############################################################################
function myselection
{
mywhich
findCmds
systemd_info
performance_info
installation_details
case $1 in
configs)

Echo "You have selected \"configs\" "


config_functions
;;

clusters)

Echo "You have selected \"clusters\" "


cluster_functions
;;

disks)

Echo "You have selected \"disks\" "


disk_functions
;;

hardware)

Echo "You have selected \"hardware\" "


hardware_functions
;;

logs)

Echo "You have selected \"logs\" "


log_functions
;;

network)

Echo "You have selected \"network\" "


network_functions
;;

software)

Echo "You have selected \"software\" "


software_functions
;;

virtualization) Echo "You have selected \"virtualization\" "


virt_functions
;;
general)

Echo "You have selected \"virtualization\" "


general_functions
;;

all|*)

Echo "You have selected \"ALL\" "

config_functions
cluster_functions
disk_functions
hardware_functions
log_functions
network_functions
virt_functions
software_functions
general_functions
;;
esac
}

##############################################################################
#
#
Function : Usage
#
#
Notes : N/A
#
##############################################################################
function ShowUsage
{
#------------------------------------------------------------------# Show help message
#------------------------------------------------------------------echo
echo "$MYNAME Version $MYVERSION - $COPYRIGHT "
echo
echo " usage: $MYNAME [option] "
echo
echo "
-d
Target directory for explorer files"
echo "
-k
Keep files created by this script"
echo "
-t
[hardware] [software] [configs] [cluster] [all]
[disks] [network]"
echo "
-v
Verbose output"
echo "
-s
Verify Package Installation"
echo "
-h
This help message"
echo "
-V
Version Number of LINUXEXPLO"
echo
exit 1
}

##############################################################################
#
#
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"
if [ "$command" = "" ] ; then
return
fi
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
{
if [ ${VERBOSE} -gt 0 ] ; then
echo "[*] Section - Finding Commands"
echo "============================================="
fi
# Standard commands
AWK=$(mywhich
BASENAME=$(mywhich
CAT=$(mywhich
CHKCONFIG=$(mywhich
CP=$(mywhich
CUT=$(mywhich
CHMOD=$(mywhich
COLUMN=$(mywhich
DATE=$(mywhich
DF=$(mywhich
DMESG=$(mywhich
ECHO=$(mywhich
EQUERY=$(mywhich
FILE=$(mywhich
FIND=$(mywhich
FREE=$(mywhich
GREP=$(mywhich
GPG=$(mywhich
EGREP=$(mywhich
JOURNALCTL=$(mywhich
LS=$(mywhich
LOGGER=$(mywhich
LSB_RELEASE=$(mywhich
LN=$(mywhich
MKDIR=$(mywhich
LAST=$(mywhich
LOCALE=$(mywhich
PSTREE=$(mywhich

awk
)
basename )
cat
)
chkconfig )
cp
)
cut
)
chmod
)
column
)
date
)
df
)
dmesg
)
echo
)
equery
)
file
)
find
)
free
)
grep
)
gpg
)
egrep
)
journalctl)
ls
)
logger
)
lsb_release )
ln
)
mkdir
)
last
)
locale
)
pstree
)

PS=$(mywhich
RM=$(mywhich
SLEEP=$(mywhich
SYSTEMCTL=$(mywhich
MOUNT=$(mywhich
MD5SUM=$(mywhich
MV=$(mywhich
SAR=$(mywhich
SORT=$(mywhich
TAIL=$(mywhich
UNAME=$(mywhich
UPTIME=$(mywhich
WHO=$(mywhich
ZIP=$(mywhich
GZIP=$(mywhich
GAWK=$(mywhich
SED=$(mywhich
GUNZIP=$(mywhich
SPACERPT=$(mywhich
UNIQ=$(mywhich
WC=$(mywhich

ps
)
rm
)
sleep
)
systemctl )
mount
)
md5sum
)
mv
)
sar
)
sort
)
tail
)
uname
)
uptime
)
who
)
zip
)
gzip
)
gawk
)
sed
)
gunzip
)
'spacewalk-report' )
uniq
)
wc
)

# Selinux
SESTATUS=$(mywhich sestatus )
GETSEBOOL=$(mywhich getsebool )
SEMANAGE=$(mywhich semanage )
# Samba
TESTPARM=$(mywhich testparm )
PDBEDIT=$(mywhich pdbedit )
WBINFO=$(mywhich wbinfo
)
# Systemd
SYSTEMD=$(mywhich
SYSTEMCTL=$(mywhich
SYSTEMDCGLS=$(mywhich
SYSTEMDLOGINCTL=$(mywhich
# Printing
LPC=$(mywhich
LPQ=$(mywhich
LPSTAT=$(mywhich
LPQ_CUPS=$(mywhich

systemd
)
systemctl
)
systemd-cgls
)
systemd-loginctl)

lpc )
lpq )
lpstat )
lpq.cups )

# Apache
APACHECTL=$(mywhich apachectl )
APACHE2CTL=$(mywhich apache2ctl )
# Packages
APTCONFIG=$(mywhich
RPM=$(mywhich
ZYPPER=$(mywhich
DPKG=$(mywhich
DPKG_QUERY=$(mywhich
EMERGE=$(mywhich
YUM=$(mywhich
PACMAN=$(mywhich

apt-config
rpm
zypper
dpkg
dpkg-query
emerge
yum
pacman

)
)
)
)
)
)
)
)

# Kernel Info
MODINFO=$(mywhich
SYSCTL=$(mywhich
KSYMS=$(mywhich
SLABTOP=$(mywhich
# H/W Info
ACPI=$(mywhich
BIOSDEVNAME=$(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
LSBLK=$(mywhich
LSSCSI=$(mywhich
IPVSADM=$(mywhich
LSUSB=$(mywhich
LSDEV=$(mywhich
LSHAL=$(mywhich
LSRAID=$(mywhich
MDADM=$(mywhich
PROCINFO=$(mywhich
POWERMT=$(mywhich
SMARTCTL=$(mywhich
SFDISK=$(mywhich
HWPARM=$(mywhich
SCSI_ID=$(mywhich
ISCSIADM=$(mywhich
MULTIPATH=$(mywhich
DMSETUP=$(mywhich
NTPQ=$(mywhich
SYSP=$(mywhich
_3DDIAG=$(mywhich
LSHW=$(mywhich
SYSTOOL=$(mywhich
SWAPON=$(mywhich

modinfo
sysctl
ksyms
slabtop

)
)
)
)

acpi
biosdevname
cardclt
dumpe2fs
dmidecode
fdisk
blkid
hdparm
hostname
hwinfo
hwclock
lsmod
lspci
lspnp
lsblk
lsscsi
ipvsadm
lsusb
lsdev
lshal
lsraid
mdadm
procinfo
powermt
smartclt
sfdisk
hwparm
scsi_id
iscsiadm
multipath
dmsetup
ntpq
sysp
3Ddiag
lshw
systool
swapon

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

# Netapp Tools
SAN_UTIL_DIR=/opt/netapp/santools
SAN_UTIL_PROG=sanlun
SANLUN=$SAN_UTIL_DIR/$SAN_UTIL_PROG

# Disks
BTRFS=$(mywhich
DEBUGREISERFS=$(mywhich
EXPORTFS=$(mywhich
HDPARM=$(mywhich
LVM=$(mywhich
LVDISPLAY=$(mywhich
LVMDISKSCAN=$(mywhich

btrfs
debugreiserfs
exportfs
hdparm
lvm
lvdisplay
lvmdiskscan

)
)
)
)
)
)
)

PVSCAN=$(mywhich
VGS=$(mywhich
VGSCAN=$(mywhich
VGDISPLAY=$(mywhich
PVSCAN=$(mywhich
PVS=$(mywhich
REPQUOTA=$(mywhich
TUNE2FS=$(mywhich

pvs
vgs
vgscan
vgdisplay
pvscan
pvs
repquota
tune2fs

)
)
)
)
)
)
)
)

# ZFS
ZFS=$(mywhich zfs
ZPOOL=$(mywhich zpool
# 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
CLUSVCADM=$(mywhich
MKQDISK=$(mywhich
CMAN_TOOL=$(mywhich

)
)
)
)
)
)
)
)

clustat )
clusvcadm )
mkqdisk )
cman_tool )

# CRM Cluster
CRM=$(mywhich
CRM_MON=$(mywhich
CRM_VERIFY=$(mywhich
CIBADMIN=$(mywhich
# Network
IFCONFIG=$(mywhich
IWCONFIG=$(mywhich
NETSTAT=$(mywhich
NFSSTAT=$(mywhich
ROUTE=$(mywhich
YPWHICH=$(mywhich
IP=$(mywhich
MIITOOL=$(mywhich
IPTABLES=$(mywhich
IPCHAINS=$(mywhich
ETHTOOL=$(mywhich
BRCTL=$(mywhich
ARP=$(mywhich

)
)
)
)
)

crm
crm_mon
crm_verify
cibadmin

ifconfig
iwconfig
netstat
nfsstat
route
ypwhich
ip
mii-tool
iptables
ipchains
ethtool
brctl
arp

# Tuning
IOSTAT=$(mywhich iostat

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

)
)
)
)

VMSTAT=$(mywhich
IPCS=$(mywhich
MODPROBE=$(mywhich
DEPMOD=$(mywhich

vmstat
ipcs
modprobe
depmod

)
)
)
)

# Other
DOVECOT=$(mywhich
EXIM=$(mywhich
RUNLEVEL=$(mywhich
LSOF=$(mywhich
TAR=$(mywhich
XVINFO=$(mywhich
POSTCONF=$(mywhich

dovecot
exim
runlevel
lsof
tar
xvinfo
postconf

)
)
)
)
)
)
)

# Virtual Server
XM=$(mywhich xm
VIRSH=$(mywhich virsh
DOCKER=$(mywhich docker

)
)
)

# Gentoo
RC_UPDATE=$(mywhich rc-update )
}

##############################################################################
#
#
Function : proc_sys_info
#
Parameters :
#
Output :
#
Notes : Collecting information from the proc directory
#
##############################################################################
function proc_sys_info
{
Echo "Section - Collecting /proc and /sys Info"
MakeDir ${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 "kpagecount" | \
$GREP -v "kpageflags" | \
$GREP -v "use-gss-proxy" | \
$GREP -v "/proc/kmsg" > $TMPFILE
for i in $($CAT $TMPFILE)
do
Dirname=$(dirname $i)
Filename=$(basename $i)

MakeDir ${LOGDIR}${Dirname}
if [ -e "$i" ] ; then
if [[ -t 0 && ${VERBOSE} -ne 0 ]] ; then
spinningCursor
fi
$CAT "$i" > ${LOGDIR}${Dirname}/${Filename} 2>&1
fi
if [[ -t 0 && ${VERBOSE} -ne 0 ]] ; then
spinningCursor
fi
done
echo
$RM -f $TMPFILE
}
##############################################################################
#
#
Function : netbackup
#
Parameters :
#
Output :
#
Notes : Collect lots of Netbackup information if installed
#
##############################################################################
function netbackup
{
Echo "Section - Netbackup "
# Basic Netbackup collection
NETBACKUPDIR="/usr/openv/netbackup"
if [ ! -d $NETBACKUPDIR ] ; then
NBACKUPDIR=${LOGDIR}/backups/netbackup
MakeDir $NBACKUPDIR
else
return
fi
PATH=$PATH:$NETBACKUPDIR
export PATH
bpstulist -L
bppllist

>> $NBACKUPDIR/bpstulist_-L.out
> $NBACKUPDIR/bppllist.out

cat $NBACKUPDIR/bppllist.out | while read line


do
bppllist $line -U > $NBACKUPDIR/bppllist_${line}_-U.out

done
bpps -a
bpconfig -l
bpconfig -L
vmquery -a
tpconfig -d
bpmedia
bpmedialist
available_media

>
>
>
>
>
>
>
>

$NBACKUPDIR/bpps_-a.out
$NBACKUPDIR/bpconfig_-l.out
$NBACKUPDIR/bpconfig_-L.out
$NBACKUPDIR/vmquery_-a.out
$NBACKUPDIR/tpconfig_-d.out
$NBACKUPDIR/bpmedia.out
$NBACKUPDIR/bpmedialist.out
$NBACKUPDIR/available_media.out

bperror -U -backstat -hoursago 48 > $NBACKUPDIR/bperror_-U_-backstat_-ho


ursago_48.out
MakeDir $NBackupDir/configs
cp /usr/openv/netbackup/*.conf $NBACKUPDIR/configs
}
##############################################################################
#
#
Function : hardware_checks
#
Parameters :
#
Output :
#
Notes : Collect Hardware Information
#
##############################################################################
function hardware_checks
{
Echo "Section - Hardware Info"
if [ -x $CARDCTL ] ; then
$CARDCTL info

> ${LOGDIR}/hardware/cardctl-info.out 2>

&1
$CARDCTL status

> ${LOGDIR}/hardware/cardctl-status.out

# $CARDCTL ident

> ${LOGDIR}/hardware/cardctl-ident.out 2

2>&1
>&1
fi
MakeDir ${LOGDIR}/hardware/lspci
if [ -x $LSPCI ] ; then
$LSPCI
> ${LOGDIR}/hardware/lspci/lspci.out 2>&1
$LSPCI -n
> ${LOGDIR}/hardware/lspci/lspci-n.out 2>&1
$LSPCI -knn
> ${LOGDIR}/hardware/lspci/lspci-knn.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/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/lspc
i/cat_${name}.out
fi
done

# Get a listing of the /dev directory


MakeDir ${LOGDIR}/dev
$LS -laR /dev > ${LOGDIR}/dev/ls_-laR_dev.out
if [ -x "$LSUSB" ] ; then
$LSUSB -xv > ${LOGDIR}/hardware/lsusb_-xv.out 2>&1
$LSUSB -tv > ${LOGDIR}/hardware/lsusb_-tv.out 2>&1
fi
if [ -x "$LSDEV" ] ; then
$LSDEV -type adaptor > ${LOGDIR}/hardware/lsdev_-type_adaptor.ou
t 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
# 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/h
ardware.py.out 2>&1
fi
if [ -x "$SMARTCTL" ] ; then
for device in $( $LS /dev/[a-z]d[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


/smartctl-a_${name}.out
done
fi

########################################################################
######
# Collect Hardware information from the hwinfo program if installed
########################################################################
######

r.out

if [ -x $HWINFO
$HWINFO
2>&1
$HWINFO
2>&1
$HWINFO
2>&1
$HWINFO
2>&1
fi

] ; then
> ${LOGDIR}/hardware/hwinfo.out
--isapnp

> ${LOGDIR}/hardware/hwinfo_--isapnp.out

--scsi

> ${LOGDIR}/hardware/hwinfo_--scsi.out

--framebuffer > ${LOGDIR}/hardware/hwinfo_--framebuffe

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
$CAT /proc/cpuinfo

> ${LOGDIR}/hardware/proc_cpuinfo.out

$CAT /proc/meminfo

> ${LOGDIR}/hardware/proc_meminfo.out

$CAT /proc/mdstat

> ${LOGDIR}/hardware/proc_mdstat.out

$CAT /proc/interrupts

> ${LOGDIR}/hardware/proc_interrupts.out

$CAT /proc/filesystem

> ${LOGDIR}/hardware/proc_filesystems.out

$CAT /proc/devices

> ${LOGDIR}/hardware/proc_devices.out

$CAT /proc/iomem

> ${LOGDIR}/hardware/proc_iomem.out

$CAT /proc/ioports

> ${LOGDIR}/hardware/proc_ioports.out

$CAT /proc/partitions

> ${LOGDIR}/hardware/proc_partitions.out

$CAT /proc/slabinfo

> ${LOGDIR}/hardware/proc_slabinfo.out

$CAT /proc/softirqs

> ${LOGDIR}/hardware/proc_softirqs.out

2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1

2>&1
physicalCPUs=$( $CAT /proc/cpuinfo | grep "physical id" | $SORT | $UNIQ
| $WC -l )
cpuCores=$( $CAT /proc/cpuinfo | grep "cpu cores" | $UNIQ )
cpuProcessors=$( $CAT /proc/cpuinfo | grep "^processor" | $UNIQ )
echo "Physical CPU
u_details.txt
echo "CPU Cores
u_details.txt
echo "CPU Processors
u_details.txt
}

: $physicalCPUs"

>> ${LOGDIR}/hardware/cp

: $cpuCores"

>> ${LOGDIR}/hardware/cp

: $cpuCores"

>> ${LOGDIR}/hardware/cp

##############################################################################
#
#
Function : boot_section
#
Parameters :
#
Output :
#
Notes : Capture the files required to boot the system
#
##############################################################################
function boot_section
{
Echo "Section - Boot Info"
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
MakeDir ${LOGDIR}/boot/grub
MakeDir ${LOGDIR}/software
MakeDir ${LOGDIR}/system
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 [ -x "$CHKCONFIG" ] ; then
$CHKCONFIG --list > ${LOGDIR}/software/chkconfig_--list.out 2>&1
fi
if [ -x "$SYSTEMCTL" ] ; then
$SYSTEMCTL --full --no-pager
ull_--nopager

> ${LOGDIR}/system/systemctl_--f

fi
}
##############################################################################
#
#
Function : performance_info
#
Parameters :
#
Output :
#
Notes : some general information about performance
#
##############################################################################
function performance_info
{
Echo "Section - Performance/System "
MakeDir ${LOGDIR}/system/performance
$PS auxw
$PS -lef
$HOSTNAME

> ${LOGDIR}/system/ps_auxw.out
> ${LOGDIR}/system/ps_-elf.out
> ${LOGDIR}/system/hostname.out

if [ -e /proc/stat ] ; then
$CAT /proc/stat
fi

> ${LOGDIR}/system/stat.out

if [ -x $DATE ] ; then
$DATE
fi

> ${LOGDIR}/system/date.out

if [ -x $FREE ] ; then
$FREE
fi

> ${LOGDIR}/system/free.out

if [ -x $PSTREE ] ; then
$PSTREE
fi

> ${LOGDIR}/system/pstree.out

if [ -x $IPCS
$IPCS
$IPCS
$IPCS
fi

> ${LOGDIR}/system/ipcs_-a.out
> ${LOGDIR}/system/ipcs_-u.out
> ${LOGDIR}/system/ipcs_-l.out

] ; then
-a
-u
-l

$UPTIME
ulimit -a

> ${LOGDIR}/system/uptime.out
> ${LOGDIR}/system/ulimit_-a.out

if [ -x $VMSTAT ] ; then
$VMSTAT -s

> ${LOGDIR}/system/performance/vmstat_-s

.out
fi
if [ "$LSOF" != "" ] ; then
$LSOF > ${LOGDIR}/system/lsof.out
fi

2>&1

if [ -d /var/log/sa ] ; then
$CP -p /var/log/sa/sa*
fi

${LOGDIR}/system/performance/

if [ -e /proc/loadavg ] ; then
$CAT /proc/loadavg
> ${LOGDIR}/system/performance/loadavg.o
ut
fi
}

##############################################################################
#
#
Function : kernel_info
#
Parameters :
#
Output :
#
Notes : Kernel information
#
##############################################################################
function kernel_info
{
Echo "Section - Kernel info"
$SYSCTL -A
$UNAME -a
$RUNLEVEL
$WHO -r
$SLABTOP -o

>
>
>
>
>

${LOGDIR}/etc/sysctl_-A.out 2>&1
${LOGDIR}/system/uname_-a.out
${LOGDIR}/system/runlevel.out
${LOGDIR}/system/who_-r.out
${LOGDIR}/system/slabtop_-o.out

if [ ! -d ${LOGDIR}/kernel/info ] ; then
MakeDir ${LOGDIR}/kernel/info
fi
$LSMOD

> ${LOGDIR}/kernel/lsmod.out 2>&1

$LSMOD | while read line


do
kernmod=$( echo $line | $AWK '{ print $1 }' )
$MODINFO $kernmod > ${LOGDIR}/kernel/info/${kernmod}.out 2>&1
done
if [ -x $KSYMS ] ; then
$KSYMS
> ${LOGDIR}/kernel/ksyms.out 2>&1
fi
$CP -p /lib/modules/$($UNAME -r)/modules.dep ${LOGDIR}/kernel/modules.de
p
$MODPROBE -n -l -v
2>&1

> ${LOGDIR}/kernel/modprobe_-n-l-v.out

$DEPMOD -av

> ${LOGDIR}/kernel/depmod_-av.out

$CAT /proc/modules

> ${LOGDIR}/kernel/modules.out

2>&1
2>&1
########################################################################
######
# 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
}
##############################################################################
#
#
Function : disk_info
#
Parameters :
#
Output :
#
Notes : Collect general information about the disks on this system
#
##############################################################################
function disk_info
{
Echo "Section - Disk Section Checks"
local Dirname
MakeDir ${LOGDIR}/hardware/disks
# Check to see what is mounted
$DF
$DF
$DF
$DF
$DF

-k
-h
-ki
-aki
-akih

>
>
>
>
>

${LOGDIR}/hardware/disks/df_-k.out
${LOGDIR}/hardware/disks/df_-h.out
${LOGDIR}/hardware/disks/df_-ki.out
${LOGDIR}/hardware/disks/df_-aki.out
${LOGDIR}/hardware/disks/df_-akih.out

2>&1
2>&1
2>&1
2>&1
2>&1

if [ -x $SWAPON ] ; then
$SWAPON -s > ${LOGDIR}/hardware/disks/swapon_-s.out
fi
$MOUNT

> ${LOGDIR}/hardware/disks/mount.out

$MOUNT -l

> ${LOGDIR}/hardware/disks/mount_-l.out

$CAT /proc/mounts

> ${LOGDIR}/hardware/disks/mounts.out

2>&1

2>&1
2>&1
2>&1
# Display any quotas that my have been set
$REPQUOTA -av
> ${LOGDIR}/hardware/disks/repquota_-av 2>&1

########################################################################
######
# Disk Format Information
########################################################################
######
DISKLIST=$($FDISK -l 2>/dev/null | grep "^/dev" | sed 's/[0-9]//g' | aw
k '{ print $1 }' | sort -u)
if [ -x $FDISK ] ; then
$FDISK -l
> ${LOGDIR}/hardware/disks/fdisk_-l.out 2>&1
fi
if [ -x $SFDISK ] ; then
$SFDISK -l
> ${LOGDIR}/hardware/disks/sfdisk_-l.out 2>&1
$SFDISK -s
> ${LOGDIR}/hardware/disks/sfdisk_-s.out 2>&1
fi
if [ -x $BLKID ] ; then
$BLKID
> ${LOGDIR}/hardware/disks/blkid.out 2>&1
fi
if [ -x $LSBLK ] ; then
$LSBLK -f
> ${LOGDIR}/hardware/disks/lsblk_-f.out 2>&1
fi
if [ -x $LSSCSI ] ; then
$LSSCSI -l
> ${LOGDIR}/hardware/disks/lsscsi_-l.out 2>&1
$LSSCSI -g
> ${LOGDIR}/hardware/disks/lsscsi_-g.out 2>&1
fi
for DISK in $DISKLIST
do
Dirname=$(dirname $DISK)
if [ "$Dirname" = "/dev/mapper" ] ; then
if [ ! -L $DISK ] ; then
continue
fi
fi
NEWDISK=$(/bin/echo $DISK | sed s'/\/dev\///g' )
MakeDir ${LOGDIR}/hardware/disks/${NEWDISK}
if [ -x $HDPARM ] ; then
$HDPARM -vIi $DISK
DISK}/hdparm_-vIi_${NEWDISK}.out 2>&1
fi

> ${LOGDIR}/hardware/disks/${NEW

if [ -x $SFDISK ] ; then
$SFDISK -l $DISK
DISK}/sfdisk_-l_${NEWDISK}.out 2>&1
fi

> ${LOGDIR}/hardware/disks/${NEW

if [ -x $FDISK ] ; then

$FDISK -l $DISK
DISK}/fdisk_-l_${NEWDISK}.out 2>&1
fi

> ${LOGDIR}/hardware/disks/${NEW

done
if [ -x "$DUMPE2FS" ] ; then
MakeDir ${LOGDIR}/hardware/disks/dumpe2fs
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}/hardware/disks/dumpe
2fs/fdisk_-l_${name}.out 2>&1
done
fi

########################################################################
######
# Collect Detailed SCSI information about the disks
########################################################################
######
if [ -x "$SCSI_ID" ] ; then
for i in $($LS [a-z]d[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}/hardware/disks/scsi_id_-g_-p_0x
80_${disk_name}.out 2>&1
$SCSI_ID -g -p 0x83 -d /dev/${i} -s /block/${i}
\
> ${LOGDIR}/hardware/disks/scsi_id_-g_-p_0x
83_${disk_name}.out 2>&1
fi
done
for disk in $($LS /dev/[a-z]d[a-z])
do
wwid=`$SCSI_ID -g -u $disk`
if [ "$wwid" != "" ] ; then
$ECHO -e "Disk:" $disk_short "\tWWID:" $wwid >>
${LOGDIR}/hardware/disks/disk_mapping-wwid.out

fi
done
fi
if [ -x $SYSTOOL ] ; then
$SYSTOOL -c scsi_host -v > ${LOGDIR}/hardware/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}/hardware/disks/multipath_-ll.out 2>
&1
$MULTIPATH -v4 > ${LOGDIR}/hardware/disks/multipath_-v2.out 2>
&1
fi
if [ -x "$DMSETUP" ] ; then
MakeDir ${LOGDIR}/hardware/disks/dmsetup
$DMSETUP ls
> ${LOGDIR}/hardware/disks/dmsetup/dmsetup_l
s.out 2>&1
$DMSETUP ls --tree > ${LOGDIR}/hardware/disks/dmsetup/dmsetup_l
s--info.out 2>&1
$DMSETUP info
> ${LOGDIR}/hardware/disks/dmsetup/dmsetup_i
nfo.out
2>&1
$DMSETUP info
> ${LOGDIR}/hardware/disks/dmsetup/dmsetup_i
nfo-C.out
2>&1
$DMSETUP deps
> ${LOGDIR}/hardware/disks/dmsetup/dmsetup_d
eps.out
2>&1
$DMSETUP targets
> ${LOGDIR}/hardware/disks/dmsetup/dmsetup_t
argets.out 2>&1
fi
# Check to see what iscsi devices have
if [ -x "$ISCSIADM" ] ; then
$ISCSIADM -m session > ${LOGDIR}/hardware/disks/iscsiadm_-m_sess
ion.out 2>&1
fi
}
##############################################################################
#
#
Function : emc_powerpath_info
#
Parameters :
#
Output :
#
Notes : If Powerpath is installed then get some information
#

##############################################################################
function emc_powerpath_info
{
Echo "Section - EMC Powerpath checks"
if [ ! -d ${LOGDIR}/hardware/disks/emcpower ] ; then
MakeDir ${LOGDIR}/hardware/disks/emcpower
fi
EMCPOWER=${LOGDIR}/hardware/disks/emcpower
# Check to see what emc powerpath devices we have
if [ ! -x "$POWERMT" ] ; then
$ECHO "No $POWERMT Program found" > ${EMCPOWER}/Readme.out
return
fi

$POWERMT check_registration
tration.out 2>&1
$POWERMT display path
h.out 2>&1
$POWERMT display ports
ts.out 2>&1
$POWERMT display paths class=all
hs_class=all.out 2>&1
$POWERMT display ports dev=all
ts_dev=all.out 2>&1
$POWERMT display dev=all
=all.out 2>&1

>${EMCPOWER}/powermt_check_regis
>${EMCPOWER}/powermt_display_pat
>${EMCPOWER}/powermt_display_por
>${EMCPOWER}/powermt_display_pat
>${EMCPOWER}/powermt_display_por
>${EMCPOWER}/powermt_display_dev

# 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
>${EMCPOWER}/fdisk_-l_${emc_disk
_name}.out 2>&1
done
}
##############################################################################
#
#
Function : netapp_info
#
Parameters :
#
Output :
#
Notes : Check if we have netapp software installed - collect info
#
##############################################################################
function netapp_info
{
if [ ! -x $SANLUN ] ; then
$ECHO "No $SANLUN Program found"

> ${NETAPPDIR}/R

eadme.out
return
fi
if [ ! -d ${LOGDIR}/hardware/disks/netapp ] ; then
MakeDir ${LOGDIR}/hardware/disks/netapp
fi
Echo "Section - Netapp checks"
NETAPPDIR=${LOGDIR}/hardware/disks/netapp
MakeDir $NETAPPDIR
$SANLUN version

> ${NETAPPDIR}/sanlun_version 2>

&1
$SANLUN lun
v_all 2>&1
$SANLUN fcp
dapter_-v_all 2>&1
$SANLUN lun
_all 2>&1
$SANLUN fcp
dapter_-v_all 2>&1

show -v all

> ${NETAPPDIR}/sanlun_lun_show_-

show adapter -v all

> ${NETAPPDIR}/sanlun_fcp_show_a

show -v all

> ${NETAPPDIR}/sanlun_lun_show-v

show adapter -v all

> ${NETAPPDIR}/sanlun_fcp_show_a

}
##############################################################################
#
#
Function : veritas_vm
#
Parameters :
#
Output :
#
Notes : Collect information about veritas volume manager
#
##############################################################################
function veritas_vm
{
Echo "Section - Veritas Volume Manager checks"
if [ -d /dev/vx ] ; then
if [ ! -d ${LOGDIR}/disks/vxvm ] ; then
MakeDir ${LOGDIR}/hardware/disks/vxvm
MakeDir ${LOGDIR}/hardware/disks/vxvm/logs
MakeDir ${LOGDIR}/hardware/disks/vxvm/disk_groups
fi
$LS -laR /dev/vx > ${LOGDIR}/hardware/disks/vxvm/ls-lR_dev_vx.o
ut 2>&1
if [ -x $VXDISK ] ; then
$VXDISK list
ks/vxvm/vxdisk_list.out
2>&1
$VXDISK -o alldgs list
ks/vxvm/vxdisk_-o_alldgs_list.out
2>&1

> ${LOGDIR}/hardware/dis
> ${LOGDIR}/hardware/dis

$VXPRINT -Ath
2>&1
$VXPRINT -h
ks/vxvm/vxprint_-h.out
2>&1
$VXPRINT -hr
ks/vxvm/vxprint_-hr.out
2>&1
$VXPRINT -th
ks/vxvm/vxprint_-th.out
2>&1
$VXPRINT -thrL
ks/vxvm/vxprint_-thrL.out
2>&1
fi

> ${LOGDIR}/hardware/dis

ks/vxvm/vxprint_-Ath.out

if [ -x $VXDG ] ; then
$VXDG -q list
ks/vxvm/vxdg_-q_-list.out 2>&1
fi

> ${LOGDIR}/hardware/dis
> ${LOGDIR}/hardware/dis
> ${LOGDIR}/hardware/dis
> ${LOGDIR}/hardware/dis

> ${LOGDIR}/hardware/dis

#----------------------------------------------------------------------# Collect individual volume information


#----------------------------------------------------------------------for i in $($VXDG -q list|awk '{print $1}')
do
$VXDG list $i
> ${LOGDIR}/hardware/disks/vxvm/disk_g
roups/vxdg_list_${i}.out
$VXDG -g $i free > ${LOGDIR}/hardware/disks/vxvm/disk_g
roups/vxdg_-g_free_${i}.out
$VXPRINT -vng $i > ${LOGDIR}/hardware/disks/vxvm/disk_g
roups/vxprint_-vng_${i}.out
VOL=$(cat ${LOGDIR}/hardware/disks/vxvm/disk_groups/vxpr
int_-vng_${i}.out)
$VXPRINT -hmQqg $i $VOL \
> ${LOGDIR}/hardware/disks/vxvm/disk_groups/vxpr
int_-hmQqg_4vxmk=${i}.out 2>&1
$VXPRINT -hmQqg $i \
> ${LOGDIR}/hardware/disks/vxvm/disk_groups/vxpr
int_-hmQqg=${i}.out 2>&1
done
fi
}
##############################################################################
#
#
Function : filesystem_info
#
Parameters :
#
Output :
#
Notes : General Filesystem information
#

##############################################################################
function filesystem_info
{
Echo "Section - Filesystem checks"
MakeDir ${LOGDIR}/hardware/disks/tunefs
for i in $($DF -kl | grep ^/dev | awk '{ print $1 }')
do
if [ -x $TUNE2FS ] ; then
name=$(/bin/echo $i | sed 's/\//_/g')
$TUNE2FS -l $i > ${LOGDIR}/hardware/disks/tunefs/tunefs
_-l_${name}.out 2>&1
fi
done
}
##############################################################################
#
#
Function : nfs_info
#
Parameters :
#
Output :
#
Notes : Get some information about the NFS service
#
##############################################################################
function nfs_info
{
Echo "Section - NFS checks"
# lets see what we have really exported
if [ -x $EXPORTFS ] ; then
$EXPORTFS -v
> ${LOGDIR}/hardware/disks/exportfs_-v.out 2>&1
fi
if [ -x "$NFSSTAT" ] ; then
$NFSSTAT -a > ${LOGDIR}/hardware/disks/nfsstat_-a.out 2>&1
fi
}
##############################################################################
#
#
Function : raid_info
#
Parameters :
#
Output :
#
Notes : Check raid used on this system
#
##############################################################################
function raid_info
{
Echo "Section - Disk Raid checks"
MakeDir ${LOGDIR}/hardware/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}/hardware/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}/hardware/disks/raid/m
dadm_--detail_${name}.out > /dev/null 2>&1
if [ ! -s ${LOGDIR}/hardware/disks/raid/mdadm--detail_${
name}.out ] ; then
$RM -f ${LOGDIR}/hardware/disks/raid/mdadm--deta
il_${name}.out
fi
done
fi
}
##############################################################################
#
#
Function : brtfs_info
#
Parameters :
#
Output :
#
Notes : Lets look at BRTS - new Linux filesystem
#
##############################################################################
function brtfs_info
{
Echo "Section - btrfs Section"
MakeDir ${LOGDIR}/hardware/disks/btrfs
# Scan all devices
if [ -x $BTRFS ] ; then
${BRTFS} filesystem show > ${LOGDIR}/hardware/disks/btrfs/btrfs_
filesystem_show.out > /dev/null 2>&1
$DF -h -t btrfs 2>/dev/null | grep -v Filesystem | while read l
ine
do
FS=$(echo $line | awk '{print $6}')
FSN=$( echo $FS | sed 's/\//_/g' )
if [ "$FS" = "/" ] ; then
FSN="root"
fi
$BTRFS filesystem df $FS > ${LOGDIR}/hardware/disks/btr
fs/btrfs_filesystem_df_$FSN 2>&1

$BTRFS subvolume list $FS > ${LOGDIR}/hardware/disks/btr


fs/btrfs_subvolume_list_$FSN 2>&1
done
$BTRFS fi show > ${LOGDIR}/hardware/disks/btrfs/btrfs_fi_show.ou
t
fi
}
##############################################################################
#
#
Function : zfs_info
#
Parameters :
#
Output :
#
Notes : Solaris - ZFS Volume Manager - collect details
#
##############################################################################
function zfs_info
{
if [ -x "$ZPOOL" ] ; then
Echo "Section - ZFS "
ZFSDIR=${LOGDIR}/hardware/disks/zfs
MakeDir ${ZFSDIR}
$ZPOOL
$ZPOOL
$ZPOOL
$ZPOOL

status -v
status -D
history
list

>
>
>
>

${ZFSDIR}/zpool_status_-v.out 2>&1
${ZFSDIR}/zpool_status_-D.out 2>&1
${ZFSDIR}/zpool_history.out 2>&1
${ZFSDIR}/zpool_list.out 2>&1

$ZFS list
> ${ZFSDIR}/zfs_list.out 2>&1
$ZFS list -o space
> ${ZFSDIR}/zfs_list_-o_space.out 2>&1
$ZFS list -t snapshots > ${ZFSDIR}/zfs_list_-t_snapshots.out 2>
&1
$ZFS get all

> ${ZFSDIR}/zfs_get_all.out 2>&1

for poolname in $($ZPOOL list | grep -v NAME | $AWK '{print $1}'


)
do
$ZFS get all $poolname > ${ZFSDIR}/zfs_get_all_$poolnam
e.out 2>&1
$ZPOOL status $poolname > ${ZFSDIR}/zpool_status_$poolna
me.out 2>&1
done
fi
}
##############################################################################
#
#
Function : lvm_info
#
Parameters :
#
Output :
#
Notes : Logical Volume Manager - collect details
#

##############################################################################
function lvm_info
{
Echo "Section - LVM "
LVMDIR=${LOGDIR}/hardware/disks/lvm
MakeDir ${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

2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1
2>&1

# Map every DM device to a disk


$LVDISPLAY 2>/dev/null | \
$AWK '/LV Name/{n=$3} /Block device/{d=$3; sub(".*:","d
m-",d); print d,n;}' \
> ${LVMDIR}/devices.out 2>&1
fi
if [ -x "$LVM" ] ; then
$LVM dumpconfig
ig.out

> ${LVMDIR}/lvm_dumpconf
2>&1

$LVM lvs

> ${LVMDIR}/lvm_lvs.out

2>&1
$LVM pvs -o +lv_name,lv_size,seg_all
ame:lv_size:seg_all.out
2>&1
fi

> ${LVMDIR}/pvs_-o_+lv_n

}
##############################################################################
#
#
Function : disk_dm_info
#
Parameters :
#
Output :
#
Notes : Collect more Disk information
#
##############################################################################
function disk_dm_info
{
Echo "Section - Disk DM Info "
# Work out which dm device is being used by each filesystem
grep dm-[0-9] /proc/diskstats | awk '{print $1, $2, $3}' | while read li
ne
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 '{p
rint $(NF)}')
echo "$Device = $List " >> ${LOGDIR}/hardware/disks/dm-info.out
done
}
##############################################################################
#
#
Function : rpm_info
#
Parameters :
#
Output :
#
Notes : Check all packages installed
#
##############################################################################
function rpm_info
{
if [ -x "$RPM" ] ; then
Echo "Section - rpm package information "
MakeDir ${LOGDIR}/software/rpm/rpm-packages
#
# Short Description of all packages installed
#
echo "Package_Name
Version
Size
> ${LOGDIR}/software/rpm/rpm-qa--queryformat.out
echo "==========================================================
=========================" >> ${LOGDIR}/software/rpm/rpm-qa--queryformat.out
Description"

$RPM -qa --queryformat '%-25{NAME} %-16{VERSION} %-10{RELEASE}


%-10{DISTRIBUTION} %-10{SIZE} %-10{INSTALLTIME:date} %{SUMMARY}\n' | sort >> ${
LOGDIR}/software/rpm/rpm-qa--queryformat.out 2>&1
#
# Long Description of all packages installed
#
$RPM -qa > ${LOGDIR}/software/rpm/rpm_-qa 2>&1
$CAT ${LOGDIR}/software/rpm/rpm_-qa | while read line
do
$RPM -qi $line > ${LOGDIR}/software/rpm/rpm-packages/${
line}.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/rpm_-qa_-last.out
#############################################################
# If you enable verification then this then it's going to
# take a some time to complete........
#############################################################
if [ ${FULLSOFT} -gt 0 ] ; then
$RPM -Va > ${LOGDIR}/software/rpm/rpm-Va.out 2>&1
fi
fi
if [ -f /usr/lib/rpm/rpmrc ] ; then
$CP -p /usr/lib/rpm/rpmrc ${LOGDIR}/software/rpm/rpmrc
fi

# Make a copy of the yum config files so that we can compare them
YUMDIR=${LOGDIR}/software/yum
MakeDir ${YUMDIR}
if [ -x "$YUM" ] ; then
$YUM list installed
2>&1
$YUM info installed
2>&1
$YUM -v repolist all
2>&1
$YUM repolist enabled
2>&1
$YUM repolist disabled
2>&1
$YUM -v repolist all
2>&1
$YUM -v repolist enabled
t 2>&1
$YUM -v repolist disabled
ut 2>&1
fi

> ${YUMDIR}/yum_list_installed.out
> ${YUMDIR}/yum_info_installed.out
> ${YUMDIR}/yum_-v_repolist_all.out
> ${YUMDIR}/yum_repolist_enabled.out
> ${YUMDIR}/yum_repolist_disabled.out
> ${YUMDIR}/yum_-v_repolist_all.out
> ${YUMDIR}/yum_-v_repolist_enabled.ou
> ${YUMDIR}/yum_-v_repolist_disabled.o

}
##############################################################################
#
#
Function : pacman_info
#
Parameters :
#
Output :
#
Notes : Check all packages installed ( used by ArchLinux/OpenFiler )
#
##############################################################################
function pacman_info
{
if [ -x "$PACMAN" ] ; then

Echo "Section - pacman Checks "


MakeDir ${LOGDIR}/software/packman
$PACMAN -qa > ${LOGDIR}/software/packman/pacman_-qa 2>&1
$PACMAN -Qi > ${LOGDIR}/software/packman/pacman_-Qi 2>&1
$PACMAN -Qdt > ${LOGDIR}/software/packman/pacman_-Qdt 2>&1
fi
}
##############################################################################
#
#
Function : systemd_info
#
Parameters :
#
Output :
#
Notes : Get information about SystemD
#
##############################################################################
function systemd_info
{
if [ -x "$SYSTEMCTL" ]; then
Echo "Section - Systemd Checks "
MakeDir ${LOGDIR}/system/systemd
# systemd checks
if [ -x "$SYSTEMD" ]; then
$SYSTEMD --dump-configuration-items > ${LOGDIR}/system/
systemd/systemd_--dump-configuration-items.out 2>&1
$SYSTEMD --test
> ${LOGDIR}/system/
systemd/systemd_--test.out
2>&1
fi
# systemd-cgls tree
if [ -x "$SYSTEMDCGLS" ]; then
$SYSTEMDCGLS > ${LOGDIR}/system/systemd/systemd-cgls.ou
t 2>&1
fi
if [ -x "$SYSTEMDLOGINCTL" ]; then
$SYSTEMDLOGINCTL --all
> ${LOGDIR}/system/systemd/sy
stemd-loginctl_--all.out
2>&1
$SYSTEMDLOGINCTL show-seat > ${LOGDIR}/system/systemd/sy
stemd-loginctl_show-seat.out 2>&1
$SYSTEMDLOGINCTL show-user > ${LOGDIR}/system/systemd/sy
stemd-loginctl_show_user.out 2>&1
fi
$SYSTEMCTL
2>&1
$SYSTEMCTL
_--all.out
2>&1
$SYSTEMCTL
_show-environment.out 2>&1
$SYSTEMCTL
_--version.out
2>&1
$SYSTEMCTL

> ${LOGDIR}/system/systemd/systemctl

.out

--all

> ${LOGDIR}/system/systemd/systemctl

show-environment > ${LOGDIR}/system/systemd/systemctl


--version

> ${LOGDIR}/system/systemd/systemctl

list-unit-files > ${LOGDIR}/system/systemd/systemctl

_list-unit-files.out 2>&1
$SYSTEMCTL list-jobs
> ${LOGDIR}/system/systemd/systemctl
_list-jobs.out
2>&1
$SYSTEMCTL list-unit-files --type=service > ${LOGDIR}/system/sy
stemd/systemctl_list--unit-files_--type=service.out 2>&1
fi
}
##############################################################################
#
#
Function : deb_info
#
Parameters :
#
Output :
#
Notes : Collect information above Debian packages
#
##############################################################################
function deb_info
{
if [ -f /var/lib/dpkg/available ] ; then
Echo "Section - deb package information "
MakeDir ${LOGDIR}/var/lib/dpkg
if [ -f /var/lib/dpkg/status ] ; then
$CP -p /var/lib/dpkg/status ${LOGDIR}/var/lib/dpkg/statu
s
fi
MakeDir ${LOGDIR}/software/dpkg
if [ -x "$DPKG"
$DPKG
g/dpkg_--list.out
$DPKG
g/dpkg_-al.out
$DPKG
g/dpkg_-get-selections.out
fi

] ; then
--list

> ${LOGDIR}/software/dpk

-al

> ${LOGDIR}/software/dpk

--get-selections

> ${LOGDIR}/software/dpk

if [ -x "$DPKG_QUERY" ] ; then
$DPKG_QUERY -W
g/dpkg-query_-W.out
fi

> ${LOGDIR}/software/dpk

if [ -x /usr/bin/apt-config ] ; then
/usr/bin/apt-config dump
g/apt-config_dump.out
fi

> ${LOGDIR}/software/dpk

fi
}

##############################################################################
#
#
Function : suse_zypper_info
#
Parameters :
#
Output :
#
Notes : Collect information above Suse packages
#
##############################################################################
function suse_zypper_info
{
if [ -x "$ZYPPER" ] ; then
Echo "Section - Suse Zypper Info "
MakeDir ${LOGDIR}/software/zypper
$ZYPPER repos

> ${LOGDIR}/software/zypper/zypper_repos

$ZYPPER locks

> ${LOGDIR}/software/zypper/zypper_locks

$ZYPPER patches

> ${LOGDIR}/software/zypper/zypper_patch

$ZYPPER packages

> ${LOGDIR}/software/zypper/zypper_packa

$ZYPPER patterns

> ${LOGDIR}/software/zypper/zypper_patte

$ZYPPER products

> ${LOGDIR}/software/zypper/zypper_produ

$ZYPPER services

> ${LOGDIR}/software/zypper/zypper_servi

$ZYPPER licenses

> ${LOGDIR}/software/zypper/zypper_licen

$ZYPPER targetos

> ${LOGDIR}/software/zypper/zypper_targe

$ZYPPER list-updates

> ${LOGDIR}/software/zypper/zypper_list-

2>&1
2>&1
es

2>&1

ges

2>&1

rns

2>&1

cts

2>&1

ces

2>&1

ses

2>&1

tos

2>&1

updates 2>&1
fi
}

##############################################################################
#
#
Function : gentoo_pkgs_info
#
Parameters :
#
Output :
#
Notes : This Section is for Gentoo - so we can work out what
#
packages are installed- Provided by Adam Bills
#
##############################################################################
function gentoo_pkgs_info
{
if [ -d /var/db/pkg ] ; then

Echo "Section - Gentoo Packages Info "


MakeDir ${LOGDIR}/software/gentoo
GENTOPKGS=${LOGDIR}/software/gentoo/gento_kgs.out
( find /var/db/pkg -type f -name environment.bz2 | while read x;
do bzcat $x | \
awk -F= '{
if ($1 == "CATEGORY"){
printf "%s ", $2;
}
if ($1 == "PN"){
printf "%s ",$2;
}
if ($1 == "PV"){
print $2;
}
}' ; done
) >> $GENTOPKGS
if [ -x $EQUERY ] ; then
$EQUERY list > ${LOGDIR}/software/gentoo/equery_list.out
fi
fi
# Show the bootup info
if [ -x $RC_UPDATE ] ; then
$RC_UPDATE show > ${LOGDIR}/software/gentoo/rc-update_show.out
fi
}
##############################################################################
#
#
Function : spacewalk_info
#
Parameters :
#
Output :
#
Notes : See if we have spacewalk installed
#
##############################################################################
function spacewalk_info
{
if [ -x $SPACERPT ] ; then
Echo "Section - Spacewalk "
MakeDir ${LOGDIR}/satellite
for info in users channels errata-list entitlements inventory us
ers-systems errata-systems
do
$SPACERPT $info > ${LOGDIR}/satellite/${SPACERPT}_${in

fo} 2>&1
done
fi
}
##############################################################################
#
#
Function : rhn_info
#
Parameters :
#
Output :
#
Notes : Collect Redhat Network Information
#
##############################################################################
function rhn_info
{
if [ -d /etc/sysconfig/rhn ] ; then
Echo "Section - RedHat Network "
RDIR=${LOGDIR}/rhn
MakeDir ${RDIR}
if [ -d /etc/rhn ] ; then
if [ -f /etc/sysconfig/rhn/systemid ] ; then
if [ -x /usr/bin/xsltproc ] ; then
/usr/bin/xsltproc $UTILDIR/text.xsl $RDIR/sy
stemid \
> $ROOT/$RHNDIR/systemid 2>&1
fi
fi
fi
fi
}

##############################################################################
#
#
Function : system_logs_info
#
Parameters :
#
Output :
#
Notes : Take a copy of the latest logs
#
##############################################################################
function system_logs_info
{
Echo "Section - Systems Log "
$CP -R -p /var/log/* ${LOGDIR}/logs
$DMESG > ${LOGDIR}/logs/dmesg.out
$LAST > ${LOGDIR}/logs/lastlog
if [ -d /var/crash ] ; then
for i in $( $FIND /var/crash -name "*.txt" )

do
dirname="$(dirname $i)"
filename="$(basename $i)"
if [ ! -d ${LOGDIR}/${dirname} ] ; then
MakeDir ${LOGDIR}/${dirname}
fi
$CP -p $i ${LOGDIR}/${dirname}/${filename} 2>/dev/null
done
fi
if [ -x $JOURNALCTL ] ; then
$JOURNALCTL --all --no-pager > ${LOGDIR}/logs/journalctl_--all
_--no-pager.out
fi
}
##############################################################################
#
#
Function : selinux_info
#
Parameters :
#
Output :
#
Notes : selinux info
#
##############################################################################
function selinux_info
{
Echo "Section - SElinux Section checks"
SELINUXDIR=${LOGDIR}/selinux
MakeDir ${SELINUXDIR}
if [ -x $SESTATUS ] ; then
$SESTATUS
> ${SELINUXDIR}/sestatus.out
2>&1
$SESTATUS -bv > ${SELINUXDIR}/sestatus_-bv.out 2>&1
fi
if [ -x $SEMANAGE
$SEMANAGE
.out
2>&1
$SEMANAGE
l.out
2>&1
$SEMANAGE
.out
2>&1
$SEMANAGE
.out
2>&1
$SEMANAGE
ce_-l.out 2>&1
$SEMANAGE
_-l.out 2>&1
fi

] ; then
port -l

> ${SELINUXDIR}/semanage_port_-l

login -l

> ${SELINUXDIR}/semanage_login_-

user -l

> ${SELINUXDIR}/semanage_user_-l

node -l

> ${SELINUXDIR}/semanage_node_-l

interface -l

> ${SELINUXDIR}/semanage_interfa

boolean -l

> ${SELINUXDIR}/semanage_boolean

if [ -x $GETSEBOOL ] ; then
$GETSEBOOL -a > ${LOGDIR}/selinux/getsebool_-a.out 2>&1
else
echo "getsebool not installed " > ${LOGDIR}/selinux/getsebool_a.out 2>&1
fi
}
##############################################################################
#
#
Function : xen_info
#
Parameters :
#
Output :
#
Notes : XEN VM information
#
##############################################################################
function xen_info
{
if [ -d /etc/xen ] ; then
Echo "Section - xen Section checks"
MakeDir ${VIRT}/xen
if [ -x $XM ] ; then
$XM list

> $VIRT/xen/xm_list.out

2>&1
$XM info

> $VIRT/xen/xm_info.out

$XM logs

> $VIRT/xen/xm_log.out

$XM dmesg

> $VIRT/xen/xm_dmesg.out

$XM vcpu-list

> $VIRT/xen/xm_vcpu-list.out

2>&1
2>&1
2>&1
2>&1
for myHost in $($XM list 2>/dev/null | egrep -v "VCPUs
|^Domain-0")
do
etwork-list_${myHost}.out

2>&1

ptime_${myHost}.out

2>&1

h_dominfo_${myHost}.out

$XM network-list $myHost

> $VIRT/xen/xm_n

$XM uptime $myHost

> $VIRT/xen/xm_u

$VIRSH dominfo $myHost

> $VIRT/xen/virs

2>&1
done

fi
fi
}
##############################################################################
#
#
Function : libvirt_info
#
Parameters :
#
Output :

#
Notes : Virt-manager type information
#
##############################################################################
function libvirt_info
{
if [ -x $VIRSH ] ; then
Echo "Section - libvirt Section "
MakeDir ${VIRT}/libvirt
MakeDir ${VIRT}/vm_configs
$VIRSH list --all

>

${VIRT}/libvirt/virsh_list_--all

$VIRSH net-list --all

>

${VIRT}/libvirt/virsh_net-list_-

.out 2>&1
-all.out 2>&1
$VIRSH -c qemu:///system capabilities \
> ${VIRT}/libvirt/virsh_-c_qemu:___s
ystem_capabilities.out 2>&1
# Next Dump out all the running configs for each of the VMs
List=$( $VIRSH list --all 2>/dev/null | egrep -v "State|^-" | aw
k '{print $2}' | sed '/^$/d')
for i in $List
do
$VIRSH dumpxml $i > ${VIRT}/vm_configs/${i}.xml 2>&1
done
fi
}
##############################################################################
#
#
Function : docker_info
#
Parameters :
#
Output :
#
Notes : docer information
#
##############################################################################
function docker_info
{
if [ -x $DOCKER ] ; then
Echo "Section - Docker"
DockerDir=${VIRT}/docker
MakeDir $DockerDir
$DOCKER
$DOCKER
$DOCKER
$DOCKER

ps
ps -a
ps -l
images

>
>
>
>

$DockerDir/docker_ps.out 2>&1
$DockerDir/docker_ps_-a.out 2>&1
$DockerDir/docker_ps_-l.out 2>&1
$DockerDir/images.out 2>&1

# $DOCKER events > $DockerDir/images.out 2>&1


for containerID in $($DOCKER ps -l | grep -v STATUS | awk '{prin
t $1}' )
do
$DOCKER inspect $containerID > $DockerDir/docker_inspec
t_${containerID}.out 2>&1
$DOCKER port
$containerID > $DockerDir/docker_port_$
{containerID}.out 2>&1
$DOCKER logs
$containerID > $DockerDir/docker_logs_$
{containerID}.out 2>&1
done
for imageID in $($DOCKER ps -l | grep -v STATUS | awk '{print $1
}' )
do
$DOCKER history $imageID > $DockerDir/docker_history_${
imageID}.out 2>&1
done
fi
}

##############################################################################
#
#
Function : yp_info
#
Parameters :
#
Output :
#
Notes : Yellow Pages information - not used that much these days
#
##############################################################################
function yp_info
{
if [ -x "$YPWHICH" ] ; then
Echo "Section - NIS/YP Services "
YPDIR=${LOGDIR}/yp
MakeDir ${YPDIR}
$YPWHICH -m > ${YPDIR}/ypwhich-m.out 2>&1
fi
}

##############################################################################
#
#
Function : network_info
#
Parameters :
#
Output :

#
Notes : Collect lots of network information
#
##############################################################################
function network_info
{
Echo "Section - Networking "
MakeDir ${LOGDIR}/network
$IFCONFIG -a
$NETSTAT -rn
$NETSTAT -lan
$NETSTAT -lav
$NETSTAT -tulpn
$NETSTAT -ape
$NETSTAT -uan
$NETSTAT -s
$NETSTAT -in
$ROUTE -nv
$ARP -a

>
>
>
>
>
>
>
>
>
>
>

${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/netstat_-in.out
${LOGDIR}/network/route_-nv.out
${LOGDIR}/network/arp_-a.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
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
if [ -x $BIOSDEVNAME ] ; then
$BIOSDEVNAME -d > ${LOGDIR}/network/biosdevname_-d.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] | awk '{ print $1}')
do
$BRCTL showmacs $myBridge > ${LOGDIR}/network/btctl_show
macs_${myBridge}.out 2>&1
$BRCTL showstp $myBridge > ${LOGDIR}/network/btctl_show
stp_${myBridge}.out 2>&1
done

fi
}
##############################################################################
#
#
Function : iptables_info
#
Parameters :
#
Output :
#
Notes : Collect iptables information
#
##############################################################################
function iptables_info
{
if [ -x "$IPTABLES" ] ; then
Echo "Section - iptables check"
$IPTABLES -L

> ${LOGDIR}/network/iptables-L.o

$IPTABLES -t filter -nvL

> ${LOGDIR}/network/iptables-t_f

$IPTABLES -t mangle -nvL

> ${LOGDIR}/network/iptables-t_m

$IPTABLES -t nat -nvL

> ${LOGDIR}/network/iptables_-t_

ut
ilter-nvL.out
angle-nvL.out
nat_-nvL.out
else
echo "no iptables in kernel"

> ${LOGDIR}/network/iptables-NO-I

P-TABLES
fi
}

##############################################################################
#
#
Function : ipchains_info
#
Parameters :
#
Output :
#
Notes : ipchains not use much these days - replaced by iptables
#
##############################################################################
function ipchains_info
{
if [ -x "$IPCHAINS" ] ; then
Echo "Section - ipchains check"
$IPCHAINS -L -n > ${LOGDIR}/network/ipchains_-L_-n.out
fi
}
##############################################################################
#

#
Function : ethtool_info
#
Parameters :
#
Output :
#
Notes : More networking information
#
##############################################################################
function ethtool_info
{
if [ -x "$ETHTOOL" ] ; then
Echo "Section - ethtool checks"
for version in 4 6
do
INTERFACES=$( cat /proc/net/dev | grep "[0-9]:" | awk -F
: '{print $1 }' )
for i in $INTERFACES
do
$ETHTOOL $i
ipv${version}_${i}.out
2>&1
$ETHTOOL -i $i
ipv${version}_-i_${i}.out 2>&1
$ETHTOOL -S $i
ipv${version}_-S_${i}.out 2>&1
done
done
fi
}

> ${LOGDIR}/network/ethtool_
>> ${LOGDIR}/network/ethtool_
>> ${LOGDIR}/network/ethtool_

##############################################################################
#
#
Function : redhat_cluster_info
#
Parameters :
#
Output :
#
Notes : Collect information about Redhat Cluster
#
##############################################################################
function redhat_cluster_info
{
if [ -x $CLUSTAT ] ; then
Echo "Section - Redhat Cluster checks"
MyClusterDir=${CLUSTERDIR}/redhat
MakeDir ${CLUSTERDIR}/redhat
$CLUSTAT
$CLUSTAT
$CLUSTAT
$CLUSTAT
$CLUSTAT
$CLUSTAT

-f
-l
-I
-v
-x

>
>
>
>
>
>

$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

$CLUSVCADM -v
$CLUSVCADM -S

> $MyClusterDir/clusvcadm_-x.out
> $MyClusterDir/clusvcadm_-S.out

#
# List out Quorum devices and CMAN_TOOL
#
if [ -x $MKQDISK ] ; then
$MKQDISK -L >> $MyClusterDir/mkqdisk_-L.out
fi

2>&1
2>&1

2>&1

# added by Ruggero Ruggeri


if [ -x $CMAN_TOOL ] ; then
$CMAN_TOOL status >> $MyClusterDir/cman_tool_status.out
2>&1
$CMAN_TOOL nodes >>

$MyClusterDir/cman_tool_nodes.out

2>&1
fi
fi
}

##############################################################################
#
#
Function : veritas_cluster_info
#
Parameters :
#
Output :
#
Notes : Collect information about Veritas Cluster
#
##############################################################################
function veritas_cluster_info
{
if [ -d /opt/VRTSvcs/bin ] ; then
PATH=$PATH:/opt/VRTSvcs/bin
fi
if [ -f /etc/VRTSvcs/conf/config/main.cf ] ; then
Echo "Section - Veritas Cluster Checks"
VCSDIR=${CLUSTERDIR}/veritas
MakeDir ${VCSDIR}
if [ -d /var/VRTSvcs/log ] ; then
MakeDir ${LOGDIR}/var/VRTSvcs/log
$CP -p /var/VRTSvcs/log/* ${LOGDIR}/var/VRTSvcs/log
fi
$HASTATUS -sum
$HARES -list
$HAGRP -list
$HATYPE -list
$HAUSER -list

>
>
>
>
>

${VCSDIR}/hastatus_-sum.out
${VCSDIR}/hares_-list.out
${VCSDIR}/hagrp_-list.out
${VCSDIR}/hatype_-list.out
${VCSDIR}/hauser_-list.out

2>&1
2>&1
2>&1
2>&1
2>&1

$LLTSTAT -vvn
$GABCONFIG -a

>
>

${VCSDIR}/lltstat_-vvn.out 2>&1
${VCSDIR}/gabconfig_-a.out 2>&1

if [ -f /etc/VRTSvcs/conf/config/main.cf ] ; then
$HACF -verify /etc/VRTSvcs/conf/config/main.cf > ${VCSDIR}/h
acf-verify.out 2>&1
fi
fi
}
##############################################################################
#
#
Function : pacemake_cluster_info
#
Parameters :
#
Output :
#
Notes : Pacemaker cluster information collection
#
##############################################################################
function pacemake_cluster_info
{
if [ -x $CRM_MON ] ; then
Echo "Section - CRM Cluster checks"
CRMDIR=${CLUSTERDIR}/crm
MakeDir ${CRMDIR}
$CRM_MON --version > ${CRMDIR}/crm_mon_--version.out
if [ -x $CRM ] ; then
$CRM status

> ${CRMDIR}/crm_status.o

ut
$CRM configure show

> ${CRMDIR}/crm_configur

$CRM configure show xml

> ${CRMDIR}/crm_configur

$CRM ra classes

> ${CRMDIR}/crm_ra_class

$CRM ra list ocf heartbeat

> ${CRMDIR}/crm_ra_list_

$CRM ra list ocf pacemaker

> ${CRMDIR}/crm_ra_list_

e_show.out
e_show_xml.out
es.out
ocf_heartbeat.out
ocf_pacemaker.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
}

##############################################################################
#
#
Function : printing_info
#
Parameters :
#
Output :
#
Notes : Collectin information about print jobs and printers
#
##############################################################################
function printing_info
{
Echo "Section - Printer Checks"
PRINTDIR=${LOGDIR}/lp
MakeDir ${PRINTDIR}
MakeDir ${PRINTDIR}/general
if [ -x $LPSTAT ] ; then
$LPSTAT -t
> ${PRINTDIR}/lpstat_-t.out 2>&1
fi
if [ -x $LPC ] ; then
$LPC status
> ${PRINTDIR}/lpstat_status.out 2>&1
fi
$LPQ > ${PRINTDIR}/general/lpq.out 2>&1
if [ -x $LPQ_CUPS ] ; then
$LPQ_CUPS
> ${PRINTDIR}/lpq.cups.out 2>&1
fi
}
##############################################################################
#
#
Function : postfix_info
#
Parameters :
#
Output :
#
Notes : Collect information about postfix
#
##############################################################################
function postfix_info
{
if [ -d /etc/postfix ] ; then
Echo "Section - Postfix "
POSTDIR=${LOGDIR}/etc/postfix
MakeDir $POSTDIR
POSTTOPDIR=${LOGDIR}/mail/postfix
MakeDir $POSTTOPDIR

$POSTCONF -v
$POSTCONF -l

> ${POSTTOPDIR}/postconf_-v.out 2>&1


> ${POSTTOPDIR}/postconf_-l.out 2>&1

fi
}
##############################################################################
#
#
Function : exim_info
#
Parameters :
#
Output :
#
Notes : Collect information about exim
#
##############################################################################
function exim_info
{
if [ -d /etc/exim ] ; then
Echo "Section - Exim checks"
EXIMTOPDIR=${LOGDIR}/mail/exim
MakeDir $EXIMTOPTDIR
$EXIM -bV
$EXIM -bp

> ${LOGDIR}/mail/exim/exim_-bV.out
> ${LOGDIR}/mail/exim/exim_-bp.out

fi
}
##############################################################################
#
#
Function : dovecot_info
#
Parameters :
#
Output :
#
Notes : Collect information about dovecote
#
##############################################################################
function dovecot_info
{
if [ -d /etc/dovecot ] ; then
Echo "Section - Dovecot checks"
DOVETOPDIR=${LOGDIR}/mail/dovecot
MakeDir $DOVETOPTDIR
$DOVECOTE -a > ${LOGDIR}/mail/dovecot/dovecote_-a.out
fi
}
##############################################################################
#

#
Function : time_info
#
Parameters :
#
Output :
#
Notes : General time information
#
##############################################################################
function time_info
{
Echo "Section - NTP"
TIMEDIR=${LOGDIR}/etc/time
MakeDir ${TIMEDIR}
$DATE

> ${TIMEDIR}/date

if [ -f /usr/share/zoneinfo ] ; then
$CP -p /usr/share/zoneinfo ${TIMEDIR}/zoneinfo
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
}
##############################################################################
#
#
Function : apache_info
#
Parameters :
#
Output :
#
Notes : Collect any Apache Files
#
##############################################################################
function apache_info
{
if [ -d /etc/httpd ] ; then
APACHEDIR=${LOGDIR}/httpd
else
APACHEDIR=${LOGDIR}/apache
fi
if [ ! -d $APACHEDIR ] ; then
Echo "Section - Apache"
MakeDir ${APACHEDIR}
fi

if [ -x $APACHECTL ] ; then
$APACHECTL status > ${APACHEDIR}/apachectl_status.out 2>&1
fi
if [ -x $APACHE2CTL ] ; then
$APACHE2CTL status > ${APACHEDIR}/apache2ctl_status.out 2>&1
fi
}

##############################################################################
#
#
Function : samba_info
#
Parameters :
#
Output :
#
Notes : Collect some SAMBA information ( needs updating for Samba4)
#
##############################################################################
function samba_info
{
Echo "Section - Samba"
SAMBADIR=${LOGDIR}/hardware/disks/samba
if [ ! -d ${SAMBADIR} ] ; then
MakeDir ${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
if [ -x $PDBEDIT ] ; then
$PDBEDIT -L ${SAMBADIR}/pdbedit_-L.out 2>&1
fi
}
##############################################################################
#
#
Function : x11_info
#
Parameters :
#
Output :
#
Notes : X11
#
##############################################################################
function x11_info
{
Echo "Section - X11"

XDIR=${LOGDIR}/X
MakeDir $XDIR
if [ -x $SYSP
$SYSP
$SYSP
$SYSP
fi

] ; then
-c
-s mouse
-s keyboard

> ${XDIR}/sysp_-c.out
> ${XDIR}/sysp_-s_mouse.out
> ${XDIR}/sysp_-s_keyboard.out

if [ -x $_3DDIAG ] ; then
$_3DDIAG
> ${XDIR}/3Ddiag.out
fi
}

##############################################################################
#
#
Function : taritup_info
#
Parameters :
#
Output :
#
Notes : tar up all the files that are going to be sent to support
#
##############################################################################
function taritup_info
{
if [ "$CWDIR" != "" ] ; then
cd $CWDIR
else
cd $LOGDIR
fi
$TAR czf ${TARFILE} . > /dev/null 2>&1
if [ $? -ne 0 ] ; then
if [ -x $LOGGER ] ; then
$LOGGER -s "[ERROR]: creating the linux-explorer $TARFIL
E"
else
echo "[ERROR]: creating the linux-explorer $TARFILE"
fi
exit 1
fi
if [ -t 0 ] ; then
Sum=$($MD5SUM ${TARFILE} | $AWK '{print $1}' )
echo
echo "A support file has been created for support purposes"
echo
echo
echo "The MD5sum is
: $Sum"

echo "The Support File is : ${TARFILE}"


echo
echo "Please send this file and the MD5sum details to your suppo
rt representative. "
echo
fi
}
##############################################################################
#
#
Function : RemoveDir
#
Parameters : None
#
Output : None
#
Notes : Remove directories
#
##############################################################################
function RemoveDir
{
local myDIR=$1
if [ -d "$myDIR" ] ; then
if [[ "${myDIR}" != "/" && \
"${myDIR}" != "/var" && \
"${myDIR}" != "/usr" && \
"${myDIR}" != "/home" ]] ; then
if [ ${VERBOSE} -gt 0 ] ; then
Echo "Removing Old Directory : ${myDIR}"
fi
$RM -rf ${myDIR}
fi
fi
}
##############################################################################
#
#
Function : System_Info
#
Parameters : None
#
Output : None
#
Notes : Print out brief information about the system
#
##############################################################################
function System_Info
{
if [ ! -t 0 ] ; then
return
fi
if [ -f $EXPLCFG ] ; then
Echo "Section - Found $EXPLCFG file"
# Customer Contact Name

NAME=$(grep ^EXP_USER_NAME $EXPLCFG | cut -f2 -d'=' | sed s'/\"//g' )


# Customer Name
COMPANY=$(grep ^EXP_CUSTOMER_NAME $EXPLCFG | cut -f2 -d'=' | sed s'/\"//
g' )
# Customer Contact Phone Number
TELEPHONE=$(grep ^EXP_PHONE $EXPLCFG | cut -f2 -d'=' | sed s'/\"//g' )
# Customer Contact Email
EMAIL=$(grep ^EXP_USER_EMAIL $EXPLCFG | cut -f2 -d'=' | sed s'/\"//g' )
# Customer Contact City
CITY=$(grep ^EXP_ADDRESS_CITY $EXPLCFG | cut -f2 -d'=' | sed s'/\"//g' )
# Customer Contact Country
COUNTRY=$(grep ^EXP_ADDRESS_COUNTRY $EXPLCFG | cut -f2 -d'=' | sed s'/\"
//g' )
# Customer Contact Zip
ZIPCODE=$(grep ^EXP_ADDRESS_ZIP $EXPLCFG | cut -f2 -d'=' | sed s'/\"//g'
)
# Where LINUXexplo output should be mailed
SUPPORT=$(grep ^EXP_EMAIL $EXPLCFG | cut -f2 -d'=' | sed s'/\"//g' )
else
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo

"$MYNAME - $MYVERSION"
"This program will gather system information and can take several"
"minutes to finish."
"You must complete some questions before start."
"It will produce a .tgz or .tgz.gpg file output and a directory"
"on your /opt/LINUXexplo/linux/ directory".
"Please follow the support instruction for submit this information"
"For contact the support please send a email to <$SUPPORT>"
"******************************************************************

****"
echo "Personal information"
echo "******************************************************************
****"
read
read
read
read
read
read
read
echo
echo

-p
-p
-p
-p
-p
-p
-p

"Company
"Your name
"Email
"Telephone
"City
"Zipcode
"Country

:
:
:
:
:
:
:

"
"
"
"
"
"
"

COMPANY
NAME
EMAIL
TELEPHONE
CITY
ZIPCODE
COUNTRY

"******************************************************************

****"
echo "System information"
echo "******************************************************************
****"
read -p "Problem description
read -p "System description

: " PROBLEM
: " SYSTEM

read -p "Environment (test/dev/prod)


echo
read -p "Are you sure to continue? (Y/n)

: " ENVIRONMENT
: " REPLY

if [[ "$REPLY" = [Yy] ]]; then


Echo "Starting support gathering process."
else
Echo "Aborting."
exit 0
fi
fi
systemPlatform=$($UNAME -m)
kernelVersion=$($UNAME -r)
Mem=$(cat /proc/meminfo | grep ^MemTotal: | awk '{print $2}')
MEMINFO=$(echo $(($Mem / 1000000)))
if [ -x $LSB_RELEASE ] ; then
LSB_RELEASE_INFO=$(${LSB_RELEASE} -a )
else
LSB_RELEASE_INFO="Could not find LSB_RELEASE info"
fi
if [ -x $DMIDECODE ] ; then
SYSTEM=$($DMIDECODE -t 1 | grep "Product Name:" | awk -F\: '{print $2}')
else
SYSTEM="Unknown"
fi
/bin/cat <<- EOF > /tmp/README
----------------------------------------------------------------------------$MYNAME - $MYVERSION
----------------------------------------------------------------------------This directory contains system configuration information.
Information was gathered on $MYDATE
Contact support made by: $NAME from $COMPANY
----------------------------------------------------------------------------CONTACT INFORMATION
----------------------------------------------------------------------------Company
Name
Email
Telephone
City
Zipcode
Country

:
:
:
:
:
:
:

$COMPANY
$NAME
$EMAIL
$TELEPHONE
$CITY
$ZIPCODE
$COUNTRY

---------------------------------------------------------------------------SYSTEM INFORMATION
---------------------------------------------------------------------------Date
Command Line
Hostname
Host Id

:
:
:
:

$MYDATE
$0 $@
$MYHOSTNAME
${HOSTID}

System type
:
System platform
:
Kernel Version
:
Server Memory
:
Environment
:
System description :
Problem description:

$SERVER
$systemPlatform
$kernelVersion
${MEMINFO}GB
$ENVIRONMENT
$SYSTEM
$PROBLEM

---------------------------------------------------------------------------$LSB_RELEASE_INFO
---------------------------------------------------------------------------Uptime:
$(${UPTIME})
swapon -s:
$($SWAPON -s | $GREP -v "Filename")
vmstat:
$($VMSTAT 2 5 | $SED '1d' | $COLUMN -t 2> /dev/null )
df:
$($DF -h )
Network:
$($IFCONFIG -a )
---------------------------------------------------------------------------EOF
# Create support information so we don't have to ask the customer each time.
if [ ! -f $EXPLCFG ] ; then
cat <<- EOF > $EXPLCFG
# Customer Contact Name
EXP_USER_NAME="$NAME"
# Customer Name
EXP_CUSTOMER_NAME="$COMPANY"
# Customer Contact Phone Number
EXP_PHONE="$TELEPHONE"
# Customer Contact Email
EXP_USER_EMAIL="$EMAIL"
# Customer Contact City
EXP_ADDRESS_CITY="$CITY"
# Customer Contact Country
EXP_ADDRESS_COUNTRY="$COUNTRY"
# Customer Contact Zip
EXP_ADDRESS_ZIP="$ZIPCODE"
# Where LINUXexplo output should be mailed
EXP_EMAIL="$SUPPORT"

# Default list of modules to run


EXP_WHICH="all"
EOF
fi
}
##############################################################################
#
#
Function : copy_etc
#
Parameters :
#
Output :
#
Notes : Make a copy of the /etc directory so that we have all files
#
##############################################################################
function copy_etc
{
Echo "Section - Copy etc"
if [ ! -d "${LOGDIR}/etc" ]; then
MakeDir "${LOGDIR}/etc"
$CP -Rp /etc/* ${LOGDIR}/etc/
if [ -f ${LOGDIR}/etc/shadow ] ; then
$RM -f ${LOGDIR}/etc/shadow
fi
fi
}
##############################################################################
#
#
Function : Installation_details
#
Parameters : None
#
Output : None
#
Notes : Collection information about installation
#
##############################################################################
function installation_details
{
Echo "Section - Installation info"
if [ -f "/root/anaconda-ks.cfg" ]; then
MakeDir "${LOGDIR}/system/Installation"
$CP -p "/root/anaconda-ks.cfg" ${LOGDIR}/system/Installation/ana
conda-ks.cfg
fi
}
##############################################################################
#
MAIN
##############################################################################

#
# Ensure that we are the root user
#
if [ ${UID} -ne 0 ] ; then
echo
echo "ERROR: Sorry only the root user can run this script"
echo
exit 1
fi

# Remove any temporary files we create


trap '$RM -f $TMPFILE >/dev/null 2>&1; exit' 0 1 2 3 15
##############################################################################
#
Check the command line options
##############################################################################
while getopts ":d:k:t: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%%/}
echo "DEBUG: TOPDIR <$TOPDIR>"
CWDIR=$(pwd)
fi
;;
k) KEEPFILES="1"
;;
t)

CHECKTYPE="$OPTARG"
# echo "DEBUG: checktype : $CHECKTYPE"
;;

v) VERBOSE="1"
;;
D) DEBUG="1"
;;
s) FULLSOFT="1"
;;
h) ShowUsage
;;
V) echo
echo "LINUXexplo Version : $MYVERSION"
echo
exit 0

;;
esac
done
if [ ${VERBOSE} -gt 0 ] ; then
if [ -t 0 ] ; then
tput clear
fi
fi

LOGTOP="${TOPDIR}/linux"
LOGDIR="${LOGTOP}/explorer.${HOSTID}.${MYSHORTNAME}-${MYDATE}"
TARFILE="${LOGDIR}.tar.gz"
NOTFNDLOG="${LOGDIR}/command_not_found.out"
CLUSTERDIR=${LOGDIR}/clusters

if [ ! -d $LOGDIR ] ; then
/bin/mkdir -p $LOGDIR
fi
# find ALL my commands for this script
findCmds
System_Info
Echo "Creating Explorer Directory : $LOGDIR"
RemoveDir ${LOGTOP}
# echo "LOGDIR : \"${TOPDIR}/linux/${MYHOSTNAME}-${DATE}/output\" "
# make sure this is a linux system
if [ "$($UNAME -s)" != "Linux" ] ; then
echo "ERROR: This script is only for Linux systems "
exit 1
fi
# Make the directory I'm going to store all the files
if [ ! -d $LOGDIR ] ; then
MakeDir $LOGDIR
fi
if [ -f /tmp/README ] ; then
mv /tmp/README ${LOGDIR}/README
fi
echo "$MYVERSION" > ${LOGDIR}/rev

copy_etc
myselection "$CHECKTYPE"
taritup_info
# Remove all the files tared up in $LOGDIR ( except tar file )
if [ $KEEPFILES -eq 1 ] ; then
RemoveDir ${LOGDIR}
fi
##############################################################################
#
That's ALL Folks !!!
##############################################################################

Das könnte Ihnen auch gefallen