Veritas-bu

[Veritas-bu] How to tell when all images on a tape will expir e?

2003-07-09 16:24:59
Subject: [Veritas-bu] How to tell when all images on a tape will expir e?
From: Mark.Donaldson AT experianems DOT com (Donaldson, Mark)
Date: Wed, 9 Jul 2003 14:24:59 -0600
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_01C34658.2B799300
Content-Type: text/plain

You can get this from "bpmedialist" pretty easily:
 
$ bpmedialist -U
Server Host = backup0
 
 id     rl  images   allocated        last updated      density  kbytes
restores
           vimages   expiration       last read         <------- STATUS
------->
----------------------------------------------------------------------------
----
000000   0    160   05/20/2003 10:01  05/27/2003 15:23     dlt  93966396
0
              MPX   06/03/2003 15:23        N/A           EXPIRED    FROZEN
 
000002   3     35   06/29/2003 13:45  06/29/2003 15:56     dlt  64251655
0
              MPX   07/30/2003 15:56  07/06/2003 13:37    FULL
 
000003   4*    84   11/24/2002 09:12  11/24/2002 14:18     dlt  94051385
0
              MPX   11/24/2003 13:10        N/A           FULL
 
The expiration date is where I highlighted it.
 
A little awk parsing will turn this into a one-liner if the form isn't very
good for you.
 
You might also get a little mileage out of this script. It produces a
summary report on tape usage and a little report on retention levels and the
number of tapes that expire for each level.  Note each retention level
includes the previous level, so Expire < 2 weeks is the sum of "Expiring < 1
week" and "1 < Expiring < 2 weeks".  The retention levels a drawn from the
NB retention table so it'll auto-config to anything you currently have set.
 
## General Data Tape Summary
      Total Data Tapes:  364
   Total Library Tapes:  168
            Full Tapes:  255
           Empty Tapes:   49
       Suspended Tapes:    2
          Frozen Tapes:    6
  Total Cleaning Tapes:   12
 
## Retentions
 Expiring <=  1   week:   70
 Expiring <=  2  weeks:  108
 Expiring <=  3  weeks:  132
 Expiring <=  1  month:  191
 Expiring <=  2 months:  285
 Expiring <=  3 months:  286
 Expiring <=  6 months:  299
 Expiring <=  1   year:  314
 Expiring <=  3  years:  315

The script that produces this follows.  Note, this calls a little external
program called "seconds_since_epoch" which is a little C program that
returns the Unix time integer.  It's also pretty easy to produce in PERL but
nearly impossible to write in standard shell...
 
#!/bin/ksh
PROGNAME=`basename $0`
VMQUERY=/var/tmp/$PROGNAME.$$.vmquery
BPMEDIA=/var/tmp/$PROGNAME.$$.bpmedia
    RET=/var/tmp/$PROGNAME.$$.ret
 
#Populate file of assigned media
cp /dev/null $BPMEDIA
for svr in `bpstulist | awk '{print $3}' | sort -u`
do
  bpmedialist -mlist -l -h $svr >>$BPMEDIA
done
 
#Retention levels
bpretlevel -l | sort -n -k 2 > $RET
 
#Volume database
vmquery -a -w | awk 'NR>3 {print}' >$VMQUERY
 
#Get current unix time integer
now=`seconds_since_epoch`
 
#Lots of counting
echo "\n## General Data Tape Summary"
awk '$3!~/CLN/ {sum++} END {printf ("  %20s: %4d\n","Total Data
Tapes",sum)}' $VMQUERY
awk '$3!~/CLN/ && $8!~/-/ {sum++} END {printf ("  %20s: %4d\n","Total
Library Tapes",sum)}' $VMQUERY
awk ' { if (int($15/8)%2) {sum++}} END {printf ("  %20s: %4d\n","Full
Tapes",sum)}' $BPMEDIA
awk '$3!~/CLN/ && $20 ~ /^00\/00\/00/ {sum++} END {printf ("  %20s:
%4d\n","Empty Tapes",sum)}' $VMQUERY
awk ' { if (int($15/2)%2) {sum++}} END {printf ("  %20s: %4d\n","Suspended
Tapes",sum)}' $BPMEDIA
awk ' { if (int($15)%2)   {sum++}} END {printf ("  %20s: %4d\n","Frozen
Tapes",sum)}' $BPMEDIA
awk '$3~/CLN/ {sum++} END {printf ("  %20s: %4d\n","Total Cleaning
Tapes",sum)}' $VMQUERY
 
