Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making the job a little easier 3

Status
Not open for further replies.
Jul 28, 2004
726
0
0
BE
Hi all,

Just a question,as an AIX admin you are constantly to automate actions by pouring them into scripts ( creation users,....).I was wondering what most of you guys out there have automated within AIX for making your lives easier :)I'm looking for some occupational therapy for the summer when all is quiet here...

regards,

R.
 
OK, here is one:

Code:
#!/bin/ksh
# finds duplicate PVIDs

lspv>/tmp/lspv.tmp
lspv|awk '$2!~/^none$/{print$2}'|sort|uniq -d|while read pvid;do
        grep $pvid /tmp/lspv.tmp;print
done
rm /tmp/lspv.tmp

IBM Certified -- AIX 4.3 Obfuscation
 
Code:
#!/bin/ksh -xv
# -=GLA=-
# eradicates broken filesets after an AIX5 upgrade

### vars & misc {{{
if [[ $(whoami) != "root" ]];then
        print "must be root"
        exit 2
fi
version="1.1"
(( count=0 ))
hostn=$(hostname) #}}}
function fi_br { #{{{
print "\nlooking for broken filesets and missing requisites [count=${count}]"
(( count += 1 ))
lppvar=$(lppchk -vm3 2>&1|awk '
$NF~/BROKEN/{printf($1" ")}
$NF~/requires:/{printf($2" ")}')
if [[ -n ${lppvar} ]];then
        print "found some stuff:\n${lppvar}"
        rm_br
else
        print "should be clean, please verify and perform manual cleanup if necessary"
        print "oslevel: $(oslevel)"
        print "oslevel -r: $(oslevel -r)"
        print "lppchk -vm3: $(lppchk -vm3)"
        exit 0
fi
} #}}}
function rm_br { #{{{
print "installp -u ${lppvar}">/tmp/rm.${hostn}.${count}
print "\nreview filesets to uninstall:"
cat /tmp/rm.${hostn}.${count}
printf "\nedit this command? [y]:"
while read ans;do
        if [[ ${ans} = "y" || ${ans} = "Y" ]];then
                /bin/ksh -c "/usr/bin/vi /tmp/rm.${hostn}.${count}"
                print "\nproceeding with uninstall..."
                chmod 700 /tmp/rm.${hostn}.${count}
                if /tmp/rm.${hostn}.${count};then
                        fi_br
                fi
        else
                print "\nproceeding with uninstall..."
                chmod 700 /tmp/rm.${hostn}.${count}
                if /tmp/rm.${hostn}.${count};then
                        fi_br
                fi
        fi
done
} #}}}

IBM Certified -- AIX 4.3 Obfuscation
 
Hi,

This ia quite a big script,but produces a nice html log will all system data !
==========================================
#!/bin/ksh
######################################################################
# Written by ...
# Version 1.65
# June 28, 2005
#
#You run it once you want to have a snap of all processes status at certain point.
#Eventually the log is sent over Kermit to the remote PC/MAC.
#The following is a brief description of the logs entries and it's meaning:
#df -watch out for any 100% full filesystem
#ABNORMALLY TERMINATED " is analyzed later in the "Latest application dumps" section.
#Shows top 10 memory usage by process section can show the processes that is taking too much memory #percentage.
#Shows top 10 CPU usage by process section can show the processes that is taking too much CPU percentage.
#Shows zombies processes section shows dead processes - can point to some software bug, will need to be investigated.
#iostat - watch out for any 100% busy disk
#Macs mounting volumes section shows which aix volumes are currently mounted by what MAC
#Stations that were connected over IP section shows all stations that were connected to my aix over Telnet/NFS
#errpt -look for SOFTWARE PROGRAM ABNORMALLY TERMINATED /SYSDUMP / DISK errors.
#All Running processes - ps aux shows ALL running processes.
#######################################################################
#set -x

DATE2=`date +%m%d%H%M%y`
LOGFILE="/tmp/aix_check.log"
HTMLFILE="/tmp/aix_check.html"
ERRLOG="/tmp/aix_check_err.log"

#Check if it's aix4 or 5
VERSION=`oslevel |cut -c 1`
HOSTNAME=`hostname`
NOPING=0
LSQ=0

# In this code block we are begin creating html header and putting it into a $HTMLFILE
TH_SMALL_FONT="<p style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 9pt; font-weight: bold; color: #000000\">"
TH_BIG_FONT="<p style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold; color: #000000\">"
T_FONT="<p style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 9pt; font-weight: normal; color: #004080\">"
TB_FONT="<p style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 9pt; font-weight: bold; color: #004080\">"
TH_FONT="<p style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 9pt; font-weight: bold; color: #000000\">"

echo "<HTML><HEAD><TITLE>aix Logs</TITLE></HEAD><BODY background=\"#5f5f5f\" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=\"#EFEFEF\">" > $HTMLFILE
echo "<font size=1>$DATE1</font>" >> $HTMLFILE
echo "<hr>" >> $HTMLFILE
echo "<h2><center>aix_check.html from $HOSTNAME , `date` </center></h2>" >> $HTMLFILE
echo "<a NAME=\"TOP\"></a>" >> $HTMLFILE
echo " <UL>" >> $HTMLFILE
################## aix Information ##################
echo "<H4><FONT COLOR=darkblue> aix Information:<H4>" >> $HTMLFILE
echo " <LI><A HREF=\"#STI\">Station Info</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#LASTUPD\">Last Updates</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#MODULES\">Memory modules</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#FUL\"> df </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#ADI\">Scsi devices</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#ADIH\">Scsi devices hierarchy </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#APCI\">All PCI Devices</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#LSPV\">List VGs</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#SPACE\"> free space on rootvg </A> " >> $HTMLFILE
echo " <BR> " >> $HTMLFILE
################## Networking Information ##################
echo "<H4><FONT COLOR=darkcyan>Networking Information:</H4>" >> $HTMLFILE
echo " <LI><A HREF=\"#MIPC\">My IP Config </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#HOS\">/etc/hosts </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#ATA\">atalk.conf </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#AFP\">afpvolumes </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#EXPORTS\">NFS exported volumes </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#ROUT\">Station routing info </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#MNT\"> Mount</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#LAST\"> Last 10 logins</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#ALIH\">All logged in Hosts </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#MMV\">Macs Mounting Volumes </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#SCO\">Stations Connected Over IP </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#COMERR\">Communication errors </A></FONT> " >> $HTMLFILE
echo " <BR> " >> $HTMLFILE
################## Unix Related Information ##################
echo "<H4><FONT COLOR=blueviolet>Unix Related Information:</H4>" >> $HTMLFILE
echo " <LI><A HREF=\"#ARP\">All Running Processes </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#MUS\"> Top 10 memory usage by process </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#CPU\"> Top 10 CPU usage by process </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#ZMB\"> Zombies processes </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#SIO\"> iostat </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#SOS\">vmstat -Overall System Load Picture </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#SPA\"> errpt </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#HERRPT\">Latest hardware errors </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#DIA\">diag </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#RLAD\"> Reasons for latest application dumps</A> " >> $HTMLFILE
echo " <LI><A HREF=\"#SYSCORE\">Latest system core analysis </A> " >> $HTMLFILE
echo " <LI><A HREF=\"#LSMIT\">Latest smit activities </A></FONT> " >> $HTMLFILE
echo " <LI><A HREF=\"#IPCON\">My IP config</A></FONT>" >> $HTMLFILE
echo " <BR> " >> $HTMLFILE
echo " </UL> " >> $HTMLFILE
# Now html header is done . Let's go.



MEMORY=`lsattr -E -l mem0 -a size|awk '{print $2}'`
MODELNAME=`uname -M`
FIRMWARE=`lsmcode -c`
VERSION1=`lslpp -l | awk '/RiproOutput/ {print $2 }'| sort -ru`
PAGINGSPACE=`lsps -a -s|awk '{ print $1 }'|grep -v Total`
DATE=`date`
NOOFPROCS=`lscfg|grep proc|wc -l|awk '{ print $1 }'`
LASTCOLD=`ls -la /inst.log 2>/dev/null| awk '{print $6,$7,$8}'`
LASTFULL=`ls -la /scitex/version/logs/loading_full_software_version.log 2>/dev/null| awk '{print $6,$7,$8}'`
LASTMIG=`ls -la /scitex/version/logs/config_restore_migration.log 2>/dev/null| awk '{print $6,$7,$8}'`
UPTIME=`uptime`
DATE1=`date`

resize > /dev/null 2>&1

case $MODELNAME in
*F50) PLATFORM=" ;;
*170) PLATFORM=" ;;
*6E3) PLATFORM=" ;;
*6E4) PLATFORM=" ;;
*6F1) PLATFORM=" ;;
esac

