Here is a handy perl script you could probably hack around with to work on Windows, etc, I use that reports all existing blank tapes in the library and the tapes that are blank outside of the library in the scratch pool.
----------------------------------------------------------------
#!/usr/bin/perl -I /sysadmin/perllib
use nbu_db;
use Getopt::Long;
use strict;
use vars qw($showblanks $shuffle $result $db $volume $id %tapes @out_blank_LTO1 @out_blank_LTO2 @out_willexpire @in_willexpire @in_blank_LTO1 @in_blank_
LTO2 @pull_offsite @catalog_offsites @full_can_pull @in_blank);
my $showblanks=0;
my $shuffle=1;
my $result=GetOptions("blank"=> \$ showblanks,
"shuffle"=> \$shuffle);
my $db=nbu_db->new();
my $expiration_age_days = shift || 7;
my $expiration_age_seconds = ($expiration_age_days * 60 * 60 * 24);
my $need_blanks=0;
my @out_blank_LTO1;
my @out_blank_LTO2;
my @out_willexpire;
my @in_willexpired;
my @in_blank_LTO1;
my @in_blank_LTO2;
my @pull_offsite;
my @catalog_offsites;
foreach $id ($db->volumes())
{
$volume=$db->vol_byID($id);
if($volume->{volume_group} eq "---") # not in robot
{
if($volume->{volume_pool} eq "Scratch") #is blank
{
if($volume->{media_type} eq "HCART")
{
unshift(@out_blank_LTO1,$volume->{mediaID});
}
else
{
unshift(@out_blank_LTO2,$volume->{mediaID});
}
}
elsif($volume->{expiration_time} < (time() + $expiration_age_seconds))
{
unshift(@out_willexpire,$volume->{mediaID});
}
if($volume->{volume_pool} eq "CatalogOffsite")
{
unshift(@catalog_offsites,$volume->{mediaID});
}
}
else #in robot
{
$volume=$db->vol_byID($id);
if($volume->{robot_number} eq "0")
{
if($volume->{volume_pool} eq "Scratch") #is blank
{
if($volume->{media_type} eq "HCART")
{
unshift(@in_blank_LTO1,$volume->{mediaID});
}
else
{
unshift(@in_blank_LTO2,$volume->{mediaID});
}
}
elsif($volume->{expiration_time} < (time() + $expiration_age_seconds))
{
unshift(@in_willexpire,$volume->{mediaID});
}
if($volume->{volume_pool}=~/Offsite/)
{
unshift(@pull_offsite,$volume->{mediaID});
}
if($volume->{volume_pool} eq "CatalogOffsite")
{
unshift(@catalog_offsites,$volume->{mediaID});
}
if($volume->{status}==8 and $volume->{media_type} eq "HCART"
and $volume->{lastupdated_time} < time()-14*86400) #full for 2 weeks or more
{
unshift(@full_can_pull,$volume->{mediaID});
}
}
}
}
#sort stuff
@out_blank_LTO1=sort @out_blank_LTO1;
@out_blank_LTO2=sort @out_blank_LTO2;
@in_blank_LTO1=sort @in_blank_LTO1;
@in_blank_LTO2=sort @in_blank_LTO2;
@full_can_pull=sort byexpiry @full_can_pull;
if($showblanks==1)
{
showblanks();
exit;
}
#print scalar @in_blank_LTO1, "\tblank LTO1 tapes in library\n";
if(scalar @in_blank_LTO1 > 0)
{
print "Blank LTO1 tapes in library\n====================================\n";
print join(', ',@in_blank_LTO1),"\n\n";
}
#print scalar @in_blank_LTO2, "\tblank LTO2 tapes in library\n";
if(scalar @in_blank_LTO2 > 0)
{
print "Blank LTO2 tapes in library\n====================================\n";
print join(', ',@in_blank_LTO2),"\n\n";
}
#print scalar @out_blank_LTO1, "\tblank LTO1 tapes out of library\n";
if(scalar @out_blank_LTO1 > 0)
{
print "Blank LTO1 tapes out of library\n====================================\n";
print join(', ',@out_blank_LTO1),"\n\n";
}
#print scalar @out_blank_LTO2, "\tblank LTO2 tapes out of library\n";
if(scalar @out_blank_LTO2 > 0)
{
print "Blank LTO2 tapes out of library\n====================================\n";
print join(', ',@in_blank_LTO2),"\n\n";
}
#print scalar @full_can_pull, "\tfull tapes that can be removed from the library\n";
if(scalar @full_can_pull > 0)
{
print "Tapes that can be pulled to make room in library\n====================================\n";
print join(', ',@full_can_pull),"\n\n";
}
print scalar @pull_offsite+1," tapes being ejected for offsites\n\n";
$need_blanks=2*(scalar @catalog_offsites);
$need_blanks=$need_blanks-(scalar @in_blank)-(scalar @in_willexpire);
print "need $need_blanks more blanks in library\n";
sub byexpiry
{
$tapes{$b}{expiration_time} <=> $tapes{$a}{expiration_time};
}
sub showblanks
{
print "Blank tapes\n\nVolume ID\t\tVolume Group\n";
print "============================================\n";
foreach $id (@out_blank_LTO1,@out_blank_LTO2)
{
print "$id\t\t\t".$db->vol_byID($id)->{volume_group}."\n";
}
}
Message was edited by:
trickykid
I placed spaces between the $ and s's which were causing smilies to show up. :)Sorry, thought it was the $ and s's.. made spaces between the > and \