Veritas-bu

[Veritas-bu] Down Drive Notify Script?

2002-12-05 10:39:16
Subject: [Veritas-bu] Down Drive Notify Script?
From: Mark.Donaldson AT experianems DOT com (Donaldson, Mark)
Date: Thu, 5 Dec 2002 08:39:16 -0700
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_001_01C29C74.785263C0
Content-Type: text/plain

Here's one for a single-media server, multi-robot environment.  It will only
monitor the drives that are a member of a robot - it intentially leaves out
standalone drives (the "tpconfig -l" line).  This is because in my
environment, the standalone drive is frequently up and down for various
reasons and it's not a core player in any backup routine.  It has two
different pages if there's one drive down or more than one (I don't want to
be woken up for a single-drive down - I have enough to run without one for a
night).
 
It'll page once for any change in state (all up to one down=page, one-down
to two-down=new page) except the state change to all "up".  You can alter as
you wish...
 
$ cat auto_dltcheck
#!/bin/sh
# Updated 11/2002 to multi-library
 
PATH=$PATH:/usr/openv/volmgr/bin
export PATH
 
PROGNAME=`basename $0`
TMPFILE=/tmp/$PROGNAME.TMP
HISTFILE=/tmp/$PROGNAME.HIST
LOGFILE=/usr/openv/netbackup/logs/$PROGNAME.log
MAILFILE=/tmp/$PROGNAME.MAIL
VMOPR=/tmp/$PROGNAME.cmd
 
MAILADDR= YOU AT YOURDOMAIN DOT COM <mailto:YOU AT YOURDOMAIN DOT COM> 
 
vmoprcmd -d ds >$VMOPR
cp /dev/null $TMPFILE
for drive in `tpconfig -l | awk '$1=="drive" && $5!="-" {print $3}'`
do
  awk '$1=='$drive' {print $1"\t"$3}' $VMOPR >>$TMPFILE
done
rm $VMOPR
 
if [ -f $HISTFILE ]
then
  DIFF=`diff $TMPFILE $HISTFILE | wc -l | tr -d ' '`
else
  touch $HISTFILE
  DIFF=1
fi
 
count=`awk 'BEGIN {sum=0} {if ($2~/DOWN/) {sum++}} END {print sum}'
$TMPFILE`
 
if [ $count -gt 0 -a $DIFF -ne 0 ]
then
  cat $TMPFILE >$MAILFILE
  if [ $count -eq 1 ]
  then
    subject="Index 46.2.2 INFO: single tape drive failure on `hostname`"
    echo "\nAlert backup admin(s) during daytime hours." >>$MAILFILE
  else
    subject="Index 46.2.2 WARNING: multiple tape drive failure on
`hostname`"
    echo "\nAlert backup admin(s) right away." >>$MAILFILE
  fi
  echo "\n`date`">>$LOGFILE
  diff $TMPFILE $HISTFILE >>$LOGFILE
 
  mailx -s "$subject" $MAILADDR <$MAILFILE
fi
 
mv $TMPFILE $HISTFILE
[ -f $LOGFILE ]  && tail -1000 $LOGFILE >$TMPFILE
[ -f $TMPFILE ]  && mv $TMPFILE $LOGFILE
[ -f $MAILFILE ] && rm $MAILFILE
 
exit

 
-----Original Message-----
From: Arterburn, Michael [mailto:Michael.Arterburn AT arvinmeritor DOT com]
Sent: Thursday, December 05, 2002 7:57 AM
To: 'veritas-bu AT mailman.eng.auburn DOT edu'
Subject: [Veritas-bu] Down Drive Notify Script?


I have been looking for a script that will notify me of a down drive right
when it happens.  Is there such a script out there?  I am sorry if it has
already shown up on the newsgroup as I have not been able to monitor it for
the last 4 months.  
 
Thank you!
 
Michael Arterburn <mailto:michael.arterburn AT arvinmeritor DOT com> 
ArvinMeritor Inc. <http://www.arvinmeritor.com> 
Unix  <http://www.hulubei.net/tudor/cool/UnixSysadmins.html> Administrator
Phone:  <http://www.dialpad.com> 812.379.3315

  From my PC
<http://www.dell.com/us/en/dhs/products/model_dimen_1_dimen_8200.htm> ...
through the LAN <http://www.faqs.org/faqs/LANs/> ...  over the data cables
<http://sysday.tripod.com/pRodney.jpg> ... to the ISP
<http://www.findanisp.com/> ... out of the proxies
<http://www.mirc.co.uk/help/proxies.html> ... nothing but net
<http://www.internet.com> !
 

