Veritas-bu

Re: [Veritas-bu] bpdbjobs -all_columns

2007-07-20 10:49:13
Subject: Re: [Veritas-bu] bpdbjobs -all_columns
From: Peter Buschman <plblists AT iotk DOT com>
To: "Clooney, David" <david.clooney AT bankofamerica DOT com>, veritas-bu AT mailman.eng.auburn DOT edu
Date: Fri, 20 Jul 2007 16:31:47 +0200

This has been posted before and might need some tweaking for NBU6.  Results are returned as a hash.

Cheers'

--PLB

##
## bpdbjobs_parse()
##
## This function is derived from the following Veritas command:
##
##   /usr/openv/netbackup/bin/admincmd/bpdbjobs
##
## --PLB 12/19/2001
##
sub bpdbjobs_parse {
    my $self = shift;
    $_ = shift;
    my $tmpfile;
    chomp;
    s/'/\\'/g; # Escape any un-escaped single quotes.
    ##
    ## jobid,jobtype,state,status,class,schedule, client, server, started, elapsed,
    ## ended, stunit, try, operation, kbytes, files, pathlastwritten, percent,
    ## jobpid, owner, subtype, classtype, schedule_type, priority, group,
    ## masterserver, retentionunits, retentionperiod, compression,
    ## kbyteslastwritten, fileslastwritten, filelistcount, [files]..., trycount,
    ## [trypid, trystunit, tryserver, trystarted, tryelapsed, tryended, trystatus,
    ## trystatusdescription, trystatuscount, [trystatuslines]..., trybyteswritten,
    ## tryfileswritten]
    ##
    my(
        $jobid,
        $jobtype,
        $state,
        $status,
        $class,
        $schedule,
        $client,
        $server,
        $started,
        $elapsed,
        $ended,
        $stunit,
        $try,
        $operation,
        $kbytes,
        $files,
        $pathlastwritten,
        $percent,
        $jobpid,
        $owner,
        $subtype,
        $classtype,
        $schedule_type,
        $priority,
        $group,
        $masterserver,
        $retentionunits,
        $retentionperiod,
        $compression,
        $kbyteslastwritten,
        $fileslastwritten,
        @files_and_tries,
    ) = parse_line(",", 0, $_);
    for( $jobtype ) {
        /0/ and do { $jobtype = "backup"    ; last };
        /1/ and do { $jobtype = "archive"   ; last };
        /2/ and do { $jobtype = "restore"   ; last };
        /3/ and do { $jobtype = "verify "   ; last };
        /4/ and do { $jobtype = "duplicate" ; last };
        /5/ and do { $jobtype = "import "   ; last };
        /6/ and do { $jobtype = "db_backup" ; last };
        /7/ and do { $jobtype = "vault"     ; last };
    }
    for( $state ) {
        /0/ and do { $state = "queued"      ; last };
        /1/ and do { $state = "active"      ; last };
        /2/ and do { $state = "re-queued"   ; last };
        /3/ and do { $state = "done"        ; last };
    }
    my($filelistcount) = shift(@files_and_tries);
    my(@files);
    for(1..$filelistcount) {
        # Skip leading and trailing whitespace
        $tmpfile = shift @files_and_tries;
        $tmpfile =~ s/^\s*//;
        $tmpfile =~ s/\s*$//;
        push( @files, $tmpfile );
    }
    my($specifiedfiles) = join(", ", @files);
    my($trycount) = shift(@files_and_tries);
    my(%tries,$trynum);
    foreach $trynum (1..$trycount) {
        my($trypid)                    = shift(@files_and_tries);
        my($trystunit)                 = shift(@files_and_tries);
        my($tryserver)                 = shift(@files_and_tries);
        my($trystarted)                = shift(@files_and_tries);
        my($tryelapsed)                = shift(@files_and_tries);
        my($tryended)                  = shift(@files_and_tries);
        my($trystatus)                 = shift(@files_and_tries);
        my($trystatusdescription)      = shift(@files_and_tries);
        my($trystatuscount)            = shift(@files_and_tries);
        my(@trystatuslines);
        for(1..$trystatuscount) {
            push(@trystatuslines, shift(@files_and_tries) );
        }
        my($trystatuslines) = join("\n", @trystatuslines);
        my($trykbyteswritten)      = shift(@files_and_tries);
        my($tryfileswritten)       = shift(@files_and_tries);
        %tries = (
            %tries,
            "try_${trynum}_pid"               => "$trypid",
            "try_${trynum}_stunit"            => "$trystunit",
            "try_${trynum}_server"            => "$tryserver",
            "try_${trynum}_started"           => "$trystarted",
            "try_${trynum}_elapsed"           => "$tryelapsed",
            "try_${trynum}_ended"             => "$tryended",
            "try_${trynum}_status"            => "$trystatus",
            "try_${trynum}_statusdescription" => "$trystatusdescription",
            "try_${trynum}_statuscount"       => "$trystatuscount",
            "try_${trynum}_statuslines"       => "$trystatuslines",
            "try_${trynum}_kbyteswritten"     => "$trykbyteswritten",
            "try_${trynum}_fileswritten"      => "$tryfileswritten",
        );
    }
    my(%record) = (
        jobid             => "$jobid",
        jobtype           => "$jobtype",
        state             => "$state",
        status            => "$status",
        class             => "$class",
        schedule          => "$schedule",
        client            => "$client",
        server            => "$server",
        started           => "$started",
        elapsed           => "$elapsed",
        ended             => "$ended",
        stunit            => "$stunit",
        try               => "$try",
        operation         => "$operation",
        kbytes            => "$kbytes",
        files             => "$files",
        path              => "$pathlastwritten",
        percent           => "$percent",
        jobpid            => "$jobpid",
        owner             => "$owner",
        subtype           => "$subtype",
        classtype         => "$classtype",
        schedule_type     => "$schedule_type",
        priority          => "$priority",
        group             => "$group",
        masterserver      => "$masterserver",
        retentionunits    => "$retentionunits",
        retentionperiod   => "$retentionperiod",
        compression       => "$compression",
        kbyteslastwritten => "$kbyteslastwritten",
        fileslastwritten  => "$fileslastwritten",
        filelistcount     => "$filelistcount",
        specifiedfiles    => "$specifiedfiles",
        trycount          => "$trycount",
    );
    %record = (%record, %tries);
    return %record;
}

At 12:03 20.7.2007, Clooney, David wrote:
Content-type: multipart/alternative;
         boundary="Boundary_(ID_RxTyT46RDJ7vvz29g0KdVQ)"
Content-class: urn:content-classes:message

Hi All
 
Does anyone have some perl code, that they wouldn?t mind sharing, that chops up  bpdbjobs ?report ?all_columns, with filelist count , number of tries etc,?
 
Regards
 
Dave
 



Notice to recipient:
The information in this internet e-mail and any attachments is confidential and may be privileged. It is intended solely for the addressee. If you are not the intended addressee please notify the sender immediately by telephone. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.


When addressed to external clients any opinions or advice contained in this internet e-mail are subject to the terms and conditions expressed in any applicable governing terms of business or client engagement letter issued by the pertinent Bank of America group entity.

If this email originates from the U.K. please note that Bank of America, N.A., London Branch and Banc of America Securities Limited are authorised and regulated by the Financial Services Authority.

_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
<Prev in Thread] Current Thread [Next in Thread>