Veritas-bu

[Veritas-bu] FROZEN tapes script

2005-06-21 16:09:21
Subject: [Veritas-bu] FROZEN tapes script
From: tlewick AT hrblock DOT com (Lewick, Taylor)
Date: Tue, 21 Jun 2005 15:09:21 -0500
Here is the script, I've had a number of requests so I am posting it to
the list...

Normal disclaimer about not being responsible for wrecking your life if
the scripts messes up...

Oh yeah, we are still on 4.5 FP8 but I think it works in a 5.x
environment, not sure what will happen at 6.x...

Here you go, it's a perl script and I run this from my master server. If
ssh doesn't work, change it to remsh (not good security practice, but
you are only hitting your media servers so no big deal).  

Change the names of your media servers (mine are all unix, this only
works with unix servers) in the array @media_servers...  

And you need to have the bptm logs, so in /usr/openv/netbackup/logs just
mkdir bptm and this will create the logs.

And I run this script from cron everynight at 11:59pm and email the
output to myself to get the previous 23 hours and 59 minutes of frozen
tapes...  That's it, email me with questions.

#!/opt/perl/bin/perl

$log_date=`date +%m%d%y`;
$rep_date=`date +%m/%d/%y`;

@media_servers = ("server1", "server2", "server3", "server4",
"server5");
foreach $server (@media_servers) {
open (IN, "/usr/bin/ssh $server /usr/bin/cat
/usr/openv/netbackup/logs/bptm/log.$log_date |");
  while (<IN>) {
    if (/^.*FREEZING media id\s(......),\s(.*)/) {
     $mediaID=$1;
     $freeze_reason=$2;
     $Frozen{$mediaID}{$freeze_reason}++;
     #print "$server, $mediaID, $freeze_reason\n";
    }
  }
  close (IN);
}

print "Frozen Media Report for $rep_date";

  if (scalar %Frozen) {
    foreach $mediaID (sort keys %Frozen) {
      foreach $freeze_reason (sort keys %{ $Frozen{$mediaID} }) {
        print "$mediaID, $freeze_reason\n";
      }
    }
  }
else {print "\nNo Frozen tapes found.\n";}


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