echo "\n## Retentions"
prev=0
for retlvl in `awk '{print $1}' $RET`
do
  # count tapes in each retention level
 
  label=`awk '$1=='$retlvl' {if ($3~/infinit/) {print "Infinity"} else
{print $3 " " $4}}' $RET`
  offset=`awk '$1=="'$retlvl'" {print $2}' $RET`
  count=`awk 'BEGIN {sum=0}
              {if ('$now'+'$offset'>=$7) {sum++}}
              END {print sum}' $BPMEDIA`
  # if current count same as previous count then skip-no tapes at this level
  if [ $count -ne $prev ]
  then
    # Use awk function to get pretty print
    echo "$label $count" | \
      awk '{printf (" Expiring <= %2s %6s: %4d\n",$1,$2,$3)}'
  fi
  prev=$count
done
rm $BPMEDIA $RET $VMQUERY
exit

HTH -Mark


-----Original Message-----
From: Fabbro, Andrew P [mailto:Fabbro.Andrew AT cnf DOT com]
Sent: Wednesday, July 09, 2003 1:37 PM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] How to tell when all images on a tape will expire?



Let's say I have tape #123456.  I want to know when all images on the tape
will expire and it will be scratched.  Actually, I have about 2,000 tapes
and I want to run a report that says "these tapes will expire on these
days".  We do not mix retention levels but there are many different pools
with different retention levels.  No, the available_media script does not
give this information - it

does not address the future. 

So...how can I determine that?  Seems like a basic bit of management info.
bpimmedia will show me what images are on the tape and when the expire, but
parsing that out for 2,000 tapes and processing it (compare dates) is not
feasible.  For one thing, I was hoping to run this report daily and
bpimmedia takes about 3 minutes per tape and there aren't 6,000 minutes in a
day ;)

-- 
 Drew Fabbro 
 Manager, Unix Systems Group (USG) 
 fabbro.andrew AT cnf DOT com 
 Desk: 503.450.3374 
 Cell: 503.701.0369 



------_=_NextPart_001_01C34658.2B799300
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<TITLE>How to tell when all images on a tape will expire?</TITLE>

<META content="MSHTML 5.50.4926.2500" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff size=2>You 
can get this from "bpmedialist" pretty easily:</FONT></SPAN></DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>$ bpmedialist -U<BR>Server Host = backup0</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp; rl&nbsp; images&nbsp;&nbsp; 
allocated&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last 
updated&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; density&nbsp; kbytes 
restores<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
vimages&nbsp;&nbsp; expiration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last 
read&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;------- STATUS 
-------&gt;<BR>--------------------------------------------------------------------------------<BR>000000&nbsp;&nbsp;
 