rm $LOGFILE.5 > /dev/null 2>&1 #rotate all logs one position forward
mv $LOGFILE.4 $LOGFILE.5 > /dev/null 2>&1
mv $LOGFILE.3 $LOGFILE.4 > /dev/null 2>&1
mv $LOGFILE.2 $LOGFILE.3 > /dev/null 2>&1
mv $LOGFILE.1 $LOGFILE.2 > /dev/null 2>&1
mv $LOGFILE $LOGFILE.1 > /dev/null 2>&1

echo "Now creating /tmp/aix_check.log and /tmp/aix_check.html\c"
echo ".\c"
echo "#################################################" |tee $LOGFILE > $ERRLOG
echo $DATE1 |tee -a $LOGFILE >> $ERRLOG
echo "==================================================" |tee -a $LOGFILE >> $ERRLOG
echo ".\c"
echo "Current station info :\n" >> $LOGFILE
echo "hostname=$HOSTNAME ,$MODELNAME ,No of PROCS=$NOOFPROCS ,VER=$VERSION1 \nFirmware level:$FIRMWARE " >> $LOGFILE
echo "\nLast coldstart:\t\t$LASTCOLD \nLast full version:\t$LASTFULL \nLast migration:\t\t$LASTMIG \nUptime:\t$UPTIME" >> $LOGFILE
echo "\nPhysical Memory=\t$MEMORY MB \nPAGINGSPACE=\t$PAGINGSPACE " >> $LOGFILE
hostname >> $ERRLOG
echo "==================================================" >> $LOGFILE |tee -a $ERRLOG
echo ".\c"

# HTML File
echo "<a NAME=\"STI\"></a>" >> $HTMLFILE
echo "<table width=\"85%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\"> " >> $HTMLFILE
echo "<tr><td colspan=\"2\" bgcolor=\"#C0C0C0\"> " >> $HTMLFILE
echo "$TH_BIG_FONT Current station info <a HREF=\"#TOP\">[Top]</a></p></td></tr>" >> $HTMLFILE
echo "<tr><td>$TB_FONT Hostname:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $HOSTNAME ,$MODELNAME <a href="$PLATFORM" target="_blank">See $MODELNAME service guide</a> </p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT No of PROCS:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $NOOFPROCS </p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT Firmware level:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $FIRMWARE <a href=" target="_blank">See IBM firmware page </a></p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT Physical Memory:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $MEMORY MB </p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT Pagingspace:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $PAGINGSPACE </p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT Version:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $VERSION1 </p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT Last coldstart:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $LASTCOLD </p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT Last full Version:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $LASTFULL </p></td></tr> " >> $HTMLFILE
echo "<tr><td>$TB_FONT Last migration:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $LASTMIG </p></td></tr>" >> $HTMLFILE
echo "<tr><td>$TB_FONT Uptime:</p></td>" >> $HTMLFILE
echo "<td>$T_FONT $UPTIME </p></td></tr></table> " >> $HTMLFILE
# END HTML File

