Veritas-bu

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

2003-07-10 16:56:02
Subject: [Veritas-bu] How to tell when all images on a tape will expir e?
From: scott.kendall AT abbott DOT com (scott.kendall AT abbott DOT com)
Date: Thu, 10 Jul 2003 15:56:02 -0500
This is a multipart message in MIME format.
--=_alternative 007302AF86256D5F_=
Content-Type: text/plain; charset="us-ascii"

and since bpmedialist shows this info, as Mark mentioned, and it is also 
used in the available_media script, you can easily add this as a new 
column to a customized version of the available_media script if you want.

I have added a column on mine for last write date and expiration date and 
also allow options to be passed that will make the report only report on a 
specific library or specific volume pool.  I use the report to feed a 
script that determines what tapes should get ejected (based on status, KB 
written, last write date and expiration date) and then ejects them for me.


- Scott





"Donaldson, Mark" <Mark.Donaldson AT experianems DOT com>
Sent by: veritas-bu-admin AT mailman.eng.auburn DOT edu
07/09/2003 03:24 PM

 
        To:     "'Fabbro, Andrew P'" <Fabbro.Andrew AT cnf DOT com>, 
veritas-bu AT mailman.eng.auburn DOT edu
        cc: 
        Subject:        RE: [Veritas-bu] How to tell when all images on a tape 
will expir e?


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 



--=_alternative 007302AF86256D5F_=
Content-Type: text/html; charset="us-ascii"