------_=_NextPart_001_01C29C74.785263C0
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns=3D"http://www.w3.org/TR/REC-html40"; xmlns:o =3D=20
"urn:schemas-microsoft-com:office:office" xmlns:w =3D=20
"urn:schemas-microsoft-com:office:word"><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">


<META content=3DWord.Document name=3DProgId>
<META content=3D"MSHTML 5.50.4922.900" name=3DGENERATOR>
<META content=3D"Microsoft Word 10" name=3DOriginator><LINK=20
href=3D"cid:[email protected]" rel=3DFile-List><!--[if gte =
mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in =
1.25in; mso-header-margin: .5in; mso-footer-margin: .5in; =
mso-paper-source: 0; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: =
personal-compose; mso-style-noshow: yes; mso-ansi-font-size: 10.0pt; =
mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Arial; =
mso-hansi-font-family: Arial; mso-bidi-font-family: Arial
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=3DEN-US style=3D"tab-interval: .5in" vLink=3Dpurple =
link=3Dblue>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>Here's=20
one for a single-media server, multi-robot environment.&nbsp; It will =
only=20
monitor the drives that are a member of a robot - it intentially leaves =
out=20
standalone drives (the "tpconfig -l" line).&nbsp; This is because in my =

environment, the standalone drive is frequently up and down for various =
reasons=20
and it's not a core player in any backup routine.&nbsp; It has two =
different=20
pages if there's one drive down or more than one (I don't want to be =
woken up=20
for a single-drive down - I have enough to run without one for=20
a&nbsp;night).</FONT></SPAN></DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>It'll=20
page once for any change in state (all up to one down=3Dpage, one-down =
to=20
two-down=3Dnew page) except the state change to all "up".&nbsp; You can =
alter as=20
you wish...</FONT></SPAN></DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>$ cat=20
auto_dltcheck<BR>#!/bin/sh</FONT></SPAN></DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>#=20
Updated 11/2002 to multi-library</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>PATH=3D$PATH:/usr/openv/volmgr/bin</FONT></SPAN></DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>export=20
PATH</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>PROGNAME=3D`basename=20
$0`<BR>TMPFILE=3D/tmp/$PROGNAME.TMP<BR>HISTFILE=3D/tmp/$PROGNAME.HIST<BR=
>LOGFILE=3D/usr/openv/netbackup/logs/$PROGNAME.log<BR>MAILFILE=3D/tmp/$P=
ROGNAME.MAIL<BR>VMOPR=3D/tmp/$PROGNAME.cmd</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>MAILADDR=3D<A=20
href=3D"mailto:YOU AT YOURDOMAIN DOT COM">YOU AT YOURDOMAIN DOT 
COM</A></FONT></SPAN><=
/DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>vmoprcmd -d ds &gt;$VMOPR<BR>cp /dev/null $TMPFILE<BR>for =
drive in=20
`tpconfig -l | awk '$1=3D=3D"drive" &amp;&amp; $5!=3D"-" {print =
$3}'`<BR>do<BR>&nbsp;=20
awk '$1=3D=3D'$drive' {print $1"\t"$3}' $VMOPR =
&gt;&gt;$TMPFILE<BR>done<BR>rm=20
$VMOPR</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>if [=20
-f $HISTFILE ]<BR>then<BR>&nbsp; DIFF=3D`diff $TMPFILE $HISTFILE | wc =
-l | tr -d '=20
'`<BR>else<BR>&nbsp; touch $HISTFILE<BR>&nbsp; =
DIFF=3D1<BR>fi</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>count=3D`awk 'BEGIN {sum=3D0} {if ($2~/DOWN/) {sum++}} END =
{print sum}'=20
$TMPFILE`</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>if [=20
$count -gt 0 -a $DIFF -ne 0 ]<BR>then<BR>&nbsp; cat $TMPFILE=20
&gt;$MAILFILE<BR>&nbsp; if [ $count -eq 1 ]<BR>&nbsp; =
then<BR>&nbsp;&nbsp;&nbsp;=20
subject=3D"Index 46.2.2 INFO: single tape drive failure on=20
`hostname`"<BR>&nbsp;&nbsp;&nbsp; echo "\nAlert backup admin(s) during =
daytime=20
hours." &gt;&gt;$MAILFILE<BR>&nbsp; else<BR>&nbsp;&nbsp;&nbsp; =
subject=3D"Index=20
46.2.2 WARNING: multiple tape drive failure on =
`hostname`"<BR>&nbsp;&nbsp;&nbsp;=20
echo "\nAlert backup admin(s) right away." &gt;&gt;$MAILFILE<BR>&nbsp;=20
fi<BR>&nbsp; echo "\n`date`"&gt;&gt;$LOGFILE<BR>&nbsp; diff $TMPFILE =
$HISTFILE=20
&gt;&gt;$LOGFILE</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>&nbsp;=20
mailx -s "$subject" $MAILADDR &lt;$MAILFILE<BR>fi</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff size=3D2>mv=20
$TMPFILE $HISTFILE<BR>[ -f $LOGFILE ]&nbsp; &amp;&amp; tail -1000 =
$LOGFILE=20
&gt;$TMPFILE<BR>[ -f $TMPFILE ]&nbsp; &amp;&amp; mv $TMPFILE =
$LOGFILE<BR>[ -f=20
$MAILFILE ] &amp;&amp; rm $MAILFILE</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>exit</FONT></SPAN></DIV>
<DIV><SPAN class=3D811502815-05122002><FONT face=3DArial =
color=3D#0000ff=20
size=3D2><BR></FONT></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> Arterburn, =
Michael=20
  [mailto:Michael.Arterburn AT arvinmeritor DOT com]<BR><B>Sent:</B> Thursday, =