#Notify the user on severe system problems
errpt |grep `date +%m%d`|grep -E "disk|LVM|I/O|CORRUPTION|sysplanar0|SCSI|STORAGE"|sort -ru +1|head -10 >/tmp/errpt.log
if [[ -s /tmp/errpt.log ]] ;then
echo "\n\nThe following system errors occured today and should be reported to Creo support :\n" |tee -a $ERRLOG
cat /tmp/errpt.log |tee -a $ERRLOG
echo "#################################################" |tee -a $ERRLOG
fi

#Check if ping to my hostname works
ping -c 1 `hostname` > /tmp/ping.log 2>&1 &
sleep 10
if [[ `ls -la /tmp/ping.log | awk '{print $5}'` = "0" || `grep loss /tmp/ping.log|awk '{print $7}'` != '0%' ]] ;then
echo "\n\nPing to my hostname has failed.Check your network hardware and configuration !" |tee -a $ERRLOG
echo "#################################################" |tee -a $ERRLOG
kill `ps -ef|grep ping|grep -v grep|awk '{print $2}'` >/dev/null 2>&1
NOPING=1
fi

echo ".\c"
echo "Last Updates:\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"LASTUPD\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Last updates <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> lslpp -l|grep Upd_</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
lslpp -l|grep Upd_ |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Memory Modules:\n" >> $LOGFILE
if [[ $MODELNAME = "IBM,9111-520" ]] ;then
lscfg -vp|grep -p "Memory DIMM"|grep -E "Physical|Size"|awk '/Size/{printf "%s",$0;getline}1'|awk -F" " '{print $2," ",$3}' >> $LOGFILE
else
lscfg -vp|grep -E "Size|Physical Location.*M"|awk '/Physical/{printf "%-35s",$0;getline}1'|grep Size >> $LOGFILE
fi
echo "==================================================" >> $LOGFILE

# HTML File
echo "<a NAME=\"MODULES\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Memory Modules <a HREF=\"#TOP\">[Top]</a></p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
if [[ $MODELNAME = "IBM,9111-520" ]] ;then
lscfg -vp | grep -p "Memory DIMM" | grep -E "Physical|Size" | awk '/Size/{printf "%s",$0;getline}1' >> $HTMLFILE
else
lscfg -vp | grep -E "Size|Physical Location.*M[12]." | awk '/Physical/{printf "%-35s",$0;getline}1'|grep Size >> $HTMLFILE
fi
echo "<br>">> $HTMLFILE
echo "<a href="$PLATFORM" target="_blank">See $MODELNAME service guide </a>" >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File

echo ".\c"
echo "df -\"df\" -watch out for any 100% full filesystem\n" >> $LOGFILE
#run df in background,in case there is some stuck NFS mount,timeout in 5 seconds and notify the user
df >/dev/null 2>&1 & >> $LOGFILE
sleep 5
if ps -ef|grep df|grep -v grep >/dev/null ;then
kill `ps -ef|grep df|grep -v grep|awk '{print$2}'` >/dev/null
echo "\nOne of the NFS mounts is stuck ! Check your Network connections .\n" |tee -a $ERRLOG
echo "#################################################" |tee -a $ERRLOG
else
#Notify on full FS
if df|grep 100% >/dev/null 2>&1;then
echo "\n\nThe following filesystems are 100% full :\n" |tee -a $ERRLOG
df |grep 100%|awk '{print $7}' |tee -a $ERRLOG
echo "#################################################" |tee -a $ERRLOG
fi
df >> $LOGFILE
echo "==================================================" >> $LOGFILE
# HTML File
echo "<a NAME=\"FUL\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT df -watch out for any 100% full filesystem <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> <b style="color:blue"> Command Used:</b></b> &nbsp df</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
df | awk '{printf ("%-40s%-12s%-10s%-10s%-10s%-6s%-40s\n", $1,$2,$3,$4,$5,$6,$7)}' 2>/dev/null >> $HTMLFILE
echo "<br>" >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
fi

echo ".\c"
echo "Scsi devices :\n" >> $LOGFILE
lsdev -Csscsi >> $LOGFILE
echo "==================================================" >> $LOGFILE

# HTML File
lsdev -Csscsi -F 'name,,,,,,,status,,,,,,,location,,,,,,,description' > /scitex/version/temp/$$.lsdev
echo "<hr>" >> $HTMLFILE
echo "<a NAME=\"ADI\"></a>" >> $HTMLFILE
echo "<table width=\"75%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\"> " >> $HTMLFILE
echo "<tr><td colspan=\"4\" bgcolor=\"#C0C0C0\"> " >> $HTMLFILE
echo "<p style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold; color: #000000\">Scsi devices <a HREF=\"#TOP\">[Top]</a></p></td></tr>" >> $HTMLFILE
echo "<tr><td>$TH_FONT Disk Name: </p></td>" >> $HTMLFILE
echo " <td>$TH_FONT Disk Status:</p></td>" >> $HTMLFILE
echo " <td>$TH_FONT Disk Location:</p></td>" >> $HTMLFILE
echo " <td>$TH_FONT Disk Description:</p></td></tr>" >> $HTMLFILE
while read i
do
HTM=$(echo "$i" | sed -e "s/,,,,,,,/\<\/p\>\<\/td\>\<td\>\<p style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 9pt; font-weight: normal; color: #004080\"\> /g" );
echo "<tr><td>$T_FONT $HTM </p></td></tr>" >> $HTMLFILE
done < /scitex/version/temp/$$.lsdev
rm /scitex/version/temp/$$.lsdev
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File