<br><font size=2 face="Arial">and since bpmedialist shows this info, as Mark 
mentioned, and it is also used in the available_media script, you can easily 
add this as a new column to a customized version of the available_media script 
if you want.</font>
<br>
<br><font size=2 face="Arial">I have added a column on mine for last write date 
and expiration date and also allow options to be passed that will make the 
report only report on a specific library or specific volume pool. &nbsp;I use 
the report to feed a script that determines what tapes should get ejected 
(based on status, KB written, last write date and expiration date) and then 
ejects them for me.</font>
<br>
<br>
<br><font size=2 face="Arial">- Scott</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>&quot;Donaldson, Mark&quot; 
&lt;Mark.Donaldson AT experianems DOT com&gt;</b></font>
<br><font size=1 face="sans-serif">Sent by: veritas-bu-admin AT 
mailman.eng.auburn DOT edu</font>
<p><font size=1 face="sans-serif">07/09/2003 03:24 PM</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; 
&nbsp; &nbsp; &nbsp;&quot;'Fabbro, Andrew P'&quot; &lt;Fabbro.Andrew AT cnf DOT 
com&gt;, veritas-bu AT mailman.eng.auburn DOT edu</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; 
&nbsp; &nbsp; &nbsp;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; 
&nbsp; &nbsp; &nbsp;RE: [Veritas-bu] How to tell when all images on a tape will 
expir e?</font></table>
<br>
<br>
<br><font size=2 color=blue face="Arial">You can get this from 
&quot;bpmedialist&quot; pretty easily:</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">$ bpmedialist -U<br>
Server Host = backup0</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">&nbsp;id &nbsp; &nbsp; rl 
&nbsp;images &nbsp; allocated &nbsp; &nbsp; &nbsp; &nbsp;last updated &nbsp; 
&nbsp; &nbsp;density &nbsp;kbytes restores<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vimages &nbsp; expiration &nbsp; &nbsp; 
&nbsp; last read &nbsp; &nbsp; &nbsp; &nbsp; &lt;------- STATUS -------&gt;<br>
--------------------------------------------------------------------------------<br>
000000 &nbsp; 0 &nbsp; &nbsp;160 &nbsp; 05/20/2003 10:01 &nbsp;05/27/2003 15:23 
&nbsp; &nbsp; dlt &nbsp;93966396 &nbsp; &nbsp; &nbsp; 0<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MPX &nbsp; <b><i>06/03/2003 
15:23 &nbsp;</i></b> &nbsp; &nbsp; &nbsp;N/A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
EXPIRED &nbsp; &nbsp;FROZEN</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">000002 &nbsp; 3 &nbsp; &nbsp; 35 
&nbsp; 06/29/2003 13:45 &nbsp;06/29/2003 15:56 &nbsp; &nbsp; dlt &nbsp;64251655 
&nbsp; &nbsp; &nbsp; 0<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MPX &nbsp; 07/30/2003 15:56 
&nbsp;07/06/2003 13:37 &nbsp; &nbsp;FULL</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">000003 &nbsp; 4* &nbsp; &nbsp;84 
&nbsp; 11/24/2002 09:12 &nbsp;11/24/2002 14:18 &nbsp; &nbsp; dlt &nbsp;94051385 
&nbsp; &nbsp; &nbsp; 0<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MPX &nbsp; 11/24/2003 13:10 
&nbsp; &nbsp; &nbsp; &nbsp;N/A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FULL</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Arial">The expiration date is where I 
highlighted it.</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Arial">A little awk parsing will turn this 
into a one-liner if the form isn't very good for you.</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Arial">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. 
&nbsp;Note each retention level includes the previous level, so Expire &lt; 2 
weeks is the sum of &quot;Expiring &lt; 1 week&quot; and &quot;1 &lt; Expiring 
&lt; 2 weeks&quot;. &nbsp;The retention levels a drawn from the NB retention 
table so it'll auto-config to anything you currently have set.</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">## General Data Tape Summary<br>
 &nbsp; &nbsp; &nbsp;Total Data Tapes: &nbsp;364<br>
 &nbsp; Total Library Tapes: &nbsp;168<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Full Tapes: &nbsp;255<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Empty Tapes: &nbsp; 49<br>
 &nbsp; &nbsp; &nbsp; Suspended Tapes: &nbsp; &nbsp;2<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Frozen Tapes: &nbsp; &nbsp;6<br>
 &nbsp;Total Cleaning Tapes: &nbsp; 12</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">## Retentions<br>
 Expiring &lt;= &nbsp;1 &nbsp; week: &nbsp; 70<br>
 Expiring &lt;= &nbsp;2 &nbsp;weeks: &nbsp;108<br>
 Expiring &lt;= &nbsp;3 &nbsp;weeks: &nbsp;132<br>
 Expiring &lt;= &nbsp;1 &nbsp;month: &nbsp;191<br>
 Expiring &lt;= &nbsp;2 months: &nbsp;285<br>
 Expiring &lt;= &nbsp;3 months: &nbsp;286<br>
 Expiring &lt;= &nbsp;6 months: &nbsp;299<br>
 Expiring &lt;= &nbsp;1 &nbsp; year: &nbsp;314<br>
 Expiring &lt;= &nbsp;3 &nbsp;years: &nbsp;315</font>
<br><font size=2 color=blue face="Arial">The script that produces this follows. 
&nbsp;Note, this calls a little external program called 
&quot;seconds_since_epoch&quot; 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>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">#!/bin/ksh<br>
PROGNAME=`basename $0`<br>
VMQUERY=/var/tmp/$PROGNAME.$$.vmquery<br>
BPMEDIA=/var/tmp/$PROGNAME.$$.bpmedia<br>
 &nbsp; &nbsp;RET=/var/tmp/$PROGNAME.$$.ret</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">#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>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">#Retention levels<br>
