| Server IP : 152.69.216.235 / Your IP : 80.80.80.28 Web Server : Apache/2.4.37 (Oracle Linux Server) System : Linux ust-wp4-prod 5.15.0-310.184.5.2.el8uek.x86_64 #2 SMP Wed Jul 9 16:08:33 PDT 2025 x86_64 User : apache ( 48) PHP Version : 8.4.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /sbin/ |
Upload File : |
#!/bin/sh
######################################################################
# Copyright (c) 2020 by Oracle Corporation
# OSWatcher.sh
# This is the main oswbb program. This program is started by running
# startOSWbb.sh
######################################################################
# Modifications Section:
######################################################################
## Date File Changes
######################################################################
## 04/18/2005 Baseline version 1.2.1
##
## 05/19/2005 OSWatcher.sh Add -x option to iostat on linux
## V1.3.1 Add code to write pwd to /tmp/osw.hb
## for rac_ddt to find osw archive
## files
##
## V1.3.2 OSWatcher.sh Remove -f flag from $TOP for HP Conf
## section. Append -f flag to $TOP when
## running the HP top cmd
##
## 09/29/2006 OSWatcher.sh Added $PLATFORM key and OSW version
## V2.0.0 info to header of all files. This
## will enable parsing by PTA and
## OSWg
##
## 10/03/2006 OSWg.jar Fixed format problem for device names
## V2.0.1 greater than 30 characters
##
## 10/06/2006 OSWg.jar Fixed linux flag to detect linux
## V2.0.2 archive files. Fixed bug with
## empty lists causing exceptions
## when graphing data on platforms
## other than solaris
## 07/24/2007 OSWatcher.sh Added enhancements requested by
## V2.1.0 linux bde. These include using a
## environment variable to control the
## amount of ps data, changes to top
## and iostat commands, change format
## of filenames to yy.mm.dd, add
## optional flag to compress files.
## Added -D flag for aix iostat
## 07/24/2007 oswlnxtop.sh Created new file for linux top
## V2.1.0 collection.
## 07/24/2007 oswlnxio.sh Created new file for linux iostat
## V2.1.0 collection.
## 07/24/2007 startOSW.sh Added optional 3rd parameter to
## V2.1.0 compress files
## 11/26/2007 oswlnxtop.sh Fixed bug with awk script. Bug caused
## V2.1.1 no output on some linux platforms
## 12/16/2008 OSWg.jar Fixed problem reading aix
## V2.1.2 iostat files
## 06/16/2009 OSWg.jar Release 3.0 for EXADATA
## V3.0.0
## 02/11/11 OSWg.jar Bug Fix for linux iostat spanning
## V3.0.1 multiple lines
## 05/04/11 Fixed directory permission on
## V3.0.2 install of osw.tar
## 02/01/12 OSWatcher.sh Release 4.0 for OSWbb
## V4.0.0
## 03/01/12 OSWbba.jar Bug fix for throughput
## V4.0.1 analysis
## 03/06/12 OSWbba.jar Bug fix for timestamp
## V4.0.2
## 06/18/12 OSWatcher.sh Release 5.0 for oswbb
## V5.0.0
## 06/18/12 OSWatcher.sh Release 5.1 for oswbb
## V5.1.0 added nfs collection
## for linux
## V5.1.1 OSWbba.jar Ignore compressed files
## 08/22/12 when analyzing
## V5.2.0 OSWatcher.sh Multiple bug fix release
## 11/7/12 fix vmstat inserting corrupt data
## oswbba.jar fix linux memory status = unknown
## 01/8/12 OSWatcher.sh Release 6.0 for oswbb
## V6.0
## 02/20/12 OSWatcher.sh fix for blank lines in extras.txt
## V6.0.1 causing errors
## 10/17/13 OSWatcher.sh Release 7.0 for oswbb
## V7.0
## 01/08/14 OSWatcher.sh Release 7.1 for oswbb
## V7.1
## 04/29/14 OSWatcher.sh Release 7.2 for oswbb
## V7.2.0
## 05/28/14 OSWatcher.sh fix bug in ifconfig directory name
## V7.3.0
## 09/05/14 OSWatcher.sh fix bug with oswifconfig directory
## V7.3.1 OSWatcherFM.sh not purging
## 09/05/14 OSWatcherFM.sh fix bug with oswnfs directory which
## V7.3.1 was accidentally introduced in last
## release
## 09/17/14 OSWatcher.sh fix bug for oswnfs directory
## V7.3.2
## 02/27/17 OSWatcher.sh fix bug in AIX top collection.
## V7.3.3 all add support for all
## internation date support
## 04/21/17 OSwatcher.sh
## V8.0.0 OSWatcherFM.sh Release 8.0.0
## 05/16/17 OSwatcher.sh fix bug with auto traceroute
## V8.0.1 config for RAC
## 08/14/17 OSwatcher.sh Release 8.1.0
## V8.1.0
## 10/25/17 oswbba.jar Release 8.1.1
## V8.1.1
## 12/11/17 OSWatcher.sh Release 8.1.2
## V8.1.2 fix bug with high SSH connections
## 05/03/19 OSWatcher.sh Release 8.2.0
## V8.2.0 nfsiostat-sysstat replaces iostat -n (Linux only)
## pidstat added (Linux only)
## pidstat -d added (active process i/o) (Linux only)
## ip and ss replaces netstat(Linux only)
## ip -s -s addr replaces ifconfig -a (Linux only)
## corrected physical cpu config (Linux only)
## add xentop (Linux only)
## 06/12/19 OSWatcher.sh Release 8.2.1 Release for RPM only
## V8.2.1 nfsiostat replaces nfsiostat-sysstat
## 07/16/19 OSWatcher.sh Release 8.3.0
## V8.3.0 nfsiostat replaces nfsiostat-sysstat
## add arp collection for RAC only
## 08/01/19 OSWatcher.sh Release 8.3.1
## V8.3.1 add fix for bug 19475442 Linux only
## 09/15/19 OSWatcher.sh Release 8.3.2
## V8.3.2 No changes. Remove contact info.
## 11/15/19 OSWatcher.sh Release 8.4.0
## V8.4.0 No changes for OSWatcher collector.
## Updates to analyzer only
## 06/20/20 OSWatcher.sh Release 9.0
## V9.0 Additional Linux collectors for buddyinfo,
## zoneinfo, numastat and pagetype
##
######################################################################
snapshotInterval=$1
archiveInterval=$2
zipfiles=0
status=0
vmstatus=0
mpstatus=0
sarstatus=0
iostatus=0
piddstatus=0
pidstatus=0
xenstatus=0
buddystatus=0
pagetypeus=0
numastatus=0
zoneinfous=0
nfs_collect=0
ifconfig_collect=0
ifconfigstatus=0
nfsstatus=0
psstatus=0
psmemstatus=0
netstatus=0
topstatus=0
rdsstatus=0
ibstatus=0
arpstatus=0
ARPFOUND=0
ZERO=0
PS_MULTIPLIER_COUNTER=0
PRSTAT_FOUND=0
ioheader=1
zip=$3
lasthour="0"
ARCHIVE_FOUND=0
lineCounter1=1
lineCounter2=1
diff=1
PLATFORM=`/bin/uname`
hostn=`hostname`
version="v9.0"
qMax=0
CYAN="\033[1;36;40m"
NORM="\033[0m"
loopback='127.0.0.1'
######################################################################
# CPU COUNT
# The CPU core count (core_count) is used by oswbba analyzer to look
# for cpu issues. The CPU core count is determined by running OS
# specific commands in the (Discovery of CPU COUNT section). The
# virtual CPU count or thread count (vcp_count) is also determined by
# running OS specific commands. In the case these commands fail
# because of system privs, the core_count and vcp_count can be
# manually set below by changing these values to the number of cpu
# cores and threads.
#
# VIRTUAL MACHINES
# CPU discovery on a virtual machine as in the number of physical CPU's
# will not be successful. You can't rely on any physical topology for
# virtual machines.
# KVM virtual machines have a topology which may or may not match any
# possible physical topology. There is no way to determine from within
# a VM what the physical CPU topology is and therefore the values for
# physical CPU's during discovery will be inaccurate.
######################################################################
core_count=0
vcpu_count=0
######################################################################
# oswbba time stamp format
# This parameter allows oswbba to analyze files using a standardized
# time stamp format. Setting oswgCompliance=1 sets the time stamp to a
# standard ENGLISH time format. if you do not want oswbba to analyze
# your files or you want to use your own time stamp format you can
# overide and set this value to 0
######################################################################
oswgCompliance=1
######################################################################
# ip -s -s addr collection
# This parameter enables ip -s -s addr (replacing the ifconfig -a
# command which has been deprecated) data collection using
# ip command. Default is 1 for collect. Set this parameter to 0
# to disable this collection
######################################################################
ifconfig_collect=1
######################################################################
# Iostat nfs collection
# This parameter creates additional nfs data collection using
# nfsiostat for linux only. Default is 0 for not collect.
# Set parameter to 1 to enable this collection
######################################################################
nfs_collect=1
######################################################################
# Loading input variables
######################################################################
test $1
if [ $? = 1 ]; then
echo
echo "Info...You did not enter a value for snapshotInterval."
echo "Info...Using default value = 30"
snapshotInterval=30
fi
test $2
if [ $? = 1 ]; then
echo "Info...You did not enter a value for archiveInterval."
echo "Info...Using default value = 48"
archiveInterval=48
fi
test $3
if [ $? != 1 ]; then
if [ `echo $3 |grep "NONE"` ]; then
zipfiles=0
else
echo "Info...Zip option IS specified. "
echo "Info...OSW will use "$zip" to compress files."
zipfiles=1
fi
fi
test $4
if [ $? != 1 ]; then
echo "Changing current working directory to $4"
mkdir -p "$4" || exit
cd "$4" || exit
exec > log
fi
######################################################################
# Now check to see if snapshotInterval and archiveInterval are valid
######################################################################
test $snapshotInterval
if [ $snapshotInterval -lt 1 ]; then
echo "Warning...Invalid value for snapshotInterval. Overriding with default value = 30"
snapshotInterval=30
fi
test $archiveInterval
if [ $archiveInterval -lt 1 ]; then
echo "Warning...Invalid value for archiveInterval . Overriding with default value = 48"
archiveInterval=48
fi
######################################################################
# Now check to see if unix environment variable
# OSW_PS_SAMPLE_MULTIPLIER has been set
######################################################################
tst=`env | grep OSW_PS_SAMPLE_MULTIPLIER | wc -c`
if [ $tst = $ZERO ];
then
PS_MULTIPLIER=0
else
PS_MULTIPLIER=$OSW_PS_SAMPLE_MULTIPLIER
fi
######################################################################
# Now sample only one sample out of every 10 samples for the
# following Linux utilities...
# numastat
# pagetype
# zoneinfo
######################################################################
NUMA_MULTIPLIER=10
NUMA_MULTIPLIER_COUNTER=0
PAGE_MULTIPLIER=10
PAGE_MULTIPLIER_COUNTER=0
ZONE_MULTIPLIER=10
ZONE_MULTIPLIER_COUNTER=0
######################################################################
# Now check to see if unix environment variable
# OSWBB_ARCHIVE_DEST has been set. If not, then set default value
# to be archive subdirectory under oswbb.
######################################################################
if [ $ARCHIVE_FOUND = $ZERO ];
then
fdir=`env | grep OSWBB_ARCHIVE_DEST | wc -c`
if [ $fdir = $ZERO ];
then
OSWBB_ARCHIVE_DEST=`pwd`/archive
else
if [ ! -d $OSWBB_ARCHIVE_DEST ]; then
echo "The archive directory you specified in OSWBB_ARCHIVE_DEST does not exist"
echo "Please create this directory and rerun OSWatcher"
exit
fi
fi
echo "Setting the archive log directory to"$OSWBB_ARCHIVE_DEST
fi
######################################################################
# Add check for EXADATA Node. OSW must be run as root user else
# nodify and do not collect additional EXADATA stats and exit
######################################################################
grep node:STORAGE /opt/oracle.cellos/image.id > /dev/null 2>&1
if [ $? = 0 ]; then
echo "EXADATA found on your system."
XFOUND=1
else
XFOUND=0
fi
if [ $XFOUND = 1 ]; then
AWK=/usr/bin/awk
RUID=`/usr/bin/id|$AWK -F\( '{print $2}'|$AWK -F\) '{print $1}'`
if [ ${RUID} != "root" ];then
echo "You must be logged in as root to run OSWatcher for EXADATA."
echo "No EXADATA stats will be collected."
echo "Log in as root and restart OSWatcher."
exit
fi
fi
######################################################################
# Add check for any additional collections as specified in the file
# extras.txt. Load these values into an array for processing during
# snapshot interval. Create subdirectories if they do not already exist
######################################################################
if [ -f /usr/libexec/oswatcher/extras.txt ]; then
q=1
exec 9<&0 < /usr/libexec/oswatcher/extras.txt
while read myline
do
xshell=`echo $myline | awk '{print $1}'`
xcmd=`echo $myline | awk '{print $2}'`
xdir=`echo $myline | awk '{print $3}'`
xparm1=`echo $myline | awk '{print $4}'`
xparm2=`echo $myline | awk '{print $5}'`
xparm3=`echo $myline | awk '{print $6}'`
xparm4=`echo $myline | awk '{print $7}'`
xparm5=`echo $myline | awk '{print $8}'`
if [ -n "$xshell" ]; then
if [ $xshell != "#" ]; then
eval array$q=$q
eval xshell$q=$xshell
eval xcmd$q=$xcmd
eval xdir$q=$xdir
# Create log subdirectories if they don't exist.
if [ ! -d $OSWBB_ARCHIVE_DEST/$xdir ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/$xdir
fi
eval xparm1$q=$xparm1
eval xparm2$q=$xparm2
eval xparm3$q=$xparm3
eval xparm4$q=$xparm4
eval xparm5$q=$xparm5
qMax=$q
q=`expr $q + 1`
fi
fi
done
exec 0<&9 9<&-
fi
######################################################################
# Create log subdirectories if they don't exist. Also create oswbba
# subdirectories if they don't exist.
######################################################################
path=`pwd`
if [ $path = "/" ]; then
echo "You can not run oswbb from the root directory"
exit
else
rm -f tmp/*.tmp
fi
if [ ! -d $OSWBB_ARCHIVE_DEST ]; then
mkdir $OSWBB_ARCHIVE_DEST
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswps ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswps
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswarp ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswarp
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswtop ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswtop
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswnetstat ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswnetstat
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswiostat ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswiostat
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswnfsiostat ]; then
if [ $nfs_collect = 1 ]; then
case $PLATFORM in
Linux)
mkdir -p $OSWBB_ARCHIVE_DEST/oswnfsiostat
;;
esac
fi
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswvmstat ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswvmstat
fi
case $PLATFORM in
HP-UX|HI-UX)
if [ ! -d $OSWBB_ARCHIVE_DEST/oswsar ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswsar
fi
;;
*)
if [ ! -d $OSWBB_ARCHIVE_DEST/oswmpstat ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswmpstat
fi
;;
esac
if [ ! -d $OSWBB_ARCHIVE_DEST/oswprvtnet ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswprvtnet
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/oswifconfig ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/oswifconfig
fi
if [ ! -d locks ]; then
mkdir locks
fi
if [ ! -d tmp ]; then
mkdir tmp
fi
######################################################################
# Create additional EXADATA subdirectories if they don't exist
######################################################################
if [ $XFOUND = 1 ]; then
if [ ! -d $OSWBB_ARCHIVE_DEST/osw_ib_diagnostics ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/osw_ib_diagnostics
fi
if [ ! -d $OSWBB_ARCHIVE_DEST/osw_rds_diagnostics ]; then
mkdir -p $OSWBB_ARCHIVE_DEST/osw_rds_diagnostics
fi
fi
######################################################################
# Create additional linux subdirectories if they don't exist
######################################################################
case $PLATFORM in
Linux)
mkdir -p $OSWBB_ARCHIVE_DEST/oswmeminfo
mkdir -p $OSWBB_ARCHIVE_DEST/oswslabinfo
mkdir -p $OSWBB_ARCHIVE_DEST/oswcpuinfo
mkdir -p $OSWBB_ARCHIVE_DEST/oswpidstat
mkdir -p $OSWBB_ARCHIVE_DEST/oswxentop
mkdir -p $OSWBB_ARCHIVE_DEST/oswbuddyinfo
mkdir -p $OSWBB_ARCHIVE_DEST/oswnumastat
mkdir -p $OSWBB_ARCHIVE_DEST/oswpagetype
mkdir -p $OSWBB_ARCHIVE_DEST/oswzoneinfo
;;
esac
######################################################################
# Remove lock.file if it exists
######################################################################
if [ -f locks/vmlock.file ]; then
rm locks/vmlock.file
fi
if [ -f locks/mplock.file ]; then
rm locks/mplock.file
fi
if [ -f locks/sarlock.file ]; then
rm locks/sarlock.file
fi
if [ -f locks/pslock.file ]; then
rm locks/pslock.file
fi
if [ -f locks/toplock.file ]; then
rm locks/toplock.file
fi
if [ -f locks/iolock.file ]; then
rm locks/iolock.file
fi
if [ -f locks/nfslock.file ]; then
rm locks/nfslock.file
fi
if [ -f locks/ifconfiglock.file ]; then
rm locks/ifconfiglock.file
fi
if [ -f locks/netlock.file ]; then
rm locks/netlock.file
fi
if [ -f locks/rdslock.file ]; then
rm locks/rdslock.file
fi
if [ -f locks/iblock.file ]; then
rm locks/iblock.file
fi
if [ -f tmp/xtop.tmp ]; then
rm tmp/xtop.tmp
fi
if [ -f tmp/vtop.tmp ]; then
rm tmp/vtop.tmp
fi
if [ -f locks/lock.file ]; then
rm locks/lock.file
fi
if [ -f locks/piddlock.file ]; then
rm locks/piddlock.file
fi
if [ -f locks/pidlock.file ]; then
rm locks/pidlock.file
fi
if [ -f locks/xenlock.file ]; then
rm locks/xenlock.file
fi
if [ -f locks/arplock.file ]; then
rm locks/arplock.file
fi
if [ -f locks/buddylock.file ]; then
rm locks/buddylock.file
fi
if [ -f locks/numalock.file ]; then
rm locks/numalock.file
fi
if [ -f locks/pagelock.file ]; then
rm locks/pagelock.file
fi
if [ -f locks/zonelock.file ]; then
rm locks/zonelock.file
fi
######################################################################
# CONFIGURATION Determine Host Platform
#
# Starting in release 4.0, TOP parameters are now configured in the file
# xtop.sh. This was changed because 2 snapshots of top are required
# because the first sample is since system startup and is now
# discarded with only the second sample being being saved in the
# oswtop directory. The previous top commands still exist in this
# section and are used only for the discovery of top on your system.
# Starting in release 7.0, the ps parameters are configured in file
# psmemsub.sh.
#
# pidstat -d has been added for Linux in version 8.1.3. The pidstat -d
# command is configured in file piddsub.sh
######################################################################
case $PLATFORM in
Linux)
IOSTAT='iostat -xk 1 3'
NFSIOSTAT='nfsiostat 1 3'
VMSTAT='vmstat 1 3'
TOP='eval top -b -n 1 | head -50'
PSELF='ps -elf'
MPSTAT='mpstat -P ALL 1 2'
MEMINFO='cat /proc/meminfo'
SLABINFO='cat /proc/slabinfo'
IFCONFIG='ip -s -s addr'
TRACERT="traceroute $loopback"
PIDSTAT='pidstat'
XENTOP='xentop -b -i 1 -d 1'
BUDDYINFO='cat /proc/buddyinfo'
NUMASTAT='/usr/bin/numastat -mn'
PAGETYPE='cat /proc/pagetypeinfo'
ZONEINFO='cat /proc/zoneinfo'
ARP='arp -an'
;;
HP-UX|HI-UX)
IOSTAT='iostat 1 3'
VMSTAT='vmstat 1 3'
TOP='top -d 1'
PSELF='ps -elf'
SAR='sar -d 1 3'
IFCONFIG='netstat'
TRACERT="traceroute $loopback"
ARP='arp -an'
;;
SunOS)
IOSTAT='iostat -xn 1 3'
VMSTAT='vmstat 1 3 '
TOP='top -d2 -s1'
PRSTAT='prstat 1 2'
PSELF='ps -elf'
MPSTAT='mpstat 1 2'
IFCONFIG='ifconfig -a'
TRACERT="traceroute $loopback"
ARP='arp -an'
;;
AIX)
IOSTAT='iostat -D 1 3'
VMSTAT='vmstat -I 1 3'
TOP='top -d 1'
PSELF='ps -elf'
MPSTAT='mpstat 1 2'
IFCONFIG='ifconfig -a'
TRACERT="traceroute $loopback"
ARP='arp -an'
;;
OSF1)
IOSTAT='iostat 1 3'
VMSTAT='vmstat 1 3'
TOP='top -d1'
PSELF='ps -elf'
PSMEM='ps -elf'
MPSTAT='sar -S'
IFCONFIG='ifconfig -a'
;;
esac
######################################################################
# Test for discovery of os utilities. Notify if not found.
######################################################################
echo ""
echo "Testing for discovery of OS Utilities..."
# Checking for vmstat
$VMSTAT > /dev/null 2>&1
if [ $? = 0 ]; then
echo "VMSTAT found on your system."
VMFOUND=1
else
echo "Warning... VMSTAT not found on your system. No VMSTAT data will be collected."
VMFOUND=0
fi
# Checking for iostat and create header for HP-UX sar data
$IOSTAT > /dev/null 2>&1
if [ $? = 0 ]; then
echo "IOSTAT found on your system."
IOFOUND=1
case $PLATFORM in
HP-UX|HI-UX)
iostat 1 1 > tmp/ioh.tmp
lineCounter1=`cat tmp/ioh.tmp | wc -l | awk '{$1=$1;print}'`
iostat 1 2 > tmp/ioh.tmp
lineCounter2=`cat tmp/ioh.tmp | wc -l | awk '{$1=$1;print}'`
diff=`expr $lineCounter2 - $lineCounter1`
ioheader=`expr $lineCounter1 - $diff`
head -$ioheader tmp/ioh.tmp > iostat.header
;;
*)
x=0
;;
esac
else
echo "Warning... IOSTAT not found on your system. No IOSTAT data will be collected."
IOFOUND=0
fi
# Checking for HP-UX sar data
case $PLATFORM in
HP-UX|HI-UX)
$SAR > /dev/null 2>&1
if [ $? = 0 ]; then
echo "SAR found on your system."
SARFOUND=1
else
echo "Warning... sar -d not found on your system. No SAR data will be collected."
SARFOUND=0
fi
;;
esac
# Checking for mpstat
$MPSTAT > /dev/null 2>&1
if [ $? = 0 ]; then
echo "MPSTAT found on your system."
MPFOUND=1
else
echo "Warning... MPSTAT not found on your system. No MPSTAT data will be collected."
MPFOUND=0
fi
# Checking for ifconfig or ip for Linux
case $PLATFORM in
Linux)
$IFCONFIG > /dev/null 2>&1
if [ $? = 0 ]; then
echo "IP found on your system."
IFCONFIGFOUND=1
NETFOUND=1
else
echo "Warning... IP not found on your system. No IFCONFIG/NET data will be collected."
IFCONFIGFOUND=0
NETFOUND=0
fi
;;
*)
$IFCONFIG > /dev/null 2>&1
if [ $? = 0 ]; then
echo "IFCONFIG found on your system."
IFCONFIGFOUND=1
else
echo "Warning... IFCONFIG not found on your system. No IFCONFIG data will be collected."
IFCONFIGFOUND=0
fi
;;
esac
# Checking for netstat on all platforms except Linux (Linux checked above)
case $PLATFORM in
Linux)
# Checked above
;;
*)
netstat > /dev/null 2>&1
if [ $? = 0 ]; then
echo "NETSTAT found on your system."
NETFOUND=1
else
echo "Warning... NETSTAT not found on your system. No NETSTAT data will be collected."
NETFOUND=0
fi
;;
esac
# Checking for top
case $PLATFORM in
AIX)
TOPFOUND=1
;;
SunOS)
$TOP > /dev/null 2>&1
if [ $? = 0 ]; then
echo "TOP found on your system."
TOPFOUND=1
else
$PRSTAT > /dev/null 2>&1
if [ $? = 0 ]; then
echo "PRSTAT found on your system."
PRSTAT_FOUND=1
TOPFOUND=1
TOP=$PRSTAT
else
echo "Warning... TOP/PRSTAT not found on your system. No TOP data will be collected."
TOPFOUND=0
fi
fi
;;
*)
$TOP > /dev/null 2>&1
if [ $? = 0 ]; then
echo "TOP found on your system."
TOPFOUND=1
else
echo "Warning... TOP not found on your system. No TOP data will be collected."
TOPFOUND=0
fi
;;
esac
# Checking for Linux specific collections meminfo/slabinfo/pidstat/nfsiostat
case $PLATFORM in
Linux)
$MEMINFO > /dev/null 2>&1
if [ $? = 0 ]; then
MEMFOUND=1
else
echo "Warning... /proc/meminfo not found on your system."
MEMFOUND=0
fi
$SLABINFO > /dev/null 2>&1
if [ $? = 0 ]; then
SLABFOUND=1
else
echo "Warning... /proc/slabinfo not found on your system. Check to see if this user has permission to access this file."
SLABFOUND=0
fi
$XENTOP > /dev/null 2>&1
if [ $? = 0 ]; then
echo "XENTOP found on your system."
XENFOUND=1
else
XENFOUND=0
fi
$PIDSTAT > /dev/null 2>&1
if [ $? = 0 ]; then
echo "PIDSTAT found on your system."
PIDFOUND=1
else
echo "Warning... PIDSTAT not found on your system."
PIDFOUND=0
fi
$NFSIOSTAT > /dev/null 2>&1
if [ $? = 0 ]; then
echo "NFSIOSTAT found on your system."
NFSFOUND=1
else
echo "Warning... NFSIOSTAT not found on your system."
NFSFOUND=0
nfs_collect=0
fi
$BUDDYINFO > /dev/null 2>&1
if [ $? = 0 ]; then
echo "BUDDYINFO found on your system."
BUDDYFOUND=1
else
echo "Warning... BUDDYINFO not found on your system."
BUDDYFOUND=0
fi
$NUMASTAT > /dev/null 2>&1
if [ $? = 0 ]; then
echo "NUMASTAT found on your system."
NUMAFOUND=1
else
echo "Warning... NUMASTAT not found on your system."
NUMAFOUND=0
fi
$PAGETYPE > /dev/null 2>&1
if [ $? = 0 ]; then
echo "PAGETYPE found on your system."
PAGEFOUND=1
else
echo "Warning... PAGETYPE not found on your system."
PAGEFOUND=0
fi
$ZONEINFO > /dev/null 2>&1
if [ $? = 0 ]; then
echo "ZONEINFO found on your system."
ZONEFOUND=1
else
echo "Warning... ZONEINFO not found on your system."
ZONEFOUND=0
fi
;;
esac
# Checking for arp but only if we are running RAC
CHECK_ARP=`ps -ef | grep ohasd | grep -v grep |wc -l`
if [ $CHECK_ARP -gt 0 ]; then
$ARP > /dev/null 2>&1
if [ $? = 0 ]; then
echo "ARP found on your system."
ARPFOUND=1
else
echo "Warning... ARP not found on your system. No ARP data will be collected."
ARPFOUND=0
fi
fi
######################################################################
# Discovery of CPU COUNT. Notify if not found.
######################################################################
echo ""
if [ $core_count = 0 ]; then
echo "Discovery of CPU CORE COUNT"
echo "CPU CORE COUNT will be used by oswbba to automatically look for cpu problems"
echo ""
case $PLATFORM in
Linux)
vcpu_count=`lscpu | egrep "CPU\(s\):" | awk '{print $2}' | head -1`
cores=`lscpu | egrep "Core\(s\) per socket:" | awk '{print $4}' | head -1`
sockets=`lscpu | egrep "Socket" | awk '{print $2}'`
core_count=`expr $cores \* $sockets`
hour=`date +'%y.%m.%d.%H00.dat'`
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswcpuinfo/${hostn}_cpuinfo_$hour
cat /proc/cpuinfo >> $OSWBB_ARCHIVE_DEST/oswcpuinfo/${hostn}_cpuinfo_$hour
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswcpuinfo/${hostn}_lscpu_$hour
lscpu >> $OSWBB_ARCHIVE_DEST/oswcpuinfo/${hostn}_lscpu_$hour
;;
HP-UX|HI-UX)
vcpu_count=`/usr/sbin/ioscan -kC processor | grep processor | wc -l`
core_count=`/usr/sbin/ioscan -kC processor | grep processor | wc -l`
;;
SunOS)
vcpu_count=`/usr/sbin/psrinfo -v|grep "on-line"|wc -l`
core_count=`kstat cpu_info | grep core_id | uniq | wc -l`
;;
AIX)
vcpu_count=`mpstat | grep lcpu | awk '{print $3}'`
core_count=`/usr/sbin/lsdev -C|grep Process|wc -l`
;;
OSF1)
;;
esac
if [ $core_count -gt 0 ]; then
echo "CPU CORE COUNT =" $core_count
echo "VCPUS/THREADS =" $vcpu_count
else
echo " "
echo "Warning... CPU CORE COUNT not found on your system."
echo " "
echo " "
echo "Defaulting to CPU CORE COUNT = 1"
echo "To correctly specify CPU CORE COUNT"
echo "1. Correct the error listed above for your unix platform or"
echo "2. Manually set core_count on OSWatcher.sh line 16 or"
echo "3. Do nothing and accept default value = 1"
core_count=1
fi
else
echo "Maunal override of CPU CORE COUNT in effect"
echo "CPU CORE COUNT =" $core_count
fi
echo ""
echo "Discovery completed."
echo ""
sleep 5
echo "Starting OSWatcher "$version "on "`date`
echo "With SnapshotInterval = "$snapshotInterval
echo "With ArchiveInterval = "$archiveInterval
echo ""
echo "For questions on install/usage please go to MOS (Note:301137.1)"
sleep 5
echo ""
echo "Data is stored in directory: "$OSWBB_ARCHIVE_DEST
echo ""
echo "Starting Data Collection..."
echo ""
######################################################################
# Loop Forever
######################################################################
until test 0 -eq 1
do
echo "oswbb heartbeat:"`date`
######################################################################
# Generate generic log file string depending on what hour of the day
# it is. Have 1 report per hour per operation.
######################################################################
hour=`date +'%y.%m.%d.%H00.dat'`
######################################################################
# VMSTAT
######################################################################
if [ $VMFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$hour
echo "SNAP_INTERVAL" $snapshotInterval >> $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$hour
echo "CPU_CORES" $core_count >> $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$hour
echo "VCPUS" $vcpu_count >> $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$hour
echo "OSWBB_ARCHIVE_DEST" $OSWBB_ARCHIVE_DEST >> $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$lasthour &
fi
fi
fi
if [ -f locks/vmlock.file ]; then
vmstatus=1
else
touch locks/vmlock.file
if [ $vmstatus = 1 ]; then
echo "***Warning. VMSTAT response is spanning snapshot intervals."
vmstatus=0
fi
/usr/libexec/oswatcher/vmsub $OSWBB_ARCHIVE_DEST/oswvmstat/${hostn}_vmstat_$hour "$VMSTAT" $oswgCompliance &
fi
fi
######################################################################
# SAR (sar -d ) for HP-UX only
######################################################################
case $PLATFORM in
HP-UX|HI-UX)
if [ $SARFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswsar/${hostn}_sar_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswsar/${hostn}_sar_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswsar/${hostn}_sar_$lasthour &
fi
fi
fi
if [ -f locks/sar.file ]; then
sarstatus=1
else
touch locks/sarlock.file
if [ $sarstatus = 1 ]; then
echo "***Warning. SAR response is spanning snapshot intervals."
sarstatus=0
fi
/usr/libexec/oswatcher/sarsub $OSWBB_ARCHIVE_DEST/oswsar/${hostn}_sar_$hour "$SAR" $oswgCompliance &
fi
fi
;;
*)
;;
esac
######################################################################
# MPSTAT
######################################################################
case $PLATFORM in
HP-UX|HI-UX)
;;
*)
if [ $MPFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswmpstat/${hostn}_mpstat_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswmpstat/${hostn}_mpstat_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswmpstat/${hostn}_mpstat_$lasthour &
fi
fi
fi
if [ -f locks/mplock.file ]; then
mpstatus=1
else
touch locks/mplock.file
if [ $mpstatus = 1 ]; then
echo "***Warning. MPSTAT response is spanning snapshot intervals."
mpstatus=0
fi
/usr/libexec/oswatcher/mpsub $OSWBB_ARCHIVE_DEST/oswmpstat/${hostn}_mpstat_$hour "$MPSTAT" $oswgCompliance &
fi
fi
;;
esac
######################################################################
# NETSTAT
# NETSTAT configured in oswnet.sh file
######################################################################
if [ $NETFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswnetstat/${hostn}_netstat_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswnetstat/${hostn}_netstat_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswnetstat/${hostn}_netstat_$lasthour &
fi
fi
fi
if [ -f locks/netlock.file ]; then
netstatus=1
else
touch locks/netlock.file
if [ $netstatus = 1 ]; then
echo "***Warning. NETSTAT response is spanning snapshot intervals."
netstatus=0
fi
/usr/libexec/oswatcher/oswnet $OSWBB_ARCHIVE_DEST/oswnetstat/${hostn}_netstat_$hour $oswgCompliance &
fi
fi
######################################################################
# IOSTAT
######################################################################
if [ $IOFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswiostat/${hostn}_iostat_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswiostat/${hostn}_iostat_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswiostat/${hostn}_iostat_$lasthour &
fi
fi
fi
if [ -f locks/iolock.file ]; then
iostatus=1
else
touch locks/iolock.file
if [ $iostatus = 1 ]; then
echo "***Warning. IOSTAT response is spanning snapshot intervals."
iostatus=0
fi
/usr/libexec/oswatcher/iosub $OSWBB_ARCHIVE_DEST/oswiostat/${hostn}_iostat_$hour "$IOSTAT" $oswgCompliance &
fi
fi
######################################################################
# Linux Only Collections for pidstat and nfsiostat
######################################################################
case $PLATFORM in
Linux)
######################################################################
# XENTOP
######################################################################
if [ $XENFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswxentop/${hostn}_xentop_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswxentop/${hostn}_xentop_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswxentop/${hostn}_xentop_$lasthour &
fi
fi
fi
if [ -f locks/xenlock.file ]; then
xenstatus=1
else
touch locks/xenlock.file
if [ $xenstatus = 1 ]; then
echo "***Warning. XENTOP response is spanning snapshot intervals."
xenstatus=0
fi
if [ $snapshotInterval -lt 10 ]; then
xenSnap=3
else
xenSnap=6
fi
/usr/libexec/oswatcher/xensub $OSWBB_ARCHIVE_DEST/oswxentop/${hostn}_xentop_$hour "$XENTOP" $oswgCompliance $xenSnap &
fi
fi
######################################################################
# BUDDYINFO
######################################################################
if [ $BUDDYFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswbuddyinfo/${hostn}_buddyinfo_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswbuddyinfo/${hostn}_buddyinfo_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswbuddyinfo/${hostn}_buddyinfo_$lasthour &
fi
fi
fi
if [ -f locks/buddylock.file ]; then
buddystatus=1
else
touch locks/buddylock.file
if [ $buddystatus = 1 ]; then
echo "***Warning. BUDDYINFO response is spanning snapshot intervals."
buddystatus=0
fi
/usr/libexec/oswatcher/buddysub $OSWBB_ARCHIVE_DEST/oswbuddyinfo/${hostn}_buddyinfo_$hour "$BUDDYINFO" $oswgCompliance &
fi
fi
######################################################################
# NUMASTAT
######################################################################
if [ $NUMAFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswnumastat/${hostn}_numastat_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswnumastat/${hostn}_numastat_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswnumastat/${hostn}_numastat_$lasthour &
fi
fi
fi
if [ -f locks/numalock.file ]; then
numastatus=1
else
touch locks/numalock.file
if [ $numastatus = 1 ]; then
echo "***Warning. NUMASTAT response is spanning snapshot intervals."
numastatus=0
fi
if [ $NUMA_MULTIPLIER -gt $ZERO ]; then
if [ $NUMA_MULTIPLIER_COUNTER -eq $ZERO ]; then
/usr/libexec/oswatcher/numasub $OSWBB_ARCHIVE_DEST/oswnumastat/${hostn}_numastat_$hour "$NUMASTAT" $oswgCompliance &
else
rm locks/numalock.file
fi
NUMA_MULTIPLIER_COUNTER=`expr $NUMA_MULTIPLIER_COUNTER + 1`
if [ $NUMA_MULTIPLIER_COUNTER -eq $NUMA_MULTIPLIER ]; then
NUMA_MULTIPLIER_COUNTER=0
fi
else
/usr/libexec/oswatcher/numasub $OSWBB_ARCHIVE_DEST/oswnumastat/${hostn}_numastat_$hour "$NUMASTAT" $oswgCompliance &
fi
fi
fi
######################################################################
# PAGETYPE
######################################################################
if [ $PAGEFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswpagetype/${hostn}_pagetype_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswpagetype/${hostn}_pagetype_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswpagetype/${hostn}_pagetype_$lasthour &
fi
fi
fi
if [ -f locks/pagelock.file ]; then
pagetypeus=1
else
touch locks/pagelock.file
if [ $pagetypeus = 1 ]; then
echo "***Warning. PAGESTAT response is spanning snapshot intervals."
pagetypeus=0
fi
if [ $PAGE_MULTIPLIER -gt $ZERO ]; then
if [ $PAGE_MULTIPLIER_COUNTER -eq $ZERO ]; then
/usr/libexec/oswatcher/pagesub $OSWBB_ARCHIVE_DEST/oswpagetype/${hostn}_pagetype_$hour "$PAGESTAT" $oswgCompliance &
else
rm locks/pagelock.file
fi
PAGE_MULTIPLIER_COUNTER=`expr $PAGE_MULTIPLIER_COUNTER + 1`
if [ $PAGE_MULTIPLIER_COUNTER -eq $PAGE_MULTIPLIER ]; then
PAGE_MULTIPLIER_COUNTER=0
fi
else
/usr/libexec/oswatcher/pagesub $OSWBB_ARCHIVE_DEST/oswpagetype/${hostn}_pagetype_$hour "$PAGESTAT" $oswgCompliance &
fi
fi
fi
######################################################################
# ZONEINFO
######################################################################
if [ $ZONEFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswzoneinfo/${hostn}_zoneinfo_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswzoneinfo/${hostn}_zoneinfo_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswzoneinfo/${hostn}_zoneinfo_$lasthour &
fi
fi
fi
if [ -f locks/zonelock.file ]; then
zoneinfous=1
else
touch locks/zonelock.file
if [ $zoneinfous = 1 ]; then
echo "***Warning. ZONESTAT response is spanning snapshot intervals."
zoneinfous=0
fi
if [ $ZONE_MULTIPLIER -gt $ZERO ]; then
if [ $ZONE_MULTIPLIER_COUNTER -eq $ZERO ]; then
/usr/libexec/oswatcher/zonesub $OSWBB_ARCHIVE_DEST/oswzoneinfo/${hostn}_zoneinfo_$hour "$ZONESTAT" $oswgCompliance &
else
rm locks/zonelock.file
fi
ZONE_MULTIPLIER_COUNTER=`expr $ZONE_MULTIPLIER_COUNTER + 1`
if [ $ZONE_MULTIPLIER_COUNTER -eq $ZONE_MULTIPLIER ]; then
ZONE_MULTIPLIER_COUNTER=0
fi
else
/usr/libexec/oswatcher/zonesub $OSWBB_ARCHIVE_DEST/oswzoneinfo/${hostn}_zoneinfo_$hour "$ZONESTAT" $oswgCompliance &
fi
fi
fi
######################################################################
# PIDSTAT
######################################################################
if [ $PIDFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswpidstat/${hostn}_pidstat_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswpidstat/${hostn}_pidstat_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswpidstat/${hostn}_pidstat_$lasthour &
fi
fi
fi
if [ -f locks/pidlock.file ]; then
pidstatus=1
else
touch locks/pidlock.file
if [ $pidstatus = 1 ]; then
echo "***Warning. PIDSTAT response is spanning snapshot intervals."
pidstatus=0
fi
/usr/libexec/oswatcher/pidsub $OSWBB_ARCHIVE_DEST/oswpidstat/${hostn}_pidstat_$hour "$PIDSTAT" $oswgCompliance &
fi
fi
######################################################################
# LINUX NFSIOSTAT
######################################################################
if [ $nfs_collect = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswnfsiostat/${hostn}_nfsiostat_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswnfsiostat/${hostn}_nfsiostat_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswnfsiostat/${hostn}_nfsiostat_$lasthour &
fi
fi
fi
if [ -f locks/nfslock.file ]; then
nfsstatus=1
else
touch locks/nfslock.file
if [ $nfsstatus = 1 ]; then
echo "***Warning. IOSTAT NFSIOSTAT response is spanning snapshot intervals."
nfsstatus=0
fi
/usr/libexec/oswatcher/nfssub $OSWBB_ARCHIVE_DEST/oswnfsiostat/${hostn}_nfsiostat_$hour "$NFSIOSTAT" $oswgCompliance &
fi
fi
######################################################################
# End Linux Only Collections for pidstat and nfsiostat
######################################################################
;;
esac
######################################################################
# ARP
######################################################################
if [ $ARPFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswarp/${hostn}_arp_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswarp/${hostn}_arp_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswarp/${hostn}_arp_$lasthour &
fi
fi
fi
if [ -f locks/arplock.file ]; then
arpstatus=1
else
touch locks/arplock.file
if [ $arpstatus = 1 ]; then
echo "***Warning. ARP response is spanning snapshot intervals."
arpstatus=0
fi
/usr/libexec/oswatcher/arpsub $OSWBB_ARCHIVE_DEST/oswarp/${hostn}_arp_$hour "$ARP" $oswgCompliance &
fi
fi
######################################################################
# IFCONFIG
######################################################################
if [ $IFCONFIGFOUND = 1 ]; then
if [ $ifconfig_collect = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswifconfig/${hostn}_ifconfig_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswifconfig/${hostn}_ifconfig_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswifconfig/${hostn}_ifconfig_$lasthour &
fi
fi
fi
if [ -f locks/ifconfiglock.file ]; then
ifconfigstatus=1
else
touch locks/ifconfiglock.file
if [ $ifconfigstatus = 1 ]; then
echo "***Warning. IFCONFIG response is spanning snapshot intervals."
ifconfigstatus=0
fi
/usr/libexec/oswatcher/ifconfigsub $OSWBB_ARCHIVE_DEST/oswifconfig/${hostn}_ifconfig_$hour "$IFCONFIG" $oswgCompliance &
fi
fi
fi
######################################################################
# TOP
######################################################################
if [ $TOPFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
case $PLATFORM in
AIX)
echo "################################################################################" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "Note: When reviewing LPAR process cpu usage, look at the C column." >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "This column indicates how many ticks of CPU the command has used recently." >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "It is specifically defined as:" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "C: CPU utilization of process or thread, incremented each time the system clock " >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "ticks and the process or thread is found to be running. The value is decayed " >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "by the scheduler by dividing it by 2 once per second. For the sched_other " >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "policy, CPU utilization is used in determining process scheduling priority." >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "Large values indicate a CPU intensive process and result in lower process " >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "priority, whereas small values indicate an I/O intensive process and result" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "in a more favorable priority." >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "AIX uses this value along with the process base priority and nice value to " >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "compute new effective thread/process priorities. The OSW data is sorted on" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "this column in reverse numberical order. This gives you the top N CPU users" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "in the last 2-3 seconds:" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
echo "################################################################################" >> $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour
;;
*)
x=0
;;
esac
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$lasthour &
fi
fi
fi
if [ -f locks/toplock.file ]; then
topstatus=1
else
touch locks/toplock.file
if [ $topstatus = 1 ]; then
echo "***Warning. TOP response is spanning snapshot intervals."
topstatus=0
fi
case $PLATFORM in
AIX)
/usr/libexec/oswatcher/topaix $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour $oswgCompliance
;;
Linux)
/usr/libexec/oswatcher/xtop $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour $oswgCompliance &
;;
HP-UX|HI-UX)
x=0
;;
*)
/usr/libexec/oswatcher/xtop $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour $oswgCompliance $PRSTAT_FOUND &
;;
esac
fi
# no file check for HP. Move code outside test above
case $PLATFORM in
HP-UX|HI-UX)
/usr/libexec/oswatcher/xtop $OSWBB_ARCHIVE_DEST/oswtop/${hostn}_top_$hour $oswgCompliance &
;;
*)
x=0
;;
esac
fi
######################################################################
# PS -ELF
######################################################################
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswps/${hostn}_ps_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswps/${hostn}_ps_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswps/${hostn}_ps_$lasthour &
fi
fi
fi
if [ -f locks/pslock.file ]; then
psstatus=1
else
touch locks/pslock.file
if [ $psstatus = 1 ]; then
echo "***Warning. PS response is spanning snapshot intervals."
psstatus=0
fi
if [ $PS_MULTIPLIER -gt $ZERO ]; then
if [ $PS_MULTIPLIER_COUNTER -eq $ZERO ]; then
/usr/libexec/oswatcher/psmemsub $OSWBB_ARCHIVE_DEST/oswps/${hostn}_ps_$hour "$PSELF" $oswgCompliance &
else
rm locks/pslock.file
fi
PS_MULTIPLIER_COUNTER=`expr $PS_MULTIPLIER_COUNTER + 1`
if [ $PS_MULTIPLIER_COUNTER -eq $PS_MULTIPLIER ]; then
PS_MULTIPLIER_COUNTER=0
fi
else
/usr/libexec/oswatcher/psmemsub $OSWBB_ARCHIVE_DEST/oswps/${hostn}_ps_$hour "$PSELF" $oswgCompliance &
fi
fi
######################################################################
# Additional Linux Only Collection
######################################################################
case $PLATFORM in
Linux)
if [ $MEMFOUND = 1 ]; then
/usr/libexec/oswatcher/oswsub $OSWBB_ARCHIVE_DEST/oswmeminfo/${hostn}_meminfo_$hour "$MEMINFO" $oswgCompliance &
fi
if [ $SLABFOUND = 1 ]; then
/usr/libexec/oswatcher/oswsub $OSWBB_ARCHIVE_DEST/oswslabinfo/${hostn}_slabinfo_$hour "$SLABINFO" $oswgCompliance &
fi
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswmeminfo/${hostn}_meminfo_$hour
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswslabinfo/${hostn}_slabinfo_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswmeminfo/${hostn}_meminfo_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswmeminfo/${hostn}_meminfo_$lasthour &
fi
if [ -f $OSWBB_ARCHIVE_DEST/oswslabinfo/${hostn}_slabinfo_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswslabinfo/${hostn}_slabinfo_$lasthour &
fi
fi
fi
;;
esac
######################################################################
# EXADATA
######################################################################
if [ $XFOUND = 1 ]; then
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/osw_ib_diagnostics/${hostn}_ib_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/osw_ib_diagnostics/${hostn}_ib_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/osw_ib_diagnostics/${hostn}_ib_$lasthour &
fi
fi
fi
if [ -f locks/iblock.file ]; then
ibstatus=1
else
touch locks/iblock.file
if [ $ibstatus = 1 ]; then
echo "***Warning. IB DIAGNOSTICS response is spanning snapshot intervals."
ibstatus=0
fi
/usr/libexec/oswatcher/oswib $OSWBB_ARCHIVE_DEST/osw_ib_diagnostics/${hostn}_ib_$hour &
fi
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/osw_rds_diagnostics/${hostn}_rds_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/osw_rds_diagnostics/${hostn}_rds_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/osw_rds_diagnostics/${hostn}_rds_$lasthour &
fi
fi
fi
if [ -f locks/rdslock.file ]; then
rdsstatus=1
else
touch locks/rdslock.file
if [ $rdsstatus = 1 ]; then
echo "***Warning. VMSTAT response is spanning snapshot intervals."
rdsstatus=0
fi
/usr/libexec/oswatcher/oswrds $OSWBB_ARCHIVE_DEST/osw_rds_diagnostics/${hostn}_rds_$hour &
fi
fi
######################################################################
# Run traceroute for private networks if file private.net exists
######################################################################
if [ -x /usr/libexec/oswatcher/private.net ]; then
if [ -f locks/lock.file ]; then
status=1
else
touch locks/lock.file
if [ $status = 1 ]; then
echo "zzz ***Warning. Traceroute response is spanning snapshot intervals." >> $OSWBB_ARCHIVE_DEST/oswprvtnet/${hostn}_prvtnet_$hour &
status=0
fi
/usr/libexec/oswatcher/private.net >> $OSWBB_ARCHIVE_DEST/oswprvtnet/${hostn}_prvtnet_$hour 2>&1 &
fi
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/oswprvtnet/${hostn}_prvtnet_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/oswprvtnet/${hostn}_prvtnet_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/oswprvtnet/${hostn}_prvtnet_$lasthour &
fi
fi
fi
fi
######################################################################
# Run any extra commands in file extras.txt if that file exists
######################################################################
if [ $qMax -gt $ZERO ]; then
a=1
while [ "$a" -le "$qMax" ]
do
if [ $hour != $lasthour ]; then
echo $PLATFORM OSWbb $version $hostn >> $OSWBB_ARCHIVE_DEST/`eval echo '$xdir'$a`/${hostn}_`eval echo '$xcmd'$a`_$hour
if [ $zipfiles = 1 ]; then
if [ -f $OSWBB_ARCHIVE_DEST/`eval echo '$xdir'$a`/${hostn}_`eval echo '$xcmd'$a`_$lasthour ]; then
$zip $OSWBB_ARCHIVE_DEST/`eval echo '$xdir'$a`/${hostn}_`eval echo '$xcmd'$a`_$lasthour &
fi
fi
fi
/usr/libexec/oswatcher/`eval echo '$xshell'$a` $OSWBB_ARCHIVE_DEST/`eval echo '$xdir'$a`/${hostn}_`eval echo '$xcmd'$a`_$hour &
a=`expr $a + 1`
done
fi
# Clean out old log files
find $OSWBB_ARCHIVE_DEST -type f -mmin +$(($archiveInterval*60)) -exec rm -f {} +
######################################################################
# Sleep for specified interval and repeat
######################################################################
lasthour=$hour
case $PLATFORM in
Linux)
disown -a
;;
esac
sleep $snapshotInterval
done