echo ".\c"
echo "All PCI Devices :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"APCI\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT ALl PCI devices <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp lsdev -Cspci</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
lsdev -Cspci |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "List volume groups - verifies striping :\n" >> $LOGFILE
# HTML File
echo "<a NAME=\"LSPV\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT List volume groups - verifies striping <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp lspv</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
lspv |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
SPACE=`lsvg rootvg|grep FREE|awk -F "[()]" '{print $2}'`

# HTML File
echo "<a NAME=\"SPACE\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT free space on rootvg : <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp lsvg rootvg|grep FREE </p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
echo "free space on rootvg = $SPACE :\n" |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "/etc/hosts file :\n" >> $LOGFILE
# HTML File
echo "<a NAME=\"HOS\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT /etc/hosts file <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp grep -vE "localhost" /etc/hosts" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

grep -vE "^#|localhost" /etc/hosts |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "atalk.conf :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"ATA\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT atalk.conf <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp cat /usr/local/es/conf/atalk.conf</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

cat /usr/local/es/conf/atalk.conf |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "afpvolumes :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"AFP\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT afpvolumes <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp cat /usr/local/es/conf/afpvolumes</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

cat /usr/local/es/conf/afpvolumes |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE


echo ".\c"
echo "NFS exported volumes:\n" >> $LOGFILE
# HTML File
echo "<a NAME=\"EXPORTS\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT NFS exported volumes <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp showmount -e" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

showmount -e |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Mounted filesystems: \"mount\":\n" >> $LOGFILE
mount >> $LOGFILE
echo "==================================================" >> $LOGFILE
# HTML File
echo "<a NAME=\"MNT\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Mounted filesystems: <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp mount</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
echo "node mounted mounted over vfs date options" >> $HTMLFILE
mount | awk '! (/dev/ || /proc/) && ! /mounted/ {printf ("%-12s%-25s%-40s%-7s%-4s%-4s%-6s%-10s%-20s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> $HTMLFILE
mount | awk ' (/dev/ || /proc/) {printf ("%-37s%-40s%-7s%-4s%-3s%-6s%-10s%-20s\n"," " $1,$2,$3,$4,$5,$6,$7,$8)}' >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File

echo ".\c"
echo "Station routing info :\n" >> $LOGFILE
# HTML File
echo "<a NAME=\"ROUT\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Station routing info <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp netstat -rn" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

netstat -rn |tee -a $LOGFILE >> $HTMLFILE
echo "" |tee -a $LOGFILE >> $HTMLFILE
netstat -r |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Last 10 logins \"last\":\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"LAST\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Last 10 logins: <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp last|head -10" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
last|head -10 |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE



echo ".\c"
echo "Macs mounting volumes - shows which aix volumes are currently mounted by which MAC:\n" >> $LOGFILE
echo "----------------------" >> $LOGFILE

# HTML File
echo "<a NAME=\"MMV\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Macs mounting volumes - shows which aix volumes are currently mounted by which MAC <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp /usr/local/es/swho -c</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
/usr/local/es/swho -c |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

#run only if ping was OK
if [[ $NOPING != 1 ]] ;then
echo ".\c"
echo "Stations connected over IP - shows all stations that are connected to my aix over telnet/NFS:\n" >> $LOGFILE
# HTML File
echo "<a NAME=\"SCO\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Stations connected over IP - shows all stations that are connected to my aix over telnet/NFS <a HREF=\"#TOP\">[Top]</a>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

netstat -a|grep -i establ|awk '! /localh|loopb/ {print $5}'|awk -F. '$1 ~ /^[a-zA-Z]/ {print $1};$1 ~ /^[0-9]/ {print $0}'|cut -d. -f 1-4 |sort -u|tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE
fi

echo ".\c"
echo "Communication errors - shows all adapters communication errors:\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"COMERR\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Communication errors - shows all adapters communication errors <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp entstat -drt ent0 |grep -i error" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

for ENT in `lsdev -Cspci | grep ent|awk '{ print $1}'` ;do
echo "$ENT errors:\n" |tee -a $LOGFILE >> $HTMLFILE
entstat -drt $ENT |grep -i error |tee -a $LOGFILE >> $HTMLFILE
echo "----------------------------------------------" |tee -a $LOGFILE >> $HTMLFILE
done
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "All Running processes - \"ps auxww\":\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"ARP\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT All Running processes - \"ps auxww\" <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp ps auxww</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

ps auxww |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Top 10 memory usage by process - can show processes that are taking too much memory percentage :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"MUS\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Top 10 memory usage by process - can show processes that are taking too much memory percentage <a HREF=\"#TOP\">[Top]</a><br><b style="color:blue"> Command Used:</b> &nbsp ps auxw | sort -r +3 |grep -v USER |head -10</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
echo "USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND" |tee -a $LOGFILE >> $HTMLFILE
ps auxw | sort -r +3 |grep -v USER |head -10 |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Top 10 CPU usage by process - can show processes that are taking too much CPU percentage :\n" >> $LOGFILE
# HTML File
echo "<a NAME=\"CPU\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Top 10 CPU usage by process - can show processes that are taking too much CPU percentage <a HREF=\"#TOP\">[Top]</a><br> <b style="color:blue"> Command Used:</b> &nbsp ps auxw | sort -r +2 |grep -v USER |head -10</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

