[sun-gdd-oc~devel:98] Added tag version_0.25-97 for changeset 216e09958eb5
- From: Ranjeeth.Nagarajan@kenai.com
- To: commits@sun-gdd-oc.kenai.com
- Subject: [sun-gdd-oc~devel:98] Added tag version_0.25-97 for changeset 216e09958eb5
- Date: Tue, 15 Dec 2009 05:35:29 +0000
Project: sun-gdd-oc
Repository: devel
Revision: 98
Author: Ranjeeth.Nagarajan
Date: 2009-12-11 13:12:17 UTC
Link:
Log Message:
------------
Added disk space checking feature when doing collect
added functionality to collect Zone config information
correct counting of agents and proxies in datacenter summary, collect zstat
specific data, add new authors
return codes from zstat* are now saved to file instead of printing it on
screen
fixed a bug in the disk space checker function
another bug fix in the disk space checker
Added tag version_0.25-97 for changeset 216e09958eb5
Revisions:
----------
92
93
94
95
96
97
98
Modified Paths:
---------------
Sun-GDD-OC.sh
AUTHORS
Makefile
.hgtags
Diffs:
------
diff -r ae8d7bc919c4 -r 9108121428de Sun-GDD-OC.sh
--- a/Sun-GDD-OC.sh Tue Nov 10 16:08:53 2009 +0100
+++ b/Sun-GDD-OC.sh Wed Nov 25 18:20:59 2009 +0530
@@ -739,6 +739,70 @@
info "Done disabling debug."
}
+
+
+checkAvailableSpace()
+{
+
+SPACE_MULTIPLIER=3
+set -A fileList
+
+#checking space required for cacao stuff
+CACAO_INS=`$CACAOADM list-instances`
+for i in $CACAO_INS
+do
+ fileList[$((${#fileList[*]}+1))]="$CACAO_VAR/$i/logs"
+ fileList[$((${#fileList[*]}+1))]="$CACAO_VAR/$i/audits"
+done
+
+#checking space required for satellite and proxy stuff
+if [[ $SATELLITE -eq 1 ]] || [[ $PROXY -eq 1 ]] ; then
+ fileList[$((${#fileList[*]}+1))]="${XVM_VBASE}/logs"
+ fileList[$((${#fileList[*]}+1))]="${XVM_VBASE}/bui/logs"
+ fileList[$((${#fileList[*]}+1))]="${XVM_VBASE}/osp/logs"
+ fileList[$((${#fileList[*]}+1))]="${XVM_VBASE}/persistence"
+
+ #checking space required for uce stuff
+ fileList[$((${#fileList[*]}+1))]="$SERVER/public/"
+ fileList[$((${#fileList[*]}+1))]="$SERVER/logs/"
+ fileList[$((${#fileList[*]}+1))]="$SERVER_ETC/"
+ fileList[$((${#fileList[*]}+1))]="$SERVER/public/public_blobs/*.blob.err"
+ fileList[$((${#fileList[*]}+1))]="$CONSOLE/logs"
+ fileList[$((${#fileList[*]}+1))]="$CONSOLE/bin/*uce.*"
+fi
+
+totalSize=0
+fileCount=${#fileList[*]}
+for name in ${fileList[*]}
+do
+ #calculating the required space for each directory
+ if [[ -f $name || -d $name ]]; then
+ integer sizeInKB=`du -Lks $name | nawk '{print $1}'`
+ totalSize=`expr $(($totalSize + $sizeInKB))`
+ fi
+done
+
+totalSize=`expr $((($totalSize * $SPACE_MULTIPLIER)/1024))`
+info "Approximate space required for log collection: ${totalSize} MB"
+
+#calculating the free space available in the output directory
+freeSpace=`df -k ${OUTPUT_PREFIX} | grep -v File | nawk '{print $4}'`
+freeSpace=`expr $freeSpace / 1024`
+info "Space available in the output directory (${OUTPUT_PREFIX}):
${freeSpace} MB"
+
+#exit with error if enough space not available
+if [[ ${totalSize} -gt ${freeSpace} ]]
+then
+ error "The output directory $OUTPUT_PREFIX has only $freeSpace MB of
free space."
+ error "$totalSize MB of free space is approximately required for log
collection."
+ error "Please free up some space or use -o switch to redirect output
somewhere else."
+ #debug_cmd "" rm -rf $outdir
+ exit 3
+else
+ info "Enough space available..."
+fi
+}
+
#
# runs the necessary collector scripts or remote probes
#
@@ -1374,47 +1438,40 @@
prepareOutputDirectory()
{
OUTPUT_DIR="$CASENUM-$appName-$HOST-$datestamp"
- LOGFILE="$OUTPUT_PREFIX/$OUTPUT_DIR/$scriptName.log"
+ LOGFILE="$OUTPUT_PREFIX/$scriptName.log"
outdir="$OUTPUT_PREFIX/$OUTPUT_DIR"
# verify that $OUTPUT_PREFIX is dir and writable
if ! [[ -d $OUTPUT_PREFIX ]] || ! [[ -w $OUTPUT_PREFIX ]] ; then
- error "The output directory $OUTPUT_PREFIX is not a writtable
directory."
- error "Please use -o switch to redirect output somewhere else."
+ echo "ERROR: The output directory $OUTPUT_PREFIX is not a writtable
directory."
+ echo "Please use -o switch to redirect output somewhere else."
exit 3
fi
-
- # verify space in $OUTPUT_PREFIX
- if [[ x"$OS" = x"SunOS" ]]; then
- free=`df -k $OUTPUT_PREFIX | nawk '{print $4}' | tail -1`
- elif [[ x"$OS" = x"Linux" ]]; then
- #bloody Linux needs to explicitely be POSIX compliant ! OMG !
- free=`df -kP $OUTPUT_PREFIX | nawk '{print $4}' | tail -1`
- fi
-
- requested=$REQUESTED_TEMP_DISK
- if [[ $free -lt $requested ]] ; then
- error "The output directory $OUTPUT_PREFIX has only $free kb of free
space."
- error "I need $requested kb of free space there to be on the safe
side."
- error "Please free some space or use -o switch to redirect output
somewhere else."
- exit 3
- fi
-
- mkdir -p "$outdir"
-
- # once we are sure we can write to output, redefine the logging macro
- LOG="tee -a $LOGFILE"
-
+
+ # once we are sure we can write to output, redefine the logging macro to
log
+ # to a temp log file
+ LOG="tee -a $LOGFILE"
+
info "$appName Version $VERSION"
info "Logging to $LOGFILE"
info "User: `id`"
info "OS: $OS version: $OSVER"
- info "Started as: $cmdline"
-
+ info "Started as: $cmdline"
+
info "Detecting running components ..."
- detect
-
+ detect
+
+ info "Checking space requirements (This might take some time) ..."
+ checkAvailableSpace
+
+ debug_cmd "" mkdir -p "$outdir"
+ LOGFILE="$OUTPUT_PREFIX/$OUTPUT_DIR/$scriptName.log"
+ LOG="tee -a $LOGFILE"
+
+ #moving the log file into the output directory
+ debug_cmd "" mv "$OUTPUT_PREFIX/$scriptName.log $LOGFILE"
+ info "Changing log location to $LOGFILE..."
info "Preparing output directories ..."
#create the output directory structure
OUTEXPL="$outdir/explorer"
diff -r 9108121428de -r 759ae095f866 Sun-GDD-OC.sh
--- a/Sun-GDD-OC.sh Wed Nov 25 18:20:59 2009 +0530
+++ b/Sun-GDD-OC.sh Tue Dec 08 20:11:02 2009 +0530
@@ -898,6 +898,22 @@
debug_cmd "$OUTpatch/patch-list" "egrep -e '^Patch'
$OUTpatch/showrev-p.out | nawk '{print \$2}' | sort"
debug_cmd "$OUTsysconfig/zoneadm-list.out" zoneadm list -cp
+ #collecting zone information
+ ZONELIST=`/usr/sbin/zoneadm list -cp | grep -v "global"`
+ for ZONE in $ZONELIST
+ do
+ ZONENAME=`echo $ZONE | nawk -F: '{print $2}'`
+ ZONEPATH=`echo $ZONE | nawk -F: '{print $4}'`
+ debug_cmd "" mkdir "$OUTzones/$ZONENAME"
+ debug_cmd "$OUTzones/$ZONENAME/zonecfg-info" /usr/sbin/zonecfg -z
"$ZONENAME" info
+ debug_cmd "$OUTzones/$ZONENAME/zonecfg-info-fs" /usr/sbin/zonecfg -z
"$ZONENAME" info fs
+
+ if [ -f $ZONEPATH/root/etc/sysidcfg ]
+ then
+ debug_cmd "$OUTzones/$ZONENAME/sysidcfg" cat
$ZONEPATH/root/etc/sysidcfg
+ fi
+ done
+
debug_cmd "$OUTpatch/pkginfo.out" pkginfo
debug_cmd "$OUTpatch/pkginfo-l.out" pkginfo -l
for p in scn hss cacao j6 dhcp scs
@@ -1481,7 +1497,7 @@
# note that variable cannot have - in it's name for eval to work !
EXPLORER_DIRS="messages cacao disks netinfo init sysconfig var \
-etc j2se rpm smf"
+etc j2se rpm smf zones"
for i in $EXPLORER_DIRS ; do
debug_cmd "" mkdir "$OUTEXPL/$i"
eval OUT$i="$OUTEXPL/$i"
diff -r 759ae095f866 -r 41782beaf61c AUTHORS
--- a/AUTHORS Tue Dec 08 20:11:02 2009 +0530
+++ b/AUTHORS Wed Dec 09 11:20:58 2009 +0100
@@ -3,6 +3,8 @@
Drew Gilbert
Lubos Kosco
Martin Man
+Ranjeeth Nagarajan
+Suresh Raju
Contributors , Testers:
diff -r 759ae095f866 -r 41782beaf61c Makefile
--- a/Makefile Tue Dec 08 20:11:02 2009 +0530
+++ b/Makefile Wed Dec 09 11:20:58 2009 +0100
@@ -1,4 +1,4 @@
-PACKAGE=sun-gdd-xvm
+PACKAGE=sun-gdd-oc
BINARY=Sun-GDD-OC.sh
#hmm, exporting above var + executing below should work for gnu and solaris
make somehow, but how?
MAJOR:sh=grep '^MAJOR' Sun-GDD-OC.sh | awk -F= '{ printf "%s", $2 }'
diff -r 759ae095f866 -r 41782beaf61c Sun-GDD-OC.sh
--- a/Sun-GDD-OC.sh Tue Dec 08 20:11:02 2009 +0530
+++ b/Sun-GDD-OC.sh Wed Dec 09 11:20:58 2009 +0100
@@ -298,7 +298,7 @@
}
#
-# Parse commandline options and do the appropriate work
+# Parse command line options and do the appropriate work
# $@ - all params passed on to this script
#
parseOptions()
@@ -368,7 +368,7 @@
if [[ x$JUSER != x"" ]]; then
if [[ x$JPASSWORD = x"" ]]; then
- echo "Username for domain model dump was set, but no password found."
+ echo "User name for domain model dump was set, but no password
found."
echo "! WARNING ! : during jmxdump collection the roots password can
be seen in process list as parameter, so please avoid unprivileged users
looking at processes during this data collection(this is a bug and will be
fixed once underlaying tools are fixed)."
echo "Enter password for $JUSER: "
stty -echo
@@ -591,7 +591,7 @@
fi
fi
-#because of jmxdump port detection(not really needed,just a fallback)
+#because of jmxdump port detection(not really needed,just a fall back)
export CACAO_BIN
AGENT=0
@@ -688,7 +688,7 @@
x=`look_for_prog xvmcli`
if [[ $? -ne 0 ]]; then
warning $x
- warning "Be aware, that GDD cannot collect info about jobs,
notifications or profiles without xvmcli, so one might need to add
screenshots "
+ warning "Be aware, that GDD cannot collect info about jobs,
notifications or profiles without xvmcli, so one might need to add screen
shots "
else
XVMCLI=$x
fi
@@ -934,7 +934,7 @@
# Solaris 10 specifics + collect smf logs + jstacks
if [[ x$OSVER = x"5.10" ]]; then
- #zfs info
+ #TODO zfs info
# info "Collecting smf information and java jstacks (this might take a
while) ..."
debug_cmd "$OUTsysconfig/svcs-a.out" svcs -a
@@ -956,7 +956,7 @@
if [[ -f $SMFLOG ]] ; then
debug_cmd "" cp $SMFLOG $OUTsmf/
fi
- #test if java, if yes, grab jstack
+ # TODO test if java, if yes, grab jstack
# not needed yet, if needed, grep for process , grep java , test $? for
0
# jstack -F (newgrp sys might be needed)
debug_cmd "" rm $OUTsmf/tmp
@@ -966,6 +966,12 @@
debug_cmd "" cp -p "/var/svc/log/milestone-single-user:default.log"
"$OUTsmf"
debug_cmd "$OUTsysconfig/prtdiag-v.out" prtdiag -v
+ #zstat specific
+ debug_cmd "$OUTEXPL/zstatadm_-f_process.out"
/opt/sun/xvm/lib/zstat/zstatadm -f process
+ debug_cmd "$OUTEXPL/zstatadm_-q_process.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q process ; echo $?
+ debug_cmd "$OUTEXPL/zstatadm_-q_task.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q task ; echo $?
+ debug_cmd "$OUTEXPL/zstatadm_-q_flow.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q flow ; echo $?
+
LDM=/usr/sbin/ldm #TODO this should be an alias, but we don't want to
produce warning on systems without ldoms
debug_cmd "$OUTsysconfig/ldm_list-l.out" $LDM list -l
debug_cmd "$OUTsysconfig/ldm_list-devices_a.out" $LDM list-devices -a
@@ -1230,11 +1236,12 @@
#create a summary from client registration table
DSUMMARY=$outdir/datacenter_summary.txt
DSOURCE=$OUTSAT/db/sc_client_registration.selectall
-echo "Summary of datacenter from satellite db (refer to
$OUTSAT/db/sc_client_registration.selectall )" > $DSUMMARY
+echo "APPROXIMATE Summary of datacenter from satellite db (refer to
$OUTSAT/db/sc_client_registration.selectall for complete view)" > $DSUMMARY
echo "" >> $DSUMMARY
echo "Found : " >> $DSUMMARY
-debug "Running: grep scn-proxy $DSOURCE | wc -l >> $DSUMMARY"
-PROXY_COUNT=`grep scn-proxy $DSOURCE | wc -l `
+# TODO be uniq on hostnames, because there can be more records per one agent
+debug "Running: grep scn-proxy $DSOURCE | cut -d\| -f 3 | cut -d: -f 2 |
uniq | wc -l >> $DSUMMARY"
+PROXY_COUNT=`grep scn-proxy $DSOURCE | cut -d\| -f 3 | cut -d: -f 2 | uniq |
wc -l `
echo $PROXY_COUNT >> $DSUMMARY
# warn if auto-collect, restart, running on satellite and more than 1 proxy
attached
if [[ ${RESTART} = "true" && ${AUTO_COLLECT} = "true" ]]; then
@@ -1243,12 +1250,13 @@
fi
fi
echo "proxy servers, namely:" >> $DSUMMARY
-debug "Running: grep scn-proxy $DSOURCE | cut -d '|' -f 3 >> $DSUMMARY"
-grep scn-proxy $DSOURCE | cut -d '|' -f 3 >> $DSUMMARY
+debug "Running: grep scn-proxy $DSOURCE | cut -d '|' -f 3 | cut -d: -f 2 |
uniq >> $DSUMMARY"
+grep scn-proxy $DSOURCE | cut -d '|' -f 3 | cut -d: -f 2 | uniq >> $DSUMMARY
echo "" >> $DSUMMARY
-echo "Total agents connected: " >> $DSUMMARY
-debug "Running: grep scn-agent $DSOURCE | wc -l >> $DSUMMARY"
-grep scn-agent $DSOURCE | wc -l >> $DSUMMARY
+echo "Total(approx.) agents connected: " >> $DSUMMARY
+echo "(counting only unique host names, ignoring multiple interfaces or
re-registrations) " >> $DSUMMARY
+debug "Running: grep scn-agent $DSOURCE | cut -d\| -f 3 | cut -d: -f 2 |
uniq | wc -l >> $DSUMMARY"
+grep scn-agent $DSOURCE | cut -d\| -f 3 | cut -d: -f 2 | uniq | wc -l >>
$DSUMMARY
echo "" >> $DSUMMARY
if [[ x$OS = x"SunOS" ]]; then
diff -r 41782beaf61c -r f3d87477fe62 Sun-GDD-OC.sh
--- a/Sun-GDD-OC.sh Wed Dec 09 11:20:58 2009 +0100
+++ b/Sun-GDD-OC.sh Wed Dec 09 15:34:39 2009 +0100
@@ -968,9 +968,12 @@
#zstat specific
debug_cmd "$OUTEXPL/zstatadm_-f_process.out"
/opt/sun/xvm/lib/zstat/zstatadm -f process
- debug_cmd "$OUTEXPL/zstatadm_-q_process.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q process ; echo $?
- debug_cmd "$OUTEXPL/zstatadm_-q_task.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q task ; echo $?
- debug_cmd "$OUTEXPL/zstatadm_-q_flow.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q flow ; echo $?
+ debug_cmd "$OUTEXPL/zstatadm_-q_process.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q process
+ echo $? >> "$OUTEXPL/zstatadm_-q_process.out_rc"
+ debug_cmd "$OUTEXPL/zstatadm_-q_task.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q task
+ echo $? >> "$OUTEXPL/zstatadm_-q_task.out_rc"
+ debug_cmd "$OUTEXPL/zstatadm_-q_flow.out_rc"
/opt/sun/xvm/lib/zstat/zstatadm -q flow
+ echo $? >> "$OUTEXPL/zstatadm_-q_flow.out_rc"
LDM=/usr/sbin/ldm #TODO this should be an alias, but we don't want to
produce warning on systems without ldoms
debug_cmd "$OUTsysconfig/ldm_list-l.out" $LDM list -l
diff -r f3d87477fe62 -r 3c8071b7c651 Sun-GDD-OC.sh
--- a/Sun-GDD-OC.sh Wed Dec 09 15:34:39 2009 +0100
+++ b/Sun-GDD-OC.sh Thu Dec 10 22:23:38 2009 +0530
@@ -777,7 +777,13 @@
do
#calculating the required space for each directory
if [[ -f $name || -d $name ]]; then
- integer sizeInKB=`du -Lks $name | nawk '{print $1}'`
+ integer sizeInKB=0
+ if [[ x"$OS" = x"SunOS" ]]; then
+ sizeInKB=`du -Lks $name | nawk '{print $1}' | tail -1`
+ elif [[ x"$OS" = x"Linux" ]]; then
+ #Linux requires -P option explicitly for du in for the output to
be POSIX compliant!
+ sizeInKB=`du -LksP $name | nawk '{print $1}' | tail -1`
+ fi
totalSize=`expr $(($totalSize + $sizeInKB))`
fi
done
diff -r 3c8071b7c651 -r 216e09958eb5 Sun-GDD-OC.sh
--- a/Sun-GDD-OC.sh Thu Dec 10 22:23:38 2009 +0530
+++ b/Sun-GDD-OC.sh Thu Dec 10 22:50:08 2009 +0530
@@ -792,7 +792,13 @@
info "Approximate space required for log collection: ${totalSize} MB"
#calculating the free space available in the output directory
-freeSpace=`df -k ${OUTPUT_PREFIX} | grep -v File | nawk '{print $4}'`
+if [[ x"$OS" = x"SunOS" ]]; then
+ freeSpace=`df -k ${OUTPUT_PREFIX} | grep -v File | nawk '{print $4}'`
+elif [[ x"$OS" = x"Linux" ]]; then
+ #Linux requires -P option explicitly for df in for the output to be
POSIX compliant!
+ freeSpace=`df -Pk ${OUTPUT_PREFIX} | grep -v File | nawk '{print $4}'`
+fi
+
freeSpace=`expr $freeSpace / 1024`
info "Space available in the output directory (${OUTPUT_PREFIX}):
${freeSpace} MB"
diff -r 216e09958eb5 -r cf25502a92a4 .hgtags
--- a/.hgtags Thu Dec 10 22:50:08 2009 +0530
+++ b/.hgtags Fri Dec 11 18:42:17 2009 +0530
@@ -1,2 +1,3 @@
8faa6f5b4d3cd308a58eb64eb3eb2ddd1106a1f7 xVMOC2.0
79ee9cff2e08fb0f8ec9a4dbaddf6107ceb003a4 OC2.5
+216e09958eb536ba0a760a00fb1ebf2a20c4521c version_0.25-97
|
[sun-gdd-oc~devel:98] Added tag version_0.25-97 for changeset 216e09958eb5 |
Ranjeeth . Nagarajan | 12/15/2009 |





