#!/bin/bash
echo "This script is used to collect preoutput from LINUX systems for any type of activity"
#Preoutput collection script version 1.0"
OS=$(cat /etc/*release)
OUTPUT=/tmp/preoutput
echo "The following system outputs has taken on $(date)" > $OUTPUT
echo "System Info:" $HOSTNAME >> $OUTPUT
echo "OS Version" $OS
preoutput_fs ()
{
OUTPUT=/tmp/preoutput
{
echo ""
echo "Collecting Mounted File System Details (df -h)"
echo "***********************************************"
df -h
echo ""
echo "Total number of Mounted File Systems (df -h | wc -l)"
echo "***********************************************"
df -h | wc -l
echo ""
echo "Mounted File Systems with mount properties (mount)"
echo "***********************************************"
mount
echo "NFS/NAS File system details"
echo "***********************************************"
mount | grep nfs
} >> $OUTPUT 2>&1
}
preoutput_network ()
{
OUTPUT=/tmp/preoutput
{
echo "Routing Table Details (netstat -rn)"
echo "************************************"
netstat -rn
echo "Routing Table Entries Count (netstat -rn | wc -l)"
echo "************************************"
netstat -rn | wc -l
echo "State of all configured network interfaces (netstat -in)"
echo "************************************"
netstat -in
echo "Network entity info (Configured Network Interfaces)"
echo "************************************"
/etc/init.d/network status
echo "IP Address Details (ifconfig -a)"
echo "************************************"
ifconfig -a
echo "Etherchannel Details (cat /proc/net/bonding/bond*)"
echo "************************************"
ls /proc/net/bonding/ | grep -q bond 2>/dev/null
if [ $? = 0 ]
then
echo "Etherchannel Bonding configured"
BINTERFACE=`ls /proc/net/bonding/ | grep bond`
echo "Etherchannel Adapter"
echo "************************************"
echo "Bond Interface is $BINTERFACE"
echo "************************************"
echo "Etherchannel Adapter Details"
echo "************************************"
ethtool $BINTERFACE
echo "Etherchannel Network Link status"
echo "************************************"
cat /proc/net/bonding/$BINTERFACE | grep -i mii
echo "Etherchannel Network Adapter Speed"
echo "************************************"
cat /proc/net/bonding/$BINTERFACE | grep -i Speed
echo "Etherchannel Active Channel"
echo "************************************"
cat /proc/net/bonding/$BINTERFACE | grep -i active
echo "Etherchannel Mode"
cat /proc/net/bonding/$BINTERFACE | grep -i mode
echo "Etherchannel Active Channel"
echo "************************************"
cat /proc/net/bonding/$BINTERFACE | grep -i current
echo "VLAN Adapters"
echo "************************************"
cat /proc/net/vlan/config
else
echo "No Etherchannel configured.."
fi
} >> $OUTPUT 2>&1
}
preoutput_process ()
{
OUTPUT=/tmp/preoutput
{
echo "Java process running on the system"
echo "**********************************"
ps -aef | grep -i java
echo "Websphere applications running on the system"
echo "**********************************"
ps -aef | grep -i web
echo "ITM Agent running on the system"
echo "**********************************"
ps -aef | grep -i itm
echo "ITM agent version"
echo "**********************************"
/opt/IBM/ITM/bin/cinfo -r 2>/dev/null
echo "Sendmail service running on the system"
echo "**********************************"
ps -aef | grep -i sendmail
echo "FTP process running on the system"
echo "**********************************"
ps -aef | grep -i ftp
echo "Http process running on the system"
echo "**********************************"
ps -aef | grep -i http
echo "Mysql process running on the system"
echo "**********************************"
ps -aef | grep -i mysql
echo "Total process running on the system"
ps -aef
} >> $OUTPUT 2>&1
}
preoutput_binfo ()
{
OUTPUT=/tmp/preoutput
{
echo "Bootloader info (grub.conf) "
echo "**************************************"
cat /boot/grub/grub.conf
echo "Current Running kernel version"
uname -r
} >> $OUTPUT 2>&1
}
preoutput_virtmemory ()
{
OUTPUT=/tmp/preoutput
{
echo "Swap Memory Details (free -m)"
echo "*****************************"
free -m
echo "*****************************"
cat /proc/meminfo
echo "System Load Details (uptime)"
echo "*****************************"
uptime
} >> $OUTPUT 2>&1
}
preoutput_t1_disks ()
{
OUTPUT=/tmp/preoutput
{
multipath -ll 2>/dev/null
if [ $? = 0 ]
then
echo "Multipath is running on the system"
/etc/init.d/multipathd status
echo "Multipath Disks Details"
echo "**********************"
fdisk -l
echo "Multipath disks (multipath -ll)"
echo "********************************"
multipath -ll | grep -i mpath
echo "Connected Disks Details (multipath -ll)"
echo "********************************"
multipath -ll
echo "EMC T1(Symmetrix) disk details"
echo "********************************"
multipath -ll | grep -i Symmetrix
echo "EMC T2 (Clariion) Disk Details"
echo "********************************"
multipath -ll | grep -i DGC
else
echo "Multipath is not running on the system"
fi
} >> $OUTPUT 2>&1
}
preoutput_vg_details ()
{
OUTPUT=/tmp/preoutput
{
echo "Physical Volume Details (pvs)"
pvs
echo "Volume Group Details (vgs)"
echo "********************************"
vgs
echo "Open Logical Volumes (lvs)"
echo "********************************"
lvs
echo "********************************"
echo "Open Physical Volumes Details"
echo "********************************"
pvs -o +devices
echo "********************************"
echo "Open Volume group Details"
echo "********************************"
vgs -o +devices
echo "********************************"
echo "Open Logical Volumes Details"
echo "********************************"
lvs -o +devices
echo "Open Logical Volumes Details (lsvg -o)"
echo "********************************"
} >> $OUTPUT 2>&1
}
preoutput_t2_disks ()
{
OUTPUT=/tmp/preoutput
{
echo "Clariion Disks details with LUN, Array Number and Size"
echo "**********************"
rpm -qa | grep -i EMCpower
if [ $? = 0 ]
then
for i in `powermt display dev=all | grep -i Pseudo | awk '{ print $2 }' | cut -f2 -d '='`
do
x=`powermt display dev=$i | grep -E "CLARiion | VNX"`
y=`powermt display dev=$i | grep LUN`
echo $i "" $x "" $y
done
else
echo "There is no Clariion disks connected to the system"
fi
} >> $OUTPUT 2>&1
}
preoutput_powerpath_disks ()
{
OUTPUT=/tmp/preoutput
{
echo "Disks under EMC powerpath"
echo "**********************"
rpm -qa | grep -i EMCpower
if [ $? = 0 ]
then
echo "**********************"
powermt display
echo "**********************"
powermt display dev=all
else
echo "There is no disks under powerpath connected to the system"
fi
} >> $OUTPUT 2>&1
}
preoutput_db_disk ()
{
OUTPUT=/tmp/preoutput
echo "Database disk details"
#echo "*********************"
{
/etc/init.d/oracleasm listdisks 2>/dev/null
ps -aef | grep pmon
ls -lt /dev/oracleasm/disks | grep oracle
ls -lt /dev/oracleasm/disks | grep dba
ls -lt /dev/oracleasm/disks | grep oracle | wc -l
ls -lt /dev/oracleasm/disks | grep dba | wc -l
} >> $OUTPUT 2>&1
}
preoutput_pkgs_check ()
{
OUTPUT=/tmp/preoutput
echo "OS Patches Details"
echo "*********************"
{
echo "Service pack with TL level"
echo ""
cat /etc/*release
echo ""
echo "Checking installed filesets"
rpm -qa
echo " "
rpm -qa -last
} >> $OUTPUT 2>&1
}
preoutput_sys_sub_info ()
{
OUTPUT=/tmp/preoutput
echo "OS Sub system Details"
echo "*********************"
{
echo "System UPTIME is"
echo ""
uptime
echo " "
/sbin/service --status-all
} >> $OUTPUT 2>&1
}
preoutput_cons_sub_info ()
{
OUTPUT=/tmp/preoutput
echo "Console,Error log,Firmware,System,sys0 Details"
echo "*********************"
{
echo ""
dmesg
echo " "
dmidecode
echo " "
} >> $OUTPUT 2>&1
}
preoutput_resource_info ()
{
OUTPUT=/tmp/preoutput
echo "Collecting Resource Details"
echo "*********************"
{
dmidecode
echo " "
echo "****************************************************"
echo " "
lspci
echo "****************************************************"
} >> $OUTPUT 2>&1
}
echo "Collecting File system Details"
preoutput_fs
echo "Collecting Network Details"
preoutput_network
echo "Collecting Process Details"
preoutput_process
echo "Collecting bootinfo Details"
preoutput_binfo
echo "Collecting SWap Details"
preoutput_virtmemory
echo "Collecting Storage(T1) disks Details"
preoutput_t1_disks
echo "Collecting Storage (T2) disks Details"
preoutput_t2_disks
echo "Collecting Database disks Details"
preoutput_db_disk
echo "Collecting OS packages Details"
preoutput_pkgs_check
echo "OS Subsystem Details"
preoutput_sys_sub_info
echo "Collecting Console Details"
preoutput_cons_sub_info
echo "Disks under Powerpath"
preoutput_powerpath_disks
echo "Collecting system reources Details"
preoutput_resource_info
echo "Collecting VG Details"
preoutput_vg_details
echo "Preoutput collection completed!!!"
mv $OUTPUT $OUTPUT.$HOSTNAME.$(date +%m%d%y).txt 2>&1
Comments
Post a Comment