echo "USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND" |tee -a $LOGFILE >> $HTMLFILE
ps auxw|sort -r +2|grep -v USER |head -10 |tee -a $LOGFILE |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Zombies processes - can point to premature died processes:\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"ZMB\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Zombies processes - can point to premature died processes <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp ps -auw | grep defunct</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
ps -auw | grep defunct |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "iostat - watch out for any 100% busy disk:\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"SIO\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Shows iostat - watch out for any 100% busy disk <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp iostat 2 3</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

iostat 2 3 |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "vmstat - \"vmstat 2 5\" -shows overall system load picture:\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"SOS\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT vmstat -shows overall system load picture <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp vmstat 2 5</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
vmstat 2 5 |tee -a $LOGFILE >> $HTMLFILE
echo " <br>" >> $HTMLFILE
echo "<a href=" target="_blank">See vmstat legend </a>" >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "errpt - look for \"SOFTWARE PROGRAM ABNORMALLY TERMINATED\"/SYSDUMP/DISK errors: \n" >> $LOGFILE

# HTML File
echo "<a NAME=\"SPA\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT errpt - look for \"SOFTWARE PROGRAM ABNORMALLY TERMINATED\"/SYSDUMP/DISK errors <a HREF=\"#TOP\">[Top]</a><br><b style="color:blue"> Command Used:</b> &nbsp errpt -D|sort -rn +1|head -50|grep -v IDENTIFIER</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

if [[ $VERSION = "5" ]] ;then
errpt -D|sort -rn +1|head -50|grep -v IDENTIFIER |tee -a $LOGFILE >> $HTMLFILE
echo "==================================================" |tee -a $LOGFILE >> $HTMLFILE
else
errpt |sort -urn +1|head -50|grep -v IDENTIFIER |tee -a $LOGFILE >> $HTMLFILE
echo "==================================================" |tee -a $LOGFILE >> $HTMLFILE
fi
echo "<br>" >> $HTMLFILE
echo "<a href="$PLATFORM" target="_blank">See $MODELNAME service guide</a>" >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File

if [[ $VERSION = "5" ]] ;then
echo ".\c"
echo "Latest hardware errors :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"HERRPT\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Latest hardware errors : <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp errpt -AD -d H | grep -v 0000|head -100</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
errpt -AD -d H | grep -v 0000|head -100|tee -a $LOGFILE >> $HTMLFILE
echo "<br>" >> $HTMLFILE
echo "<a href="$PLATFORM">See $MODELNAME service guide</a>" >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE
fi

echo ".\c"
echo "diag - runs a diag and analizes the errpt log\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"DIA\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT diag - runs a diag and analizes the errpt log <a HREF=\"#TOP\">[Top]</a>&nbsp &nbsp <b style="color:blue"> Command Used:</b> &nbsp diag -B -c</p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
echo "\nRunning a basic system diag :\n" |tee -a $LOGFILE >> $HTMLFILE
diag -B -c |tee -a $LOGFILE >> $HTMLFILE
echo "\nRunning a basic system errpt log analisys :\n" |tee -a $LOGFILE >> $HTMLFILE
diag -Be -c |tee -a $LOGFILE >> $HTMLFILE
echo "<br>" >> $HTMLFILE
echo "<a href="$PLATFORM" target="_blank">See $MODELNAME service guide</a>" >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Reasons for latest application dumps :\n" >> $LOGFILE

if [[ `oslevel |cut -d. -f 1` = "5" ]] ;then
ERROR1="AD2BA772"
ERROR2="B6048838"
else
ERROR1="C60BB505"
ERROR2=""
fi
DATE1=""
# HTML File
echo "</table> " >> $HTMLFILE
echo "<a NAME=\"RLAD\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Reasons for latest application dumps <a HREF=\"#TOP\">[Top]</a></p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE

for SEQUENCE in `errpt -a -j $ERROR1,$ERROR2|grep Sequence|cut -d: -f2`;do
DATE2=`errpt -a -l $SEQUENCE|awk '/Date/ {print $5 }'|cut -d: -f 1,2`
if [[ $DATE1 != $DATE2 ]] ;then
echo "`errpt -l $SEQUENCE -a|awk '/Date/ {print $3,$4,$5 }'` \c\t" |tee -a $LOGFILE >> $HTMLFILE
errpt -a -l $SEQUENCE|awk '/PROGRAM NAME/,/ADDITIONAL INFORMATION/'|grep -vE "PROG|ADD" |tee -a $LOGFILE >> $HTMLFILE
DATE1=$DATE2
fi
done
echo "" >> $LOGFILE
echo "==================================================" >> $LOGFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File

