This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C43DB2.4DDE9F88
Content-Type: text/plain;
charset="iso-8859-1"
By request, here's the file with a .txt extension. I've extended it a bit
since first posting so that there's a global drive availability number
calculated as well as the per-drive stuff.
-M
------_=_NextPart_000_01C43DB2.4DDE9F88
Content-Type: text/plain;
name="drive_graph.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="drive_graph.txt"
#!/bin/ksh=0A=
=0A=
PATH=3D$PATH:/usr/openv/volmgr/bin=0A=
PROGNAME=3D`basename $0`=0A=
ADDR=3D"you AT yourdomain DOT com"=0A=
=0A=
DDIR=3D/var/tmp=0A=
DBASE=3D${PROGNAME}_datafile=0A=
DFILE=3D$DDIR/$DBASE.`date +%m_%d_%Y`=0A=
OUTF=3D$DDIR/$PROGNAME.out=0A=
=0A=
if [ ! -f $DFILE -o -n "$1" ]=0A=
then=0A=
# New data collection file. Process previous datafile first=0A=
if [ -n "$1" ]=0A=
then=0A=
lastfile=3D$1=0A=
else=0A=
lastfile=3D`ls -tr $DDIR/$DBASE* 2>/dev/null | tail -1`=0A=
fi=0A=
if [ -n "$lastfile" ]=0A=
then=0A=
[ -f $OUTF ] && rm $OUTF=0A=
exec >$OUTF 2>&1=0A=
#Header=0A=
awk 'BEGIN{HR=3D-1;MN=3D0;printf(" ")} {if ($2=3D=3D0) {if =
($1!=3DHR) {HR=3D$1=0A=
if (HR<10) {printf("0%1d",HR)} =
else {printf("%2d",HR)}=0A=
} else {printf("-")} =0A=
}} END {printf("\n")}' $lastfile =0A=
=0A=
#Create Graph=0A=
for drive in `awk '{print $2}' $lastfile| sort -nu`=0A=
do=0A=
awk 'BEGIN {HR=3D0;printf("%2s |",'$drive')} =0A=
{if ($2=3D=3D'$drive') {if ($1!=3DHR) =
{HR=3D$1;printf("|%s",$3)} else {printf("%s",$3)}}}=0A=
END {printf("|\n")}' $lastfile =0A=
done =0A=
=0A=
#Availability Calcs=0A=
GDA=3D`awk 'BEGIN {sample=3D0;up=3D0}=0A=
{ sample++ ; if ($3=3D=3D"-") {up++}}=0A=
END {printf ("%3.1f",up/sample*100)}' $lastfile`=0A=
=0A=
echo "\n## Drive Availability: ${GDA}%" =0A=
for drive in `awk '{print $2}' $lastfile| sort -nu`=0A=
do=0A=
awk 'BEGIN {sample=3D0;up=3D0}=0A=
{if ($2=3D=3D'$drive') { sample++ ; if ($3=3D=3D"-") =
{up++}}}=0A=
END {printf("Drive %2s =3D =
%3d%%\t",'$drive',(up/sample)*100)=0A=
if(('$drive'%4)=3D=3D3) {printf("\n")}}' $lastfile =0A=
done =0A=
=0A=
echo "\n## Report Done" =0A=
mailx -s "Drive Graph: `basename $lastfile|cut -f2 -d.`" $ADDR =
<$OUTF=0A=
=0A=
if [ -z "$1" ]=0A=
then=0A=
#keep history of input & output files=0A=
[ -f $OUTF.2 ] && mv $OUTF.2 $OUTF.3=0A=
[ -f $OUTF.1 ] && mv $OUTF.1 $OUTF.2=0A=
mv $OUTF $OUTF.1=0A=
compress $lastfile=0A=
[ -f $lastfile.2.Z ] && mv $lastfile.2.Z $lastfile.3.Z=0A=
[ -f $lastfile.1.Z ] && mv $lastfile.1.Z $lastfile.2.Z=0A=
mv $lastfile.Z $lastfile.1.Z=0A=
fi=0A=
fi=0A=
fi=0A=
#add to current datafile=0A=
if [ -z "$1" ]=0A=
then=0A=
HR=3D`date +%H`=0A=
vmoprcmd -d ds | awk '$1~/^[0-9]/ {if ($3~/DOWN/) {print =
'$HR',$1,"D"} else {=0A=
if ($3~/PEND/) {print '$HR',$1,"P"} =
else {=0A=
if ($3~/AVR/) {print '$HR',$1,"A"} =
else {=0A=
if ($NF=3D=3D"-") {print =
'$HR',$1,"-"} else {=0A=
print '$HR',$1,"#"}}}}}' >>$DFILE=0A=
fi=0A=
exit=0A=
------_=_NextPart_000_01C43DB2.4DDE9F88--
|