Veritas-bu

Re: [Veritas-bu] Strange question

2011-06-01 02:05:16
Subject: Re: [Veritas-bu] Strange question
From: David Stanaway <david AT stanaway DOT net>
To: veritas-bu AT mailman.eng.auburn DOT edu
Date: Wed, 01 Jun 2011 00:59:23 -0500
Here is a perl script I use on my master server for checking SLPs in the morning.

It my have some win32ism's, my master is W2K8

I would be curious to see nbstlutil list -l output for one of your images that shows as COMPLETE

I may need to rework this script.

#! /usr/bin/perl -w

use constant NBSTLUTILCMD => 'nbstlutil list -l';

my %badcopystates = (1 => "NOT_STARTED", 2=> "IN_PROGRESS", 9=>"NOT_STARTED|INACTIVE", 10=>"IN_PROGRESS|INACTIVE");

#LIST -l columns for record header I
my @STLIMAGEHEADERS = qw(Version RecordHeader Master BackupID Client BackupTime Policy CType SType SLP SLPState SLPStartTime DataClass);

#Index it for reference
my %stlimageheadersidx = ();
for (my $i=0; $i<=$#STLIMAGEHEADERS; $i++) {
    $stlimageheadersidx{$STLIMAGEHEADERS[$i]} = $i;
}

my $incompletecount = 0;
open NBSTLLISTOUT,  NBSTLUTILCMD . '|';
while(<NBSTLLISTOUT>) {
    chomp;
    my @jobinfo = split(/ /,$_);
    if ( $jobinfo[$stlimageheadersidx{RecordHeader}] eq 'I'
     && defined($badcopystates{$jobinfo[$stlimageheadersidx{SLPState}]}) ) {
    printf ("Got IMAGE: %s\n", $jobinfo[$stlimageheadersidx{BackupID}]);
    for(my $i=0;$i<=$#STLIMAGEHEADERS;$i++) {
        printf ("\t%s: %s\n",$STLIMAGEHEADERS[$i], $jobinfo[$i]);
    }
    ++$incompletecount;
    }
}
close NBSTLLISTOUT or die NBSTLUTILCMD . " completed with error $!";

if ($incompletecount > 0)  {
    print "Found $incompletecount images that were not complete.\n";
    exit 1;
} else {
    print "Found no images that were not complete.\n";
    exit 0;
}



Here is another script I was working on but got left on the cuttingroom floor.

#! /usr/bin/perl -w

use List::Util qw[min max];

use constant BPIMAGELISTCMD => 'bpimagelist -hoursago 72';

my @IMGHEADERS = qw(RecHdr client_name date1 date2 version backupid policy_name client_type proxy_client creator sched_label sched_type retention backup_time elapsed expiration compression encryption kbytes num_files copies num_fragments files_compressed files_file version name1 options primary image_type tir_info tir_expiration keywords mpx ext_security raw dump_lvl fs_only prev_BItime BIfull_time obj_desc requestID backup_stat backup_copy prev_image jobid num_resumes resume_expr ff_size pfi_type image_attrib);

my @FRAGHEADERS = qw(RecHdr copy_num frag_num KB remainder media_type density file_num id_path host block_size offset media_date dev_written f_flags media_desc_f_unused1 expiration mpx ret_level checkpoint resume_nbr media_seq_no media_subtype_unused4 ss_try_to_keep_date_unused3 copy_date_unused2 unused1);

my %imgheaderidx;
for (my $i=0; $i<=$#IMGHEADERS; $i++) {
    $imgheaderidx{$IMGHEADERS[$i]} = $i;
}

my %fragheaderidx;
for (my $i=0; $i<=$#FRAGHEADERS; $i++) {
    $fragheaderidx{$FRAGHEADERS[$i]} = $i;
}

open BPIMAGELISTOUT, BPIMAGELISTCMD.'|';

my %images;
my $currentimg;

while (<BPIMAGELISTOUT>) {
    chomp;
    my @rec = split(/ /, $_);
    if ($rec[0] eq 'IMAGE') {
    my %data;
    $data{'IMG'} = \@rec;
    $data{'FRAGS'} = [];
    $images{$rec[$imgheaderidx{backupid}]} = \%data;
    $currentimg = $rec[$imgheaderidx{backupid}];
    }
    if ($rec[0] eq 'FRAG') {
    my %data;
    push @{$images{$currentimg}->{'FRAGS'}}, \@rec;
    }
}