echo ".\c"
echo "Latest system core analysis :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"SYSCORE\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Latest system core analysis: <a HREF=\"#TOP\">[Top]</a></p></td></tr>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
sysdumpdev -L 2>&1|tee -a $LOGFILE >> $HTMLFILE
echo "~~~~~~~~~~~~~~~~" |tee -a $LOGFILE >> $HTMLFILE
echo "stat" >/tmp/ANSWER
echo "\n\n\n\n" >> /tmp/ANSWER
echo "status" >> /tmp/ANSWER
echo "\n" >> /tmp/ANSWER
echo "thread -r" >> /tmp/ANSWER
echo "\n" >> /tmp/ANSWER
echo "q" >> /tmp/ANSWER
cd /var/adm/ras
COREFILE=`ls -lat vmcore* 2>/dev/null| head -1|awk '{print $9}'`
if [[ -n $COREFILE ]] ;then
if [[ $VERSION = "5" ]] ;then
kdb $COREFILE < /tmp/ANSWER >/tmp/logfile
else
crash $COREFILE < /tmp/ANSWER >/tmp/logfile
fi
cat /tmp/logfile|tee -a $LOGFILE >> $HTMLFILE
fi
echo "<br>" >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "Latest smit activities:\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"LSMIT\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Latest smit activities: <a HREF=\"#TOP\">[Top]</a>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
grep -E "2005|title|>>" /smit.log | tail -30 |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "My IP config :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"IPCON\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT My IP config <a HREF=\"#TOP\">[Top]</a>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
DO=0
for EN in `lsdev -Cs pci| awk '/ent/ { print $1 }'|cut -c 1,2,4`;do
if [[ $DO = 0 ]] ;then
printf "%-4s %-15s %-15s %-12s %-12s %-21s %-20s %-8s\n" "Int" "IP_address" "Mask" "DNS" "Gateway" "Domain" "Speed Selected" "Type" |tee -a $LOGFILE >> $HTMLFILE
printf "%-4s %-15s %-15s %-12s %-12s %-21s %-20s %-8s\n" "---" "----------" "----" "---" "-------" "------" "--------------" "------" |tee -a $LOGFILE >> $HTMLFILE
fi
mktcpip -S $EN 2>&1|awk -F: '$0 !~ /host/ {printf ("%-4s %-15s %-15s %-12s %-12s %-22s",$4,$2,$3,$5,$7,$6 )}' |tee -a $LOGFILE >> $HTMLFILE
ENT=`echo $EN|cut -c 3`
SPEED=`lsattr -El ent$ENT | grep -i speed|awk '{print $2}'`
lscfg -v -l ent$ENT|grep -iE "gigabit|10/100/1000" >/dev/null
if [[ $? = 0 ]] ;then
DESCRIPTION=GIGABIT
else
DESCRIPTION=100BT
fi
printf "%-20s %-20s \n" $SPEED $DESCRIPTION |tee -a $LOGFILE >> $HTMLFILE
DO=1
done
echo "\n" |tee -a $LOGFILE >>$HTMLFILE
echo "==================================================" >> $LOGFILE

echo " </PRE></td></tr></table>" >> $HTMLFILE

echo " </body></html>" >> $HTMLFILE





Long live king Moshiach !
 
Sorrt,the end of script got cut out (probably the number of lines limitation)...
So here it is - just add it to the previous part:
==================
echo ".\c"
echo "Latest smit activities:\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"LSMIT\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT Latest smit activities: <a HREF=\"#TOP\">[Top]</a>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
grep -E "2005|title|>>" /smit.log | tail -30 |tee -a $LOGFILE >> $HTMLFILE
echo " </PRE></td></tr></table>" >> $HTMLFILE
# END HTML File
echo "==================================================" >> $LOGFILE

echo ".\c"
echo "My IP config :\n" >> $LOGFILE

# HTML File
echo "<a NAME=\"IPCON\"></a>" >> $HTMLFILE
echo "<table width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\">" >> $HTMLFILE
echo "<tr><td bgcolor=\"#C0C0C0\"> $TH_FONT My IP config <a HREF=\"#TOP\">[Top]</a>" >> $HTMLFILE
echo "<tr><td bgcolor=\"#FBEDBB\"><PRE>" >> $HTMLFILE
DO=0
for EN in `lsdev -Cs pci| awk '/ent/ { print $1 }'|cut -c 1,2,4`;do
if [[ $DO = 0 ]] ;then
printf "%-4s %-15s %-15s %-12s %-12s %-21s %-20s %-8s\n" "Int" "IP_address" "Mask" "DNS" "Gateway" "Domain" "Speed Selected" "Type" |tee -a $LOGFILE >> $HTMLFILE
printf "%-4s %-15s %-15s %-12s %-12s %-21s %-20s %-8s\n" "---" "----------" "----" "---" "-------" "------" "--------------" "------" |tee -a $LOGFILE >> $HTMLFILE
fi
mktcpip -S $EN 2>&1|awk -F: '$0 !~ /host/ {printf ("%-4s %-15s %-15s %-12s %-12s %-22s",$4,$2,$3,$5,$7,$6 )}' |tee -a $LOGFILE >> $HTMLFILE
ENT=`echo $EN|cut -c 3`
SPEED=`lsattr -El ent$ENT | grep -i speed|awk '{print $2}'`
lscfg -v -l ent$ENT|grep -iE "gigabit|10/100/1000" >/dev/null
if [[ $? = 0 ]] ;then
DESCRIPTION=GIGABIT
else
DESCRIPTION=100BT
fi
printf "%-20s %-20s \n" $SPEED $DESCRIPTION |tee -a $LOGFILE >> $HTMLFILE
DO=1
done
echo "\n" |tee -a $LOGFILE >>$HTMLFILE
echo "==================================================" >> $LOGFILE

echo " </PRE></td></tr></table>" >> $HTMLFILE

echo " </body></html>" >> $HTMLFILE


Long live king Moshiach !
 
#!/bin/ksh
#This script displays reasons for application core dumps (SOFTWARE PROGRAM ABNORMALLY TERMINATED)

if [[ `oslevel |cut -d. –f 1` = “5” ]] ;then
ERROR1=”AD2BA772”
ERROR2=”B6048838”
else
ERROR1=”C60BB505”
ERROR2=””
fi
DATE1=””
for SEQUENCE in `errpt -a -j $ERROR1,$ERROR2 |grep Sequence|cut -d: -f2`;do
DATE2=`errpt -a -l $SEQUENCE|grep Date|awk '{ print $5 }'|cut -d: -f 1,2`
if [[ $DATE1 != $DATE2 ]] ;then
echo “`errpt -l $SEQUENCE -a|grep Date|awk '{ print $3,$4,$5 }'` \c\t”
errpt -a -l $SEQUENCE|awk '/PROGRAM NAME/,/ADDITIONAL INFORMATION/'|grep -vE "PROG|ADD"
DATE1=$DATE2
fi
done
exit