December=20
  05, 2002 7:57 AM<BR><B>To:</B>=20
  'veritas-bu AT mailman.eng.auburn DOT edu'<BR><B>Subject:</B> [Veritas-bu] =
Down Drive=20
  Notify Script?<BR><BR></FONT></DIV>
  <DIV class=3DSection1>
  <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I have been looking for =
a script=20
  that will notify me of a down drive right when it happens.<SPAN=20
  style=3D"mso-spacerun: yes">&nbsp; </SPAN>Is there such a script out =
there?<SPAN=20
  style=3D"mso-spacerun: yes">&nbsp; </SPAN>I am sorry if it has =
already shown up=20
  on the newsgroup as I have not been able to monitor it for the last 4 =
months.=20
  <SPAN style=3D"mso-spacerun: =
yes">&nbsp;</SPAN><o:p></o:p></SPAN></FONT></P>
  <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thank=20
  you!<o:p></o:p></SPAN></FONT></P>
  <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: yes"><A=20
  href=3D"mailto:michael.arterburn AT arvinmeritor DOT com">Michael =
Arterburn<BR></A><A=20
  href=3D"http://www.arvinmeritor.com";>ArvinMeritor =
Inc.</A></SPAN></FONT><SPAN=20
  style=3D"mso-no-proof: yes"><o:p></o:p></SPAN></P>
  <P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: yes"><A=20
  href=3D"http://www.hulubei.net/tudor/cool/UnixSysadmins.html";>Unix=20
  Administrator</A><BR><A href=3D"http://www.dialpad.com";>Phone:=20
  812.379.3315</A><o:p></o:p></SPAN></FONT></P>
  <P class=3DMsoNormal style=3D"MARGIN-BOTTOM: 12pt"><FONT face=3DArial =
size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: =
yes"><BR>&nbsp; From=20
  my <A=20
  =
href=3D"http://www.dell.com/us/en/dhs/products/model_dimen_1_dimen_8200.=
htm">PC</A>...=20
  through the <A =
href=3D"http://www.faqs.org/faqs/LANs/";>LAN</A>...&nbsp; over the=20
  <A href=3D"http://sysday.tripod.com/pRodney.jpg";>data cables</A>... =
to the <A=20
  href=3D"http://www.findanisp.com/";>ISP</A>... out of the <A=20
  href=3D"http://www.mirc.co.uk/help/proxies.html";>proxies</A>... =
nothing but <A=20
  href=3D"http://www.internet.com";>net</A>!</SPAN></FONT><FONT =
face=3DArial=20
  size=3D2><SPAN=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial"><o:p></o:p></SPAN></FONT></P>
  <P class=3DMsoNormal><FONT face=3D"Times New Roman" size=3D3><SPAN=20
  style=3D"FONT-SIZE: =
12pt"><o:p>&nbsp;</o:p></SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTM=
L>

------_=_NextPart_001_01C29C74.785263C0--

<Prev in Thread] Current Thread [Next in Thread>