If you have Perl installed, and you should have if you don’t. You can try the following cmd/bat script.
I do not have a system to test it on so if there are problems, send me an email and I’ll fix it. J
=========== start script ===============
#!/usr/bin/perl
open OUT, "C:\\temp\\scratch_mail.txt" or die "Couldn't open scratch_mail.txt for output: $!\n";
print OUT "Available scratch media tapes\n";
@query_array = `G:\PROGRA~1\VERITAS\Volmgr\bin\vmquery -pn scratch -b`;
shift @query_array;
shift @query_array;
shift @query_array;
shift @query_array;
foreach $line (@query_array)
{
($d1,$d2,$d3,$d4,$d5,$d6) = split /,/, $line;
push (@new_array, $d3,$d4,$d2);
}
@new_array = sort @new_array;
@new_array = grep /none/i, @new_array;
print OUT @new_array;
if ($#new_array < 75 ) { print OUT "If above line shows less than 75 TLD notify Doug Preston immediately @ 111-111-1111 24/7 \n" }
system("nbmail.cmd nbu-reports AT it.lereta DOT com \"available scratch media\" G:\\temp\\scratch_mail.txt");
close OUT;
============ end script =====================
From: veritas-bu-bounces AT mailman.eng.auburn DOT edu [mailto:veritas-bu-bounces AT mailman.eng.auburn DOT edu] On Behalf Of Preston, Douglas
Sent: 08 March 2011 17:26
To: 'pranav batra'; 'Veritas'
Subject: Re: [Veritas-bu] batch script to check Scratch media
This will require cygwin and a GnuWin32 version gawk
echo Available scratch media tapes >G:\temp\scratch_mail.txt
G:\PROGRA~1\VERITAS\Volmgr\bin\vmquery -pn scratch -b | tail +4 | gawk '{print $3,$4,$2 }' | C:\cygwin\bin\sort -n | uniq -c | C:\cygwin\bin\grep -vi none >>G:\TEMP\scratch_mail.txt
echo If above line shows less than 75 TLD notify Doug Preston immediately @ 111-111-1111 24/7 >>G:\temp\scratch_mail.txt
nbmail.cmd nbu-reports AT it.lereta DOT com "available scratch media" G:\temp\scratch_mail.txt
output looks like this
Available scratch media tapes
328 TLD 0 HCART2
If above line shows less than 75 TLD notify Doug Preston immediately @ 111-111-1111 24/7
Doug Preston
From: veritas-bu-bounces AT mailman.eng.auburn DOT edu [mailto:veritas-bu-bounces AT mailman.eng.auburn DOT edu] On Behalf Of pranav batra
Sent: Tuesday, March 08, 2011 8:24 AM
To: Veritas
Subject: [Veritas-bu] batch script to check Scratch media
Hello Geeks,
I am looking for a batch script that can mail me the Scratch tapes in my library every day.
I know though this is not very much related to Netbackup but if anyone can help that will be much.
Our master server is 6.5.4 ,windows 2003
And I need if any script can be made to mail me the output of \program files\veritas\volmgr\bin\vmquery -rn 0 -bx |qgrep Sc.
Please help.
Pranav