Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Tapespeed.pl

by JSchmitz (Canon)
on Mar 09, 2006 at 18:47 UTC ( #535466=sourcecode: print w/ replies, xml ) Need Help??

Category: Utility
Author/Contact Info JefferySchmitz@mac.com
Description: Shows you Netbackup Version, OS version - prints out the bp.conf settings and shows you have fast the tapes drives have written the last backups to tape.
#!/usr/bin/perl -w

$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/sbin:/usr/openv/netbackup/bin
+:/usr/openv/netbackup/bin/admincmd';
$ENV{'SHELL'} = '/bin/sh' if $ENV{'SHELL'} ne '';
$ENV{'IFS'} = '' if $ENV{'IFS'} ne '';

use Getopt::Std;
use POSIX 'uname';

(undef, $Hostname, undef, undef, undef) = uname;

($::opt_t) = ();  #avoid warning message
getopts('t:');
$::SAFile = $::opt_t;

if (! "$SAFile" ) {
        $FF = "24";
} else {
        $FF = "$SAFile";
}

print "\nINFO: Processing NetBackup logs for last $FF hours...\n\n";

# List Netbackup Master and Media servers:
#
open(XYZ,"bpgetconfig |") || die "Cannot run bpgetconfig report\n";
print "NetBackup Master/Media server:\n";
while (<XYZ>) {
        print " $_" if grep(/^SERVER |^SERVER=/, $_);
}

# List Netbackup Master and Media servers:
#
open(VVV,"< /usr/openv/netbackup/version") || die "Cannot list NetBack
+up version report\n";
print "NetBackup Version:\n";
while (<VVV>) {
        print " $_";
}

close XYZ;
close VVV;

print "\n         ImageID            MediaID  Fragment  DriveIdx      
+   Written             Speed_Written\n";
print "---------------------------------------------------------------
+-------------------------------------\n\n";

open(FROM,"bperror -hoursago $FF | awk '/begin|wrote/ && ! /awk/ {prin
+t}'|") || die "Cannot open bperror data";
while (<FROM>) {
        chomp;
        if (grep(/begin/, $_)) {
                undef $Line;
                undef $ImageID;
                undef @Image;
                undef @Frag;
                undef $DriveIndex;
                undef $Fragment;
                undef $MediaID;
                @Keyspaces = split(/,/, $_);
                @Image = split(/\s+/, $Keyspaces[0]);
                $ImageID = $Image[$NF - 1];
                @Drive = split(/\s+/, $Keyspaces[$NF - 1]);
                $DriveIndex = $Drive[$NF - 1];
                @Media = split(/\s+/, $Keyspaces[3]);
                $MediaID = $Media[4];
                @Frag = split(/\s+/, $Keyspaces[2]);
                $Fragment = $Frag[$NF - 1];
                $Line = sprintf ("%25s %8s   %5s    %5s", $ImageID, $M
+ediaID, $Fragment, $DriveIndex);
        }

        if (grep(/wrote/, $_)) {
                undef $ImageID2;
                undef $KB_Written;
                undef $Speed_Written;
                @Kspaces = split(/,/, $_);
                @Image2 = split(/\s+/, $Kspaces[0]);
                $ImageID2 = $Image2[$NF - 1];
                @Frag = split(/\s+/, $Kspaces[2]);
                $Fragment2 = $Frag[$NF - 1];
                if ("$ImageID2" == "$ImageID") {
                        if ("$Fragment2" == "$Fragment") {
                                @Written = split(/\s+/, $Kspaces[3]);
                                $KB_Written = "$Written[1] $Written[2]
+";
                                $Speed_Written = "$Written[$NF -2] $Wr
+itten[$NF - 1]";
                                $Line2 = sprintf("%-20s  %15s", $KB_Wr
+itten, $Speed_Written);
                                print "$Line         $Line2\n";
                        }
                } else {
#                       print "\n       ERROR: Missing \"begin writing
+\" line for $ImageID2\n";
                        ;
                }
        }

}

close(FROM);
exit(0);


Comment on Tapespeed.pl
Download Code

Back to Code Catacombs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://535466]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-10-23 00:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (122 votes), past polls