bpretlevel -l | sort -n -k 2 &gt; $RET</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">#Volume database<br>
vmquery -a -w | awk 'NR&gt;3 {print}' &gt;$VMQUERY</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">#Get current unix time 
integer<br>
now=`seconds_since_epoch`</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">#Lots of counting<br>
echo &quot;\n## General Data Tape Summary&quot;<br>
awk '$3!~/CLN/ {sum++} END {printf (&quot; &nbsp;%20s: %4d\n&quot;,&quot;Total 
Data Tapes&quot;,sum)}' $VMQUERY<br>
awk '$3!~/CLN/ &amp;&amp; $8!~/-/ {sum++} END {printf (&quot; &nbsp;%20s: 
%4d\n&quot;,&quot;Total Library Tapes&quot;,sum)}' $VMQUERY<br>
awk ' { if (int($15/8)%2) {sum++}} END {printf (&quot; &nbsp;%20s: 
%4d\n&quot;,&quot;Full Tapes&quot;,sum)}' $BPMEDIA<br>
awk '$3!~/CLN/ &amp;&amp; $20 ~ /^00\/00\/00/ {sum++} END {printf (&quot; 
&nbsp;%20s: %4d\n&quot;,&quot;Empty Tapes&quot;,sum)}' $VMQUERY<br>
awk ' { if (int($15/2)%2) {sum++}} END {printf (&quot; &nbsp;%20s: 
%4d\n&quot;,&quot;Suspended Tapes&quot;,sum)}' $BPMEDIA<br>
awk ' { if (int($15)%2) &nbsp; {sum++}} END {printf (&quot; &nbsp;%20s: 
%4d\n&quot;,&quot;Frozen Tapes&quot;,sum)}' $BPMEDIA<br>
awk '$3~/CLN/ {sum++} END {printf (&quot; &nbsp;%20s: %4d\n&quot;,&quot;Total 
Cleaning Tapes&quot;,sum)}' $VMQUERY</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">echo &quot;\n## 
Retentions&quot;<br>
prev=0<br>
for retlvl in `awk '{print $1}' $RET`<br>
do<br>
 &nbsp;# count tapes in each retention level</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 color=blue face="Courier New">&nbsp; label=`awk '$1=='$retlvl' 
{if ($3~/infinit/) {print &quot;Infinity&quot;} else {print $3 &quot; &quot; 
$4}}' $RET`<br>
 &nbsp;offset=`awk '$1==&quot;'$retlvl'&quot; {print $2}' $RET`<br>
 &nbsp;count=`awk 'BEGIN {sum=0}<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{if ('$now'+'$offset'&gt;=$7) 
{sum++}}<br>
 &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;# Use awk function to get pretty print<br>
 &nbsp; &nbsp;echo &quot;$label $count&quot; | \<br>
 &nbsp; &nbsp; &nbsp;awk '{printf (&quot; Expiring &lt;= %2s %6s: 
%4d\n&quot;,$1,$2,$3)}'<br>
 &nbsp;fi<br>
 &nbsp;prev=$count<br>
done<br>
rm $BPMEDIA $RET $VMQUERY<br>
exit</font>
<br><font size=2 color=blue face="Arial">HTH -Mark</font>
<br>
<br><font size=2 face="Tahoma">-----Original Message-----<b><br>
From:</b> Fabbro, Andrew P [mailto:Fabbro.Andrew AT cnf DOT com]<b><br>
Sent:</b> Wednesday, July 09, 2003 1:37 PM<b><br>
To:</b> veritas-bu AT mailman.eng.auburn DOT edu<b><br>
Subject:</b> [Veritas-bu] How to tell when all images on a tape will expire?<br>
</font>
<p><font size=2 face="Arial">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 
&quot;these tapes will expire on these days&quot;. &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><font size=2 face="Arial">does not address the future.</font><font size=3 
face="Times New Roman"> </font>
<p><font size=2 face="Arial">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><font size=2 face="Courier New">-- <br>
 Drew Fabbro</font><font size=3 face="Times New Roman"> </font><font size=2 
face="Courier New"><br>
 Manager, Unix Systems Group (USG)</font><font size=3 face="Times New Roman"> 
</font><font size=2 face="Courier New"><br>
 fabbro.andrew AT cnf DOT com</font><font size=3 face="Times New Roman"> 
</font><font size=2 face="Courier New"><br>
 Desk: 503.450.3374</font><font size=3 face="Times New Roman"> </font><font 
size=2 face="Courier New"><br>
 Cell: 503.701.0369</font><font size=3 face="Times New Roman"> </font>
<p>
<p>
<p>
--=_alternative 007302AF86256D5F_=--

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