# Verify images conform to our expectations
# 1 - Each copy of the image has the same number of fragments
# 2 - Each fragment within a copy is on the same media ID (FALSE ASSUPTION FOR TAPE TARGET)

my $errors = 0;

foreach my $bid (keys %images) {
    my $nfrags = scalar(@{$images{$bid}->{'FRAGS'}});
    if ($nfrags > 0 ) {
    my %cpmap;
    for ( my $i=0; $i < $nfrags ; $i++ ) {
        my $frag = $images{$bid}->{'FRAGS'}->[$i];
        push @{$cpmap{$frag->[$fragheaderidx{copy_num}]}}, $frag;
    }
    my $ncopies = scalar(%cpmap);
    my $mincpy = min(keys %cpmap);
    my $nfragspercp = scalar(@{$cpmap{$mincpy}});
    foreach my $cp (sort keys %cpmap) {
        my $cpfrags = scalar(@{$cpmap{$cp}});
        my %cpmediaids;
        my $cpmedia = $cpmap{$cp}->[0]->[$fragheaderidx{id_path}];
        my $cpmediaclass = classifymedia($cpmedia);
       
        for ( my $i=0; $i < $cpfrags; $i++ ) {
        my $m = $cpmap{$cp}->[$i]->[$fragheaderidx{id_path}];
        $cpmediaids{$m}++;
        if ( ( classifymedia($m) ne $cpmediaclass )
             || ( $cpmediaclass eq 'ADVDISK' && $m ne $cpmedia ) ) {
            ++$errors;
            printf("GOT %s COPY %d FRAG %d ON %s\n",$bid, $cp,
               $cpmap{$cp}->[$i]->[$fragheaderidx{frag_num}],
               $cpmap{$cp}->[$i]->[$fragheaderidx{id_path}] );
            printf("EXPECTING %s COPY %d FRAG %d ON %s:%s\n", $bid, $cp,
               $cpmap{$cp}->[$i]->[$fragheaderidx{frag_num}],
               $cpmediaclass, $cpmedia );
        }
        }
        #print "$bid|$cp|".join(',', (keys %cpmediaids))."\n";
    }
    }
}

if ($errors == 0) {
    print "Images look OK.\n";
    exit 0;
} else {
    print "There were $errors problems found.\n";
    exit 1;
}

sub classifymedia { # scalar - mediaid
    my ($mediaid) = @_;
    my $res;
    if($mediaid =~ /^\d+$/) {
    $res = 'TAPE';
    } elsif($mediaid =~ /^@/) {
    $res = 'ADVDISK';
    } elsif($mediaid =~ /^[a-zA-Z\\\/]/) {
    $res = 'BASICDISK';
    }
    return $res;
}




On 6/1/2011 12:37 AM, David Stanaway wrote:
What kind of backups are these?

GRT backups and Synthetic backups to my knowledge result in dataloss if used with an SLP expecting the SLP to function.

On 5/31/2011 7:40 AM, Patrick wrote:

Hi All,

 

I have a strange question which may be related to my misunderstanding of how SLP works.

I ran the nbstlutil command on a particular client with the following results (many lines)

Image <client_backupid> for Lifcycle SLP is COMPLETE

               Copy to Disk is NOT_STARTED

               Copy to Tape is NOT_STARTED

 

What is confusing me is that the image for the specified backupid does not exist anywhere that I can find. Bpimagelist –backupid <client_backupid> show no entity found.

So how can the Lifecycle be complete if there are no images? The actual backup does not exist on disk. The SLP backups to disk then copies to tape, ONLY. Also this particular SLP has a retention level of infinite. L

 

Any enlightenment would be greatly appreciated.

 

Regards,

 

Patrick Whelan

VERITAS Certified NetBackup Support Engineer for UNIX.

VERITAS Certified NetBackup Support Engineer for Windows.

 

netbackup AT whelan-consulting.co DOT uk

 

 

_______________________________________________ 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

_______________________________________________
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>