Here it is. Replace the NSR_SERVER with the name of your networker server.
Shelley
#! /usr/local/bin/perl -w
#
# usage: lastwrite [ pool... ]
#
# Print the savetime of the most recent save for each tape. Output
# sorted by tape label. Useful aid in identifying tapes to be sent
# offsite or recycled.
#
# pipe into "sort +2 +1" to sort by pool, then date
# or "sort +1 +2" to sort by date, then pool
#
$NSR_SERVER = 'nickel'; # Networker server
($cmd = $0) =~ s=.*/==;
if (@ARGV) {
foreach $i (@ARGV) {
&dopool(" -q pool='$i'");
}
} else {
&dopool('');
}
sub dopool {
my $pool = $_[0];
$cmd = "mminfo -s $NSR_SERVER -av -o mt -r 'volume, savetime(17), pool'
$pool";
open(M, "$cmd |") or die "$cmd: cannot open pipe $cmd: $!\n";
%last = ();
while (<M>) {
next if /volume.*date/; # skip header
@f = split(' ', $_);
$last{$f[0]} = $f[1];
$pool{$f[0]} = join(' ', @f[3 .. $#f]); # pool names contain spaces
}
close(M);
foreach $i (sort keys %last) {
print "$i $last{$i} $pool{$i}\n";
}
print "\n";
}
# mminfo -r 'volume, savetime(17), pool'
# volume date time pool
# Q00035 05/22/02 00:05:05 NetApp Incremental
# Q00035 05/22/02 00:09:48 NetApp Incremental
# Q00035 05/22/02 00:10:43 NetApp Incremental
Can we see the script?
-----Original Message-----
From: Shelley L. Shostak [mailto:sls AT QSTECH DOT COM]
Sent: Monday, December 16, 2002 3:40 PM
Subject: Re: Media Management
On Mon, 16 Dec 2002, Charles Gagnon wrote:
> Subject: [Networker] Media Management
>
>
> All this talk of recyclable/read-only tapes reminded me how poor our
> current media management system is. We basically use the Legato Auto
> Media feature and we recycle to other Pools on most of our pools.
>
> I generates lists to try and figure out which tapes I should load
> next. I tried using tapes from:
>
> mminfo -a -r "volid,volume,%used,pool,location,volaccess,volflags" -q
> 'volrecycle,location=""'
>
> But I was always short. Than I tried:
>
> mminfo -a -r "volid,volume,%used,pool,location,volaccess,volflags" -q
> '!readonly,location=""'
>
You may be getting bit with the -a option. Too bad I remember this
option as "all", because it is not the all that I expect!
>From the mminfo man page:
-a Causes queries to apply to all complete, browsable
save sets, not just those in the last 24 hours.
This option is implied by the -c, -N, -q, -m, and
-o options, described below. When combined with a
media-only report (-m or a custom report showing
only media information), -a applies to all volumes,
not just those with complete and browsable save
sets.
Also from the man page...
The -v flag prints
aborted, purged, and incomplete save sets in addition to
the complete, browsable save sets printed by default.
I have a homemade script that gets the date of the last written saveset
and prints the volume name, date and pool, pipe into sort and you have a
list which not only helps decide when to reuse tapes, but also when to
send off site.
Shelley
--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|