0&nbsp;&nbsp;&nbsp; 160&nbsp;&nbsp; 05/20/2003 10:01&nbsp; 05/27/2003 
15:23&nbsp;&nbsp;&nbsp;&nbsp; dlt&nbsp; 
93966396&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
MPX&nbsp;&nbsp; <STRONG><EM>06/03/2003 
15:23&nbsp;&nbsp;</EM></STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
N/A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
EXPIRED&nbsp;&nbsp;&nbsp; FROZEN</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>000002&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp; 35&nbsp;&nbsp; 06/29/2003 
13:45&nbsp; 06/29/2003 15:56&nbsp;&nbsp;&nbsp;&nbsp; dlt&nbsp; 
64251655&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
MPX&nbsp;&nbsp; 07/30/2003 15:56&nbsp; 07/06/2003 13:37&nbsp;&nbsp;&nbsp; 
FULL</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>000003&nbsp;&nbsp; 4*&nbsp;&nbsp;&nbsp; 84&nbsp;&nbsp; 11/24/2002 
09:12&nbsp; 11/24/2002 14:18&nbsp;&nbsp;&nbsp;&nbsp; dlt&nbsp; 
94051385&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
MPX&nbsp;&nbsp; 11/24/2003 13:10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
N/A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
FULL</FONT></SPAN></DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff size=2>The 
expiration date is where I highlighted it.</FONT></SPAN></DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff size=2>A 
little awk parsing will turn this into a one-liner if the form isn't very good 
for you.</FONT></SPAN></DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff size=2>You 
might also get a little mileage out of this script. It produces a summary 
report 
on tape usage and a little&nbsp;report on retention levels and the number of 
tapes that expire for each level.&nbsp; Note each retention level includes the 
previous level, so Expire &lt; 2 weeks is the sum of "Expiring &lt; 1 week" and 
"1 &lt; Expiring &lt; 2 weeks".&nbsp; The retention levels a drawn from the NB 
retention table so it'll auto-config to anything you currently have 
set.</FONT></SPAN></DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>## General Data Tape Summary<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Total 
Data 
Tapes:&nbsp; 364<BR>&nbsp;&nbsp; Total Library Tapes:&nbsp; 
168<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Full 
Tapes:&nbsp; 
255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Empty Tapes:&nbsp;&nbsp; 49<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Suspended 
Tapes:&nbsp;&nbsp;&nbsp; 
2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Frozen 
Tapes:&nbsp;&nbsp;&nbsp; 6<BR>&nbsp; Total Cleaning Tapes:&nbsp;&nbsp; 
12</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>## Retentions<BR>&nbsp;Expiring &lt;=&nbsp; 1&nbsp;&nbsp; 
week:&nbsp;&nbsp; 70<BR>&nbsp;Expiring &lt;=&nbsp; 2&nbsp; weeks:&nbsp; 
108<BR>&nbsp;Expiring &lt;=&nbsp; 3&nbsp; weeks:&nbsp; 132<BR>&nbsp;Expiring 
&lt;=&nbsp; 1&nbsp; month:&nbsp; 191<BR>&nbsp;Expiring &lt;=&nbsp; 2 
months:&nbsp; 285<BR>&nbsp;Expiring &lt;=&nbsp; 3 months:&nbsp; 
286<BR>&nbsp;Expiring &lt;=&nbsp; 6 months:&nbsp; 299<BR>&nbsp;Expiring 
&lt;=&nbsp; 1&nbsp;&nbsp; year:&nbsp; 314<BR>&nbsp;Expiring &lt;=&nbsp; 3&nbsp; 
years:&nbsp; 315<BR></FONT></SPAN></DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff size=2>The 
script that produces this follows.&nbsp; Note, this calls a little external 
program called "seconds_since_epoch" which is a little C program that returns 
the Unix time integer.&nbsp; It's also pretty easy to produce in PERL but 
nearly 
impossible to write in standard shell...</FONT></SPAN></DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>#!/bin/ksh<BR>PROGNAME=`basename 
$0`<BR>VMQUERY=/var/tmp/$PROGNAME.$$.vmquery<BR>BPMEDIA=/var/tmp/$PROGNAME.$$.bpmedia<BR>&nbsp;&nbsp;&nbsp;
 
RET=/var/tmp/$PROGNAME.$$.ret</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>#Populate file of assigned media<BR>cp /dev/null $BPMEDIA<BR>for svr in 
`bpstulist | awk '{print $3}' | sort -u`<BR>do<BR>&nbsp; bpmedialist -mlist -l 
-h $svr &gt;&gt;$BPMEDIA<BR>done</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>#Retention levels<BR>bpretlevel -l | sort -n -k 2 &gt; 
$RET</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>#Volume database<BR>vmquery -a -w | awk 'NR&gt;3 {print}' 
&gt;$VMQUERY</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>#Get current unix time 
integer<BR>now=`seconds_since_epoch`</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>#Lots of counting<BR>echo "\n## General Data Tape Summary"<BR>awk 
'$3!~/CLN/ {sum++} END {printf ("&nbsp; %20s: %4d\n","Total Data Tapes",sum)}' 
$VMQUERY<BR>awk '$3!~/CLN/ &amp;&amp; $8!~/-/ {sum++} END {printf ("&nbsp; 
%20s: 
%4d\n","Total Library Tapes",sum)}' $VMQUERY<BR>awk ' { if (int($15/8)%2) 
{sum++}} END {printf ("&nbsp; %20s: %4d\n","Full Tapes",sum)}' $BPMEDIA<BR>awk 
'$3!~/CLN/ &amp;&amp; $20 ~ /^00\/00\/00/ {sum++} END {printf ("&nbsp; %20s: 
%4d\n","Empty Tapes",sum)}' $VMQUERY<BR>awk ' { if (int($15/2)%2) {sum++}} END 
{printf ("&nbsp; %20s: %4d\n","Suspended Tapes",sum)}' $BPMEDIA<BR>awk ' { if 
(int($15)%2)&nbsp;&nbsp; {sum++}} END {printf ("&nbsp; %20s: %4d\n","Frozen 
Tapes",sum)}' $BPMEDIA<BR>awk '$3~/CLN/ {sum++} END {printf ("&nbsp; %20s: 
%4d\n","Total Cleaning Tapes",sum)}' $VMQUERY</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face="Courier New" color=#0000ff 
size=2>echo "\n## Retentions"<BR>prev=0<BR>for retlvl in `awk '{print $1}' 
$RET`<BR>do<BR>&nbsp; # count tapes in each retention level</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=606215519-09072003><FONT face=Arial><FONT size=2><FONT 
color=#0000ff><FONT face="Courier New">&nbsp; label=`awk '$1=='$retlvl' {if 
($3~/infinit/) {print "Infinity"} else {print $3 " " $4}}' $RET`<BR>&nbsp; 
offset=`awk '$1=="'$retlvl'" {print $2}' $RET`<BR>&nbsp; count=`awk 'BEGIN 
{sum=0}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
{if ('$now'+'$offset'&gt;=$7) 
{sum++}}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
END {print sum}' $BPMEDIA`<BR>&nbsp; # if current count same as previous count 
then skip-no tapes at this level<BR>&nbsp; if [ $count -ne $prev ]<BR>&nbsp; 
then<BR>&nbsp;&nbsp;&nbsp; # Use awk function to get pretty 
print<BR>&nbsp;&nbsp;&nbsp; echo "$label $count" | 
\<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; awk '{printf (" Expiring &lt;= %2s %6s: 
%4d\n",$1,$2,$3)}'<BR>&nbsp; fi<BR>&nbsp; prev=$count<BR>done<BR>rm $BPMEDIA 
$RET $VMQUERY<BR>exit</FONT><BR></FONT></FONT></DIV>
<DIV></FONT></SPAN><SPAN class=606215519-09072003><FONT face=Arial 
color=#0000ff 
size=2>HTH -Mark</DIV>
<DIV><BR></DIV></FONT></SPAN>
<BLOCKQUOTE>
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Fabbro, Andrew P 
  [mailto:Fabbro.Andrew AT cnf DOT com]<BR><B>Sent:</B> Wednesday, July 09, 
