Netbackup Health Check Windows Unix
Netbackup Health Check Windows Unix
/bin/perl -w
use strict;
use File::Find;
use integer;
use Cwd;
my $NB_Install_Path1="C:/Program Files/VERITAS";
my $NB_Install_Path2="C:/\"Program Files\"/VERITAS";
my $Store="D:/test";
my %NB_cmd_path = (
bperror => "netbackup/bin/admincmd",volmgr => "volmgr/bin"
);
my $hostname;
my $date;
my $i=0;
my $j=0;
my $sum=0;
my $sizegb;
my $frozcnt=0;
my $errcnt=0;
my $err1cnt=0;
my $client_list;
my $client_count;
my $downdr;
my @arr;
my @line;
my @dir_path;
my @policy;
my @client;
my @data;
my @act;
my @ar;
$hostname=`hostname`;
chomp($hostname);
$date=`date`;
$date =~ m/(\d+\/\d+\/\d+)/;
chomp($date);
printf "\n";
&find(\&wanted,"$NB_Install_Path1/netbackup/db/class");
foreach(`$NB_Install_Path2/netbackup/bin/goodies/available_media`)
{
chomp;
if(/frozen$/i)
{
++$frozcnt;
}
}
print "Frozen Media on $hostname : $frozcnt\n\n";
}
print "Total Backup failures : $errcnt\n\n";
print "Incomplete Backups (Status code 1) : $err1cnt\n\n";
my @line1;
my @linearr;
my $size;
my $sum2;
my $mins;
my $newlis;
my @clie_lis;
my @line2;
my $b=0;
}
}
################################################################3
my @arr2;
my @med;
my $i2=0;
my %medhash;
my @fragar;
print "\n";
foreach(@med)
{
$medhash{$_}=$medhash{$_}/1048576;
if($medhash{$_} >= 1)
{
print " $_ : $medhash{$_} GB\n\n";
}
else
{
$medhash{$_}=$medhash{$_} * 1048576;
print " $_ : $medhash{$_} KB\n\n";
}
}
########################################################################
my $flag=0;
my $img_cnt;
my $a;
my %nobackup;
my $count=0;
my @line3;
my @line4;
my $img_cnt2;
my @ver;
my @full;
my @fullmed;
my $i3=0;
my $i4;
my @poltype;
my $i5=0;
}
else
{
`$NB_Install_Path2/netbackup/bin/admincmd/bpmedialist -p CatalogBackup > $Store/info6.txt`;
}
}
}
close F1;
foreach(`$NB_Install_Path2/netbackup/bin/goodies/available_media`)
{
chomp;
if(/FULL(|\/MPX)$/i)
{
@full = split(/\s+/,$_);
if($full[3] ne "-")
{
$fullmed[$i3]=$full[0];
++$i3;
}
}
}
# Print tapes which are full and with latest expiry date
print "\n";
print "Please find the following tapes in cap slot to be ejected (Full and with latest expiry date)\n";
print "---------------------------------------------------------------------------------------------------\n";
foreach(`$NB_Install_Path2/netbackup/bin/admincmd/bpmedialist -summary`)
{
for($i4=0;$i4<=$#fullmed;++$i4)
{
if($_ =~ m/$fullmed[$i4]/i)
{
print "$_";
}
}
}
# To List Clients whose backups are not happening from past 36 hours
print "\n";
print "Clients having no backups from past 36 hours on $hostname\n";
print "--------------------------------------------------------------------------\n";
if($flag == 0)
{
print "All clients have been backed up in last 36 hours";
}
}
}
close NEW3;
print "\n";
print "Total : $count\n";
##############################################################3
exit;
sub wanted{
if(/info/)
{
open (READ,$_) or die "Can't open $_ : $!\n";
while (<READ>)
{
chomp;
if(/^ACTIVE/i)
{
@ar=split(/\s+/,$_);
if($ar[1] == 0)
{
@dir_path = split(/(\\|\/)/,$File::Find::dir);
$policy[$i] = $dir_path[$#dir_path];
++$i;
# print "$dir_path[$#dir_path]\n";
}
else
{
if($ar[1] == 1)
{
++$j;
}
}
}
}
}
}