Long live king Moshiach !
 
For me it was working out - with lots of help from this forum - how to do bulk user generation. See my FAQ52-5866

Columb Healy
 
Disks performance testing:

#!/bin/ksh
##########################################################################
# Written by ... 19/4/04
# Updated June 15, 2005
# Version 1.2
# This script runs a cp copy of 1000MB (that it creates) between the two chosen local filesystem,and displays the results of the dd (file write from memory to FS) and the "cp".
# If there is only one user filesystem - the cp runs within this filesystem.
# Note: This test assumes that nothing else is running on this computer simultaneously !
#####################################################################

integer CP_AVERAGE=0
export LOGFILE=/tmp/datavol.log #datavol-test logfile that is being displayed
export FINAL=/tmp/final.log #final logfile - datavol-test + realtime
export MONLOG=/tmp/mon.log #realtime speed monitoring temporary log
export LOGFILE1=/tmp/datavol1.log #realtime speed monitoring final log
export TIME1=/tmp/TIME1
export STRIPED
HOSTNAME=`hostname`

rm $LOGFILE >/dev/null 2>&1
rm $FINAL >/dev/null 2>&1
rm $MONLOG >/dev/null 2>&1
rm $LOGFILE1 >/dev/null 2>&1
rm /tmp/datavol >/dev/null 2>&1
rm /tmp/disk >/dev/null 2>&1

if [[ $1 = "-n" ]] ;then
export NOCLEAR=1
else
clear #clear screen if not started with -n flag
fi

KILL_MON ()
{
echo "============================================"
echo "Now cleaning up a bit both filesystems . . ."
rm $MONLOG >/dev/null 2>&1
rm -f $DESTINATION_FS/1000MB* >/dev/null 2>&1
rm -f $SOURCE_FS/1000MB* >/dev/null 2>&1
kill -9 `ps -ef|grep dd|grep -v grep|awk '{ print $2 }'` >/dev/null 2>&1
kill -9 `ps -ef|grep "iostat 1"|grep -v grep|awk '{ print $2 }'` >/dev/null 2>&1
}

#Select the dataVolumes for testing
echo "Selecting dataVolumes for testing ...this may take a minute"
df -k |grep -vE "/proc|Mounted|scitex"|grep -vw /|sort -r +2|awk '{ print $7,$3 }' > /tmp/datavol1
#Add disk parameters to the dataVolumes info
for DATAVOL in `cat /tmp/datavol1|cut -d " " -f 1` ;do
for DISK in `lspv 2>/dev/null|awk '{ print $1 }' `;do
lspv -l $DISK 2>/dev/null|grep $DATAVOL >/dev/null
if [[ $? = 0 ]] ;then
PARAMS=`lsdev -Csscsi|grep $DISK|awk '{ print $4,$5,$6 }'`
FREESIZE=`grep $DATAVOL /tmp/datavol1|cut -d " " -f 2`
for ALLDISK in `lspv|awk '{ print $1 }'`; do #establish all disks belonging to my FS
if lspv -l $ALLDISK 2>/dev/null|grep $DATAVOL >/dev/null 2>&1 ;then
echo "$ALLDISK \c" >> /tmp/disk
fi
done
DISKS=`cat /tmp/disk`
printf " %-33s %-10d %-20s %-30s\n" "$DATAVOL" "$FREESIZE" "$DISKS" "$PARAMS" >> /tmp/datavol
rm /tmp/disk >/dev/null 2>&1
break
fi
done
echo ".\c"
done

COUNT=`wc -l /tmp/datavol|awk '{ print $1 }'`
integer A=1
oldIFS=$IFS #change field separator to "end-of-line"
IFS='\n'
while (( $A <= $COUNT )) ;do #fill up the array from the file
datavol[A]=`head -n $A /tmp/datavol|tail -1`
A=$A+1
done
A=$A-1

echo "---------------------------------------------------" |tee $LOGFILE
IFS='!' #change field separator to non-existing one just for "select"
printf -- "Select the source dataVolume : [] \n\n"
printf " %-36s %-10s %-20s %-30s\n" "Filesystem" "FREESIZE" "DISKS" "Type"

PS3="choose >>"
select SOURCE_FS1 in ${datavol[*]}
do
if [[ -z $SOURCE_FS1 ]]
then
printf -- "Choose the right number \n\n"
else
break
fi
done

printf -- "Select the destination dataVolume : [] \n\n"
printf " %-36s %-10s %-20s %-30s\n" "Filesystem" "FREESIZE" "DISKS" "Type"
PS3="choose >>"
select DESTINATION_FS1 in ${datavol[*]}
do
if [[ -z $DESTINATION_FS1 ]] ;then
printf -- "Choose the right number \n\n"
else
break
fi
done

IFS=$oldIFS #change field separator back to default !
SOURCE_FS=`echo $SOURCE_FS1|cut -d " " -f1`
DESTINATION_FS=`echo $DESTINATION_FS1|cut -d " " -f1`
SOURCE_DISK=`echo $SOURCE_FS1|cut -d " " -f3`
DESTINATION_DISK=`echo $DESTINATION_FS1|cut -d " " -f3`