2003 1:37 
  PM<BR><B>To:</B> veritas-bu AT mailman.eng.auburn DOT edu<BR><B>Subject:</B> 
  [Veritas-bu] How to tell when all images on a tape will 
  expire?<BR><BR></FONT></DIV>
  <P><FONT face=Arial size=2>Let's say I have tape #123456.&nbsp; I want to 
know 
  when all images on the tape will expire and it will be scratched.&nbsp; 
  Actually, I have about 2,000 tapes and I want to run a report that says 
"these 
  tapes will expire on these days".&nbsp; We do not mix retention levels but 
  there are many different pools with different retention levels.&nbsp; No, the 
  available_media script does not give this information - it</FONT></P>
  <P><FONT face=Arial size=2>does not address the future.</FONT> </P>
  <P><FONT face=Arial size=2>So...how can I determine that?&nbsp; Seems like a 
  basic bit of management info.&nbsp; bpimmedia will show me what images are on 
  the tape and when the expire, but parsing that out for 2,000 tapes and 
  processing it (compare dates) is not feasible.&nbsp; For one thing, I was 
  hoping to run this report daily and bpimmedia takes about 3 minutes per tape 
  and there aren't 6,000 minutes in a day ;)</FONT></P>
  <P><FONT face="Courier New" size=2>-- </FONT><BR><FONT face="Courier New" 
  size=2>&nbsp;Drew Fabbro</FONT> <BR><FONT face="Courier New" 
  size=2>&nbsp;Manager, Unix Systems Group (USG)</FONT> <BR><FONT 
  face="Courier New" size=2>&nbsp;fabbro.andrew AT cnf DOT com</FONT> <BR><FONT 
  face="Courier New" size=2>&nbsp;Desk: 503.450.3374</FONT> <BR><FONT 
  face="Courier New" size=2>&nbsp;Cell: 503.701.0369</FONT> 
</P><BR></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C34658.2B799300--

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