#Establish if the source is striped - multiply the result if yes
VG_S=`lspv | grep $SOURCE_DISK | awk '{print $3}'`
STRIPED_S=`lspv | grep $VG_S | wc -l|awk '{ print $1}'`
#Establish if the destination is striped - multiply the result if yes
VG_D=`lspv | grep $DESTINATION_DISK | awk '{print $3}'`
STRIPED_D=`lspv | grep $VG_D | wc -l|awk '{ print $1}'`

echo "The source volume is $SOURCE_FS" >> $LOGFILE
echo "The destination volume is $DESTINATION_FS" >> $LOGFILE
echo "---------------------------------------------------" >> $LOGFILE

#Verify that 1000MB space is available on source and destination
integer SPACE=`df -k $SOURCE_FS|sort -r +2|head -1|awk '{ print $3 }'`
if [[ $SOURCE_FS != $DESTINATION_FS ]] ;then
if (( $SPACE < 1200000 )) ;then
echo "============================="
echo "Not enough space available on $SOURCE_FS !"
KILL_MON
exit 1
fi
else
if (( $SPACE < 2400000 )) ;then
echo "============================="
echo "Not enough space available on $SOURCE_FS !"
KILL_MON
exit 1
fi
fi

integer SPACE=`df -k $DESTINATION_FS|sort -r +2|head -1|awk '{ print $3 }'`
if (( $SPACE < 1200000 )) ;then
echo "============================="
echo "Not enough space available on $DESTINATION_FS !"
KILL_MON
exit 1
fi

#cleanup in case of a BRAKE
trap "KILL_MON; exit 1" INT

printf " %-33s %-10s %-20s %-30s\n" "Filesystem" "FREESIZE" "DISKS" "Type" >> $LOGFILE
cat /tmp/datavol >> $LOGFILE

#Now create the backgroung function that displays both results
MONFUNC ()
{
#set -x
rm $MONLOG >/dev/null 2>&1
iostat 1 >$MONLOG & #start monitor into file
sleep 1 #delay 1 second to skip the total numbers in iostat
while ps -ef|grep 1000MB|grep -v grep >/dev/null 2>&1 ; do #run MONFUNC till cp/dd are over
DISK1=`cat /tmp/DISK` #grep for the right disk
#Multiply the RESULT only if the write occures to a striped destination/source :
if ( ps -ef|grep "cp $SOURCE_FS/1000MB"|grep -v grep >/dev/null 2>&1 && (($STRIPED_D != 2)) ) || ( ps -ef|grep dd|grep -v grep >/dev/null 2>&1 && (($STRIPED_S != 2 ))) ;then
integer RESULT=`grep $DISK1 $MONLOG 2>/dev/null|tail -1|awk '{ print $6 }'|awk -F. '{ print $1 }'`
else
integer RESULT1=`grep $DISK1 $MONLOG 2>/dev/null|tail -1|awk '{ print $6 }'|awk -F. '{ print $1 }'`
integer RESULT='RESULT1*2'
fi
#echo "RESULT1=$RESULT1, RESULT=$RESULT" #this is for debugging
cat $LOGFILE > $FINAL
echo "Current throughput = $RESULT KByte/sec" >> $FINAL
if [[ $NOCLEAR = 1 ]] ;then #do not clear if started with -n flag
cat $FINAL
else
clear; cat $FINAL
fi
sleep 3
done
}

#create a file to work with - 1000MB file on a chosen source dataVolume
if [[ ! -f $SOURCE_FS/1000MB ]] ;then
echo "$SOURCE_DISK" >/tmp/DISK #instruct MONFUNC which disk to grep
cd $SOURCE_FS/
echo "--------------------------------------------------" >> $LOGFILE
echo "Now writing 1000MB test file to $SOURCE_FS" >> $LOGFILE
echo "--------------------------------------------------" >> $LOGFILE
MONFUNC & #start real time monitoring
dd if=/dev/zero of=1000MB bs=1024k count=1000 >/dev/null 2>&1 &
if [[ $? != 0 ]] ;then
echo "Failed to create the 1000MB file on $SOURCE_FS"
KILL_MON
exit 1
fi
integer TIME=0
while ps -ef|grep dd|grep -v grep 2>&1 >/dev/null ;do
TIME=$TIME+1
sleep 1
done
integer PERFM=1048576/$TIME
echo "Average dd throughput to $SOURCE_FS = $PERFM KByte/sec " >>$LOGFILE
echo "--------------------------------------------------" >> $LOGFILE
fi
sleep 10 #delay to enable dd to complete

#Running cp between the destination and source dataVolumes
echo "$DESTINATION_DISK" >/tmp/DISK #instruct MONFUNC which disk to grep
echo "Running a copy of 1000MB from $SOURCE_FS to $DESTINATION_FS" >>$LOGFILE
echo "--------------------------------------------------" >> $LOGFILE
MONFUNC & #start real time monitoring
if [[ $SOURCE_FS = $DESTINATION_FS ]] ;then
timex cp $SOURCE_FS/1000MB $DESTINATION_FS/1000MBa 2>&1|grep -E "real|error" > $TIME1
else
timex cp $SOURCE_FS/1000MB $DESTINATION_FS/ 2>&1|grep -E "real|error" > $TIME1
fi
if grep -i error $TIME1 2>&1 >/dev/null ;then
echo "\ncp copy failure !\n"
KILL_MON
exit 1
else
integer TIME=`tail -1 $TIME1|awk '{ print $2 }'|tr -d "."`
integer PERF=1048576000/$TIME
integer PERFM=$PERF/10
echo "Average cp throughput = $PERFM KByte/sec " |tee -a $LOGFILE
fi

KILL_MON &







Long live king Moshiach !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top