Showing posts with label netbackup. Show all posts
Showing posts with label netbackup. Show all posts

Tuesday, June 9, 2009

Intel SQL Modifications For Our NetBackup Backup Reporter Script

Hey There,

Well, I guess it's never to early for an update on a script (most of the times I realize I royally screwed one up occur just minutes after I officially hand it off ;)

Today's update is a follow-up to yesterday's updated NetBackup backup report script for Linux or Unix with Perl. The additions (noted in the comment section at the head of the script) include one user request (support for the Intel SQL module and the Veritas/Symantec required .bch extensioned files) and dusting away a few cobwebs.

Again, if you don't care about the script's output, click here to go straight to the script!

Improvements (I hope ;)

Added:
Support For Intel SQL and OS backups
Reporting of .bch Intel SQL script execution
Explicit close on MAIL file descriptor
Explicit return to STDOUT file descriptor before exit
Minimal signal handling to remove temp file
A bit more error checking and handling

Changed:
Job parsing rule to make exceptiong for .bch files

Modified:
Rule to determine job reporting eligibility

Downsides Noted So Far:
The script now takes about a second and a half to execute on the same system.
I still don't know if it works for everything :)

-------------

Here's some updated output, that you should expect to see (except for the errors, hopefully... ;) Again, you can skip straight to the script by clicking here!



ERROR FREE REPORT - 24 HOUR TIME SPAN - TRUNCATED WITH ELLIPSES...


-------------------
NetBackup Status Report
-----------------------------------------------
Report Span = 06/07/09 ¦ 17:31:47 through 06/08/09 ¦ 17:31:47
-----------------------------------------------


Jobs Completed Successfully!

***************************************************

Server ¦ Policy ¦ Type ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦ End Date ¦ Time - File List
***************************************************

host123 ¦ Database_Backup ¦ Default-Application-Backup ¦ 25847840 kb ¦ 14.57 min ¦ 06/07/09 ¦ 22:00:37 ¦ 06/07/09 ¦ 22:15:11
/lafjaiefal_1
***************************************************
host123 ¦ Database_Backup ¦ Default-Application-Backup ¦ 387360 kb ¦ 1.85 min ¦ 06/07/09 ¦ 22:17:10 ¦ 06/07/09 ¦ 22:19:01
/eiwoujlsdjf_1
...
***************************************************
host123-v ¦ NBU ¦ Catalog Backup ¦ 56096 kb ¦ 0.13 min ¦ 06/08/09 ¦ 01:08:52 ¦ 06/08/09 ¦ 01:09:00
***************************************************
host123-v ¦ NBU ¦ Catalog Backup ¦ 56864 kb ¦ 0.13 min ¦ 06/07/09 ¦ 22:23:15 ¦ 06/07/09 ¦ 22:23:23
***************************************************
host123-v ¦ NBU ¦ Catalog Backup ¦ 58400 kb ¦ 0.13 min ¦ 06/07/09 ¦ 19:46:09 ¦ 06/07/09 ¦ 19:46:17
***************************************************
host123-v ¦ NBU ¦ image catalog cleanup ¦ 0 kb ¦ 0.02 min ¦ 06/07/09 ¦ 22:23:25 ¦ 06/07/09 ¦ 22:23:26
***************************************************
host123-v ¦ NBU ¦ image catalog cleanup ¦ 0 kb ¦ 0.02 min ¦ 06/08/09 ¦ 01:09:01 ¦ 06/08/09 ¦ 01:09:02
***************************************************
host123-v ¦ NBU ¦ image catalog cleanup ¦ 0 kb ¦ 0.02 min ¦ 06/08/09 ¦ 13:09:02 ¦ 06/08/09 ¦ 13:09:03
***************************************************
host123-v ¦ NBU ¦ image catalog cleanup ¦ 0 kb ¦ 0.03 min ¦ 06/07/09 ¦ 19:46:18 ¦ 06/07/09 ¦ 19:46:20
***************************************************
intelsql1 ¦ INTEL_SQL ¦ Default-Application-Backup ¦ 4832 kb ¦ 0.55 min ¦ 06/07/09 ¦ 19:39:18 ¦ 06/07/09 ¦ 19:39:51
/MEMMISOIE.MSSQL7.DIKKEISKK\\EKKKDISS.db.model.~.7.001of001.20090607203913..C
...
***************************************************
intelsql1 ¦ INTEL_SQL ¦ FULL ¦ 0 kb ¦ 11.18 min ¦ 06/07/09 ¦ 19:30:00 ¦ 06/07/09 ¦ 19:41:11
nbu_sql_script.bch
***************************************************
intelsql1 ¦ INTEL_OS ¦ DAILY ¦ 1607132 kb ¦ 5.18 min ¦ 06/07/09 ¦ 19:30:00 ¦ 06/07/09 ¦ 19:35:11
ALL_LOCAL_DRIVES
***************************************************
intelsql2 ¦ INTEL_OS ¦ DAILY ¦ 2163310 kb ¦ 16.18 min ¦ 06/07/09 ¦ 19:30:00 ¦ 06/07/09 ¦ 19:46:11
ALL_LOCAL_DRIVES
***************************************************

-----------------------------------------------



REPORT WITH ERRORS IN IT - 48 HOUR TIME SPAN - TRUNCATED WITH ELLIPSES...


NetBackup Status Report
-----------------------------------------------
Report Span = 06/06/09 ¦ 17:51:26 through 06/08/09 ¦ 17:51:26
-----------------------------------------------

Jobs With Errors To Report!

***************************************************
Server ¦ Policy ¦ Type ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦ End Date ¦ Time - Error - File List
***************************************************

host456 ¦ Database_Backup ¦ warm_back ¦ 0 kb ¦ 13.90 min ¦ 06/06/09 ¦ 23:24:02 ¦ 06/06/09 ¦ 23:37:56
ERROR: the backup failed to back up the requested files!!!
/usr/local/bin/warm_backup.sh
***************************************************
host456 ¦ Database_Backup ¦ warm_back ¦ 0 kb ¦ 15.28 min ¦ 06/07/09 ¦ 23:24:09 ¦ 06/07/09 ¦ 23:39:26
ERROR: the backup failed to back up the requested files!!!
/usr/local/bin/warm_backup.sh
***************************************************

-----------------------------------------------

Jobs Completed Successfully!

***************************************************

Server ¦ Policy ¦ Type ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦ End Date ¦ Time - File List
***************************************************

host456 ¦ Database_Backup ¦ Default-Application-Backup ¦ 12589911 kb ¦ 10.77 min ¦ 06/06/09 ¦ 23:00:20 ¦ 06/06/09 ¦ 23:11:06
/fsladfjf_1_1
***************************************************
host456 ¦ Database_Backup ¦ Default-Application-Backup ¦ 12589911 kb ¦ 10.87 min ¦ 06/07/09 ¦ 23:00:14 ¦ 06/07/09 ¦ 23:11:06
/fajlfasljf_1_1
***************************************************
...
SEE ABOVE :)
***************************************************

-----------------------------------------------





Creative Commons License
bpreport.pl by Mike Golvach is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
Based on a work at linuxshellaccount.blogspot.com.
Permissions beyond the scope of this license may be available at http://linuxshellaccount.blogspot.com


#!/usr/bin/perl
#
# bpreport.pl - 2009 Mike Golvach - eggi@comcast.net
#
#bpreport.pl by Mike Golvach is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License. Based on a work at linuxshellaccount.blogspot.com. Permissions beyond the scope of this license may be available at http://linuxshellaccount.blogspot.com.
#
# 06/08/09:
# Added: Support For Intel SQL And OS backups
# Added: Reporting of 0kb .bch Intel SQL script execution
# Added: Explicit close on MAIL file descriptor
# Added: Explicit return to STDOUT file descriptor before exit
# Added: Minimal signal handling to remove temp file
# Added: A bit more error checking and handling
# Modified: Job parsing rule to make exceptiong for .bch files
# Modified: Rule to determine job reporting eligibility
#

$SIG{INT} = \&bail;

$first_tmp = $$;
$offset = $ARGV[0];

if ( -f "tmp.$first_tmp" ) {
unlink("tmp.$first_tmp")
}

if ( $#ARGV != 0 ) {
print "Usage: $0 TimeInSecondsToReportBack\n";
exit(1)
}

$sisosig = system("/usr/openv/netbackup/bin/admincmd/bpdbjobs -all_columns >>tmp.$first_tmp");

if ( $sisosig > 0 ) {
bail();
}

open(FT, "<tmp.$first_tmp");
@all_jobs = <FT>;
close(FT);

if ( -f "tmp.$first_tmp" ) {
unlink("tmp.$first_tmp")
}

$global_error_flag = 0;
$separator = "***************************************************";
$hostname=`hostname`;

foreach $job (@all_jobs) {
@file_list="";
@job = split(/,/, $job);
chomp($job[14]);
if ( $job[14] =~ /^$/ ) {
$job[14] = "0";
}
$error_flag = 0;
$report_time = $job[8];
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($job[8]);
$today = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($job[10]);
chomp($today_end = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday));
if ( $today_end =~ /12\/31\/69/ ) {
$today_end = "JOB IN PROGRESS";
}
$today_span_pre = ( $job[9] / 60 );
$today_span = sprintf("%.2f min", $today_span_pre);
$actual_time = time;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$right_now = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time-$offset);
$back_then = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday);
report_span($report_time, $actual_time, $offset);
next if $dont_report;
if ( $job[3] > 1 ) {
@error_condition = `/usr/openv/netbackup/bin/admincmd/bperror -S $job[3]`;
chomp($error_condition = $error_condition[0]);
$job[3] = $error_condition;
$error_flag = 1;
$global_error_flag = 1;
}
### next if ( $job[6] eq "backuphost" && $job[14] == 0 && ! $error_flag );
next if ( $job[6] eq "backuphost" && ! $error_flag );
$job[$file_list] = $job[31] if ( $job[4] =~ /Intel_SQL/ && $job[5] =~ /FULL/ );
$file_list=32;
$file_list_still_going = 1;
$just_starting = 1;
while ($file_list_still_going) {
if ( ( $job[$file_list] =~ /(\/¦\\¦ALL)/ ) ¦¦ ( $job[4] =~ /Intel_SQL/ & $job[$file_list] =~ /\.bch/ ) ) {
if ( $just_starting ) {
push(@file_list, "$job[$file_list] ");
$file_list++;
$just_starting = 0;
} else {
push(@file_list, "¦ $job[$file_list] ");
$file_list++;
}
} else {
$file_list_still_going = 0;
}
}
if ( ! $job[5] && ! $job[6] ) {
if ( $job[42] =~ /^.*(image catalog cleanup).*$/ ) {
$job[6] = $job[25];
$job[5] = $job[42];
$job[5] =~ s/^.*(image catalog cleanup).*$/$1/;
$job[4] = "NBU";
} else {
$job[5] = "Server UNKNOWN";
$job[4] = "NBU";
}
} elsif ( ! $job[5] && $job[6] ) {
if ( $job[42] =~ /^.*(Catalog Backup).*$/ ) {
$job[6] = $job[25];
$job[5] = $job[42];
$job[5] =~ s/^.*(Catalog Backup).*$/$1/;
$job[4] = "NBU";
} else {
$job[5] = "Policy UNKNOWN";
$job[4] = "NBU";
}
}
if ( $#file_list == 0 ) {
push(@job_successes, "$job[6] ¦ $job[4] ¦ $job[5] ¦ $job[14] kb ¦ $today_span ¦ $today ¦ $today_end\n$separator\n");
} elsif ( $error_flag ) {
push(@job_errors, "$job[6] ¦ $job[4] ¦ $job[5] ¦ $job[14] kb ¦ $today_span ¦ $today ¦ $today_end\nERROR: ${error_condition}!!!\n@{file_list}\n$separator\n");
} else {
push(@job_successes, "$job[6] ¦ $job[4] ¦ $job[5] ¦ $job[14] kb ¦ $today_span ¦ $today ¦ $today_end\n@file_list\n$separator\n");
}
}

$¦=1;

## Don't send out okay mails if everything is fine)
#if ( @job_errors ) {

open(MAIL, "¦/usr/lib/sendmail -t");
select(MAIL);
if ( ( $#job_errors < 0 )&& ( $#job_successes < 0 ) ) {
print "Subject: NO JOBS: $hostname NetBackup Status Report - $right_now\n";
} elsif ( @job_errors ) {
print "Subject: ERRORS: $hostname NetBackup Status Report - $right_now\n";
} else {
print "Subject: ALL OK: $hostname NetBackup Status Report - $right_now\n";
}
print "From: them\@xyz.com\n";
print "Reply-To: us\@xyz.com\n";
print "To: us\@xyz.com\n";
print "\n\n";
print "NetBackup Status Report\n";
print "-----------------------------------------------\n";
print "Report Span = $back_then through $right_now\n";
print "-----------------------------------------------\n";
print "\n";
if ( ( $#job_errors < 0 )&& ( $#job_successes < 0 ) ) {
print "No Activity To Report! Check If NetBackup Is Running!\n";
print "-----------------------------------------------\n";
} else {
if ( @job_errors ) {
print "Jobs With Errors To Report!\n\n$separator\n";
print "Server ¦ Policy ¦ Type ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦ End Date ¦ Time - Error - File List\n";
print "$separator\n\n";
@job_errors = sort @job_errors;
$job_error_count = @job_errors;
if ( $job_error_count ) {
print "@job_errors\n";
} else {
print "NO ERRORS TO REPORT. REPORT MAY BE IN ERROR!!!\n\n"
}
print "-----------------------------------------------\n";
}
if ( @job_successes ) {
print "\nJobs Completed Successfully!\n\n$separator\n\n";
print "Server ¦ Policy ¦ Type ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦ End Date ¦ Time - File List\n";
print "$separator\n\n";
@job_successes = sort @job_successes;
print "@job_successes\n";
print "-----------------------------------------------\n";
}
}
select(STDOUT);
close(MAIL);
#} # End of possibly-no-mail section
exit(0);

sub parse_date {

my ($sec,$min,$hour,$mday,$mon,$year,$wday) = @_;
%months = qw(0 Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec);
%weekdays = qw(0 Sun 1 Mon 2 Tue 3 Wed 4 Thu 5 Fri 6 Sat);
if ( $sec < 10 ) {
$sec = "0" . $sec;
}
if ( $min < 10 ) {
$min = "0" . $min;
}
if ( $hour < 10 ) {
$hour = "0" . $hour;
}
if ( $mday < 10 ) {
$mday = "0" . $mday;
}
if ( $yday < 10 ) {
$yday = "0" . $yday;
}
$mon = $mon + 1;
if ( $mon < 10 ) {
$mon = "0" . $mon;
}
$wday = $weekdays{$wday};
$year = 1900 + $year;
$year =~ s/^..(.*)$/$1/;
$nice_date = "${mon}/${mday}/$year ¦ ${hour}:${min}:$sec";
}

sub report_span {

my ($report_time,$actual_time,$offset) = @_;
$dont_report = 0;
$more_than_offset_hours_old = $actual_time - $report_time;
if ( $more_than_offset_hours_old > $offset ) {
$dont_report = 1;
}
}

sub bail {

print "BAILING\n";
if ( -f "tmp.$first_tmp" ) {
unlink("tmp.$first_tmp")
}
exit(2);
}




, Mike




Banner for College Student-Oriented Sites (728 version 1)





Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, June 8, 2009

NetBackup Backup Report Script

Hey there,

Today we've got an update that's been a while in the coming (mostly because no one ever requested it ;). Back in December of 2007, we put out a Perl script to report on NetBackup backup activity and, today, it's finally being updated.

But first, a few notes:

NOTE: If you don't care about what got updated or seeing any usage statistics and information, the script is tacked on to the end of this post and you can jump to it by clicking here.

VERY SPECIAL NOTE: This script's update has only been tested on Solaris (7,8,9,10) with the regular NetBackup backup and Oracle modules. If anyone runs this against another module (for Windows backups or any other module NetBackup has available) and it doesn't work, please send me (via the email link at the upper right of the page) your /usr/openv/netbackup/bin/admincmd/bpdbjobs -all_columns output (The location of your bpdbjobs binary may differ) for a successful job and a failed one. I'll be happy to update this script to include support for them. Of course, if you do send me that output, please alter any information that may be proprietary and get you in trouble! I promise not to do anything with it, but it's best to play it safe.

Some of the changes incorporated in this update include a check for "Catalog Backup" and "Backup Image Cleanup" jobs as well as checks to make the output more easily and quickly viewable. For instance, in the original script, no status was actually put in the Subject line. In this version, you'll get a status summary ("NO JOBS," "ALL OK" or "ERRORS") as well as the name of the server the report was generated on. Then you can just delete all the email reports you get that report that everything's fine (according to the reporter - Now, I've officially used that word enough to match my keywords. Let's just pray I don't have to use it again ;). And (since it was simple to do and not all of you may need to keep evidence that all was well at one point ;) we added a small - commented out for now - outer loop so you can remove those comments and have the script "only" mail you if there are errors to report(argh!).

Click on the picture below and maybe you'll be able to read those poorly doctored Subject lines ;)

My loyal Subjects

The script is, again, very simple to use. All you need to do is run it from the command line and let it know how far back you want to go for your reporting (Generally, putting this in cron to run once a day and setting the command line offset to 86400 is good enough). Of course, the script can only report (I've stopped counting, now ;) as far back as "bpdbjobs" is set to remember! If you forget how to use it, and don't want to read the first 10 or 15 lines of it, just run it without any arguments and you'll get a "Usage" message.

host # ./bpreport.pl
Usage: ./bpreport.pl TimeInSecondsToReportBack


The output generally looks like the output below and, under moderate load on a system that only does its own backups, it runs in under a second for a day's worth of information (again, this timing would be affected by how much activity is logged on your server in the time span you specify on the command line)

Click the picture below and maybe something really cool will happen... probably not. Most likely the picture will just get larger again ;)

Put out output

Below are some sample report outputs from the three types of reports shown in the "Subjects" picture from way up above, and the command line output directly above. After that, it's the script and we're out, baby ;)

Cheers,

P.S. Please forgive the exclamation marks. Typing in all caps is just so very exciting ;)

Click here to get directly to the script!



SAMPLE EMAIL REPORT WITH ERRORED JOBS - 24 HOUR SPAN!


NetBackup Status Report
-----------------------------------------------
Report Span = 06/06/09 ¦ 13:46:15 through 06/07/09 ¦ 13:46:15
-----------------------------------------------

Jobs With Errors To Report!

***************************************************
Server ¦ Policy ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦End Date ¦ Time - Error - File List
***************************************************

host123 ¦ warm_backup ¦ 0 kb ¦ 13.90 min ¦ 06/06/09 ¦ 23:24:02 ¦ 06/06/09 ¦ 23:37:56
ERROR: the backup failed to back up the requested files!!!
/usr/local/bin/mybackup.sh
***************************************************

-----------------------------------------------

Jobs Completed Successfully!

***************************************************

Server ¦ Policy ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦End Date ¦ Time - File List
***************************************************

host123 ¦ Catalog Backup ¦ 209056 kb ¦ 0.25 min ¦ 06/07/09 ¦ 02:04:35 ¦ 06/07/09 ¦ 02:04:50
***************************************************
host123 ¦ Catalog Backup ¦ 211872 kb ¦ 0.23 min ¦ 06/06/09 ¦ 23:37:52 ¦ 06/06/09 ¦ 23:38:06
***************************************************
host123 ¦ Default-Backup-Policy ¦ 12589911 kb ¦ 10.77 min ¦ 06/06/09 ¦ 23:00:20 ¦ 06/06/09 ¦ 23:11:06
/abcdef_1
***************************************************
host123 ¦ Default-Backup-Policy ¦ 12589911 kb ¦ 11.45 min ¦ 06/06/09 ¦ 23:24:09 ¦ 06/06/09 ¦ 23:35:36
/ghijkl_1
***************************************************
host123 ¦ Default-Backup-Policy ¦ 240761 kb ¦ 0.92 min ¦ 06/06/09 ¦ 23:12:31 ¦ 06/06/09 ¦ 23:13:26
/mnopqr_1
***************************************************
host123 ¦ Default-Backup-Policy ¦ 2759769 kb ¦ 3.77 min ¦ 06/06/09 ¦ 23:00:20 ¦ 06/06/09 ¦ 23:04:06
/stuvwxyz_1
***************************************************
host123 ¦ Default-Backup-Policy ¦ 2759769 kb ¦ 4.28 min ¦ 06/06/09 ¦ 23:24:09 ¦ 06/06/09 ¦ 23:28:26
/abcdef_2
***************************************************
host123 ¦ Default-Backup-Policy ¦ 548 kb ¦ 0.62 min ¦ 06/06/09 ¦ 23:36:49 ¦ 06/06/09 ¦ 23:37:26
/ghijkl_2
***************************************************
host123 ¦ Default-Backup-Policy ¦ 6640326 kb ¦ 8.43 min ¦ 06/06/09 ¦ 23:00:20 ¦ 06/06/09 ¦ 23:08:46
/mnopqr_2
***************************************************
host123 ¦ Default-Backup-Policy ¦ 6640326 kb ¦ 9.12 min ¦ 06/06/09 ¦ 23:24:09 ¦ 06/06/09 ¦ 23:33:16
/stuvwxyz_2
***************************************************
host123 ¦ Default-Backup-Policy ¦ 8547 kb ¦ 0.63 min ¦ 06/06/09 ¦ 23:11:28 ¦ 06/06/09 ¦ 23:12:06
/abcdefghijklm_3
***************************************************
host123 ¦ Default-Backup-Policy ¦ 8547 kb ¦ 0.63 min ¦ 06/06/09 ¦ 23:35:48 ¦ 06/06/09 ¦ 23:36:26
/nopqrstuvwxyz_3
***************************************************
host123 ¦ image catalog cleanup ¦ 0 kb ¦ 0.02 min ¦ 06/06/09 ¦ 15:19:14 ¦ 06/06/09 ¦ 15:19:15
***************************************************
host123 ¦ image catalog cleanup ¦ 0 kb ¦ 0.02 min ¦ 06/06/09 ¦ 23:38:08 ¦ 06/06/09 ¦ 23:38:09
***************************************************
host123 ¦ image catalog cleanup ¦ 0 kb ¦ 0.02 min ¦ 06/07/09 ¦ 02:04:51 ¦ 06/07/09 ¦ 02:04:52
***************************************************
host123-p ¦ Diff-Inc ¦ 3070549 kb ¦ 4.60 min ¦ 06/07/09 ¦ 02:00:00 ¦ 06/07/09 ¦ 02:04:36
/
***************************************************
host123-s ¦ Diff-Inc ¦ 359900 kb ¦ 1.77 min ¦ 06/07/09 ¦ 02:00:00 ¦ 06/07/09 ¦ 02:01:46
/
***************************************************

-----------------------------------------------



SAMPLE EMAIL REPORT WITH NO ERRORED JOBS - 12 HOUR SPAN!


NetBackup Status Report
-----------------------------------------------
Report Span = 06/07/09 ¦ 01:46:22 through 06/07/09 ¦ 13:46:22
-----------------------------------------------


Jobs Completed Successfully!

***************************************************

Server ¦ Policy ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦End Date ¦ Time - File List
***************************************************

host123 ¦ Catalog Backup ¦ 209056 kb ¦ 0.25 min ¦ 06/07/09 ¦ 02:04:35 ¦ 06/07/09 ¦ 02:04:50
***************************************************
host123 ¦ image catalog cleanup ¦ 0 kb ¦ 0.02 min ¦ 06/07/09 ¦ 02:04:51 ¦ 06/07/09 ¦ 02:04:52
***************************************************
host123-p ¦ Diff-Inc ¦ 3070549 kb ¦ 4.60 min ¦ 06/07/09 ¦ 02:00:00 ¦ 06/07/09 ¦ 02:04:36
/
***************************************************
host123-s ¦ Diff-Inc ¦ 359900 kb ¦ 1.77 min ¦ 06/07/09 ¦ 02:00:00 ¦ 06/07/09 ¦ 02:01:46
/
***************************************************

-----------------------------------------------



SAMPLE EMAIL REPORT WITH NO JOBS AT ALL - 6 HOUR SPAN!


NetBackup Status Report
-----------------------------------------------
Report Span = 06/07/09 ¦ 07:46:49 through 06/07/09 ¦ 13:46:49
-----------------------------------------------

No Activity To Report! Check If NetBackup Is Running!
-----------------------------------------------





Creative Commons License
bpreport.pl by Mike Golvach is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
Based on a work at linuxshellaccount.blogspot.com.
Permissions beyond the scope of this license may be available at http://linuxshellaccount.blogspot.com.

#!/usr/bin/perl
#
# bpreport.pl - 2009 Mike Golvach - eggi@comcast.net
#
#bpreport.pl by Mike Golvach is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License. Based on a work at linuxshellaccount.blogspot.com. Permissions beyond the scope of this license may be available at http://linuxshellaccount.blogspot.com.
#

$first_tmp = $$;
$offset = $ARGV[0];

if ( -f "tmp.$first_tmp" ) {
unlink("tmp.$first_tmp")
}

if ( $#ARGV != 0 ) {
print "Usage: $0 TimeInSecondsToReportBack\n";
exit(1)
}

system("/usr/openv/netbackup/bin/admincmd/bpdbjobs -all_columns >>tmp.$first_tmp");

open(FT, "<tmp.$first_tmp");
@all_jobs = <FT>;
close(FT);

if ( -f "tmp.$first_tmp" ) {
unlink("tmp.$first_tmp")
}

$global_error_flag = 0;
$separator = "***************************************************";
$hostname=`hostname`;

foreach $job (@all_jobs) {
@file_list="";
@job = split(/,/, $job);
chomp($job[14]);
if ( $job[14] =~ /^$/ ) {
$job[14] = "0";
}
$error_flag = 0;
$report_time = $job[8];
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($job[8]);
$today = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($job[10]);
chomp($today_end = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday));
if ( $today_end =~ /12\/31\/69/ ) {
$today_end = "JOB IN PROGRESS";
}
$today_span_pre = ( $job[9] / 60 );
$today_span = sprintf("%.2f min", $today_span_pre);
$actual_time = time;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$right_now = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time-$offset);
$back_then = parse_date($sec,$min,$hour,$mday,$mon,$year,$wday);
report_span($report_time, $actual_time, $offset);
next if $dont_report;
if ( $job[3] > 1 ) {
@error_condition = `/usr/openv/netbackup/bin/admincmd/bperror -S $job[3]`;
chomp($error_condition = $error_condition[0]);
$job[3] = $error_condition;
$error_flag = 1;
$global_error_flag = 1;
}
next if ( $job[6] eq "backuphost" && $job[14] == 0 && ! $error_flag );
$file_list=32;
$file_list_still_going = 1;
$just_starting = 1;
while ($file_list_still_going) {
if ( $job[$file_list] =~ /(\/¦\\¦ALL)/ ) {
if ( $just_starting ) {
push(@file_list, "$job[$file_list] ");
$file_list++;
$just_starting = 0;
} else {
push(@file_list, "¦ $job[$file_list] ");
$file_list++;
}
} else {
$file_list_still_going = 0;
}
}
if ( ! $job[5] && ! $job[6] ) {
if ( $job[42] =~ /^.*(image catalog cleanup).*$/ ) {
$job[6] = $job[25];
$job[5] = $job[42];
$job[5] =~ s/^.*(image catalog cleanup).*$/$1/;
} else {
$job[5] = "Server UNKNOWN";
}
} elsif ( ! $job[5] && $job[6] ) {
if ( $job[42] =~ /^.*(Catalog Backup).*$/ ) {
$job[6] = $job[25];
$job[5] = $job[42];
$job[5] =~ s/^.*(Catalog Backup).*$/$1/;
} else {
$job[5] = "Policy UNKNOWN";
}
}
if ( $#file_list == 0 ) {
push(@job_successes, "$job[6] ¦ $job[5] ¦ $job[14] kb ¦ $today_span ¦ $today ¦ $today_end\n$separator\n");
} elsif ( $error_flag ) {
push(@job_errors, "$job[6] ¦ $job[5] ¦ $job[14] kb ¦ $today_span ¦ $today ¦ $today_end\nERROR: ${error_condition}!!!\n@{file_list}\n$separator\n");
} else {
push(@job_successes, "$job[6] ¦ $job[5] ¦ $job[14] kb ¦ $today_span ¦ $today ¦ $today_end\n@file_list\n$separator\n");
}
}

$¦=1;

## Don't send out okay mails if everything is fine)
#if ( @job_errors ) {

open(MAIL, "¦/usr/lib/sendmail -t");
select(MAIL);
if ( ( $#job_errors < 0 )&& ( $#job_successes < 0 ) ) {
print "Subject: NO JOBS: $hostname NetBackup Status Report - $right_now\n";
} elsif ( @job_errors ) {
print "Subject: ERRORS: $hostname NetBackup Status Report - $right_now\n";
} else {
print "Subject: ALL OK: $hostname NetBackup Status Report - $right_now\n";
}
print "From: root\@yourcompany.com\n";
print "Reply-To: you\@yourcompany.com\n";
print "To: you\@yourcompany.com\n";
print "\n\n";
print "NetBackup Status Report\n";
print "-----------------------------------------------\n";
print "Report Span = $back_then through $right_now\n";
print "-----------------------------------------------\n";
print "\n";
if ( ( $#job_errors < 0 )&& ( $#job_successes < 0 ) ) {
print "No Activity To Report! Check If NetBackup Is Running!\n";
print "-----------------------------------------------\n";
} else {
if ( @job_errors ) {
print "Jobs With Errors To Report!\n\n$separator\n";
print "Server ¦ Policy ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦End Date ¦ Time - Error - File List\n";
print "$separator\n\n";
@job_errors = sort @job_errors;
$job_error_count = @job_errors;
if ( $job_error_count ) {
print "@job_errors\n";
} else {
print "NO ERRORS TO REPORT. REPORT MAY BE IN ERROR!!!\n\n"
}
print "-----------------------------------------------\n";
}
if ( @job_successes ) {
print "\nJobs Completed Successfully!\n\n$separator\n\n";
print "Server ¦ Policy ¦ Kb ¦ Min Elapsed ¦ Start Date ¦ Time ¦End Date ¦ Time - File List\n";
print "$separator\n\n";
@job_successes = sort @job_successes;
print "@job_successes\n";
print "-----------------------------------------------\n";
}
}
#} # End of possibly-no-mail section

sub parse_date {

my ($sec,$min,$hour,$mday,$mon,$year,$wday) = @_;
%months = qw(0 Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec);
%weekdays = qw(0 Sun 1 Mon 2 Tue 3 Wed 4 Thu 5 Fri 6 Sat);
if ( $sec < 10 ) {
$sec = "0" . $sec;
}
if ( $min < 10 ) {
$min = "0" . $min;
}
if ( $hour < 10 ) {
$hour = "0" . $hour;
}
if ( $mday < 10 ) {
$mday = "0" . $mday;
}
if ( $yday < 10 ) {
$yday = "0" . $yday;
}
$mon = $mon + 1;
if ( $mon < 10 ) {
$mon = "0" . $mon;
}
$wday = $weekdays{$wday};
$year = 1900 + $year;
$year =~ s/^..(.*)$/$1/;
$nice_date = "${mon}/${mday}/$year ¦ ${hour}:${min}:$sec";
}

sub report_span {

my ($report_time,$actual_time,$offset) = @_;
$dont_report = 0;
$more_than_offset_hours_old = $actual_time - $report_time;
if ( $more_than_offset_hours_old > $offset ) {
$dont_report = 1;
}
}


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Wednesday, June 3, 2009

Troubleshooting NetBackup Error 6 Failures More Easily

Hey there,

Here's another one for all the NetBackup aficionados out there (in a long list of posts, including our last one on solving NetBackup issues through sheer exhaustion.

This post probably won't be interesting unless you're having this problem or have had it in the past. Also, if you're a woman who is, or may become, pregnant (which I alwasy figured was a polite of saying "not barren"), reading this post may result in a rare but fatal side effect ;) ...Sorry, but I just love pharmaceutical disclaimers in advertising these days. Some guy who's got a severe rash, the sweats, heart palpitations, sudden uncontrollable flatulence, nausea, dizziness and vertigo is actually happy to take on all those side-effects just so he won't get the sniffles anymore. I'm not that positive. I'll deal with my allergies if it means I don't have to wear a colostomy bag ;)

Anyway, on to the meat of the post:

This has probably happened to most folks who've had to set up one of many aspects of NetBackup (new tape drives, new tape robots, new policies, new backup clients, etc). It's the dreaded "Error (6)" which Veritas/Symantec describes as:

host # /usr/openv/netbackup/bin/admincmd/bperror -S 6
the backup failed to back up the requested files
Errors caused the user backup to fail.


This is a perfectly reasonable error message and is probably true for every backup you've ever had that didn't work ;) And, for that very same reason, it can be a headache. Luckily NetBackup is good enough to provide other, more specific, error messages (in the hundreds) to make sure this error generally only applies to fairly specific situations.

You can check out this Veritas Support Page for NetBackup Error 6 that's a good starting point. It covers a bit of what we'll cover here and was actually helpful in nudging me in the right direction on this occasion.

If you ever do get stuck with that error, here's a pretty good way to resolve your issue (no matter what type of policy you're using - Standard, Oracle, etc):

NOTE: All examples are from Solaris 10. While the file locations on most Linux and Unix distro's are exactly the same, things may not be where my examples show they are (...another disclaimer ;)

1. Turn on verbose logging right off the bat. You can start out with specific logging, if you're pretty sure you know what the issue is, but, assuming you're totally lost, you may as well get all the information you can from NetBackup. You can turn off the logging as soon as you've figured out what's wrong and fixed it, by simply undoing what you do in this step:

a. Create the following log directories (some are not in the provided "mklogdir" script to create logging directories) in your NetBackup directory (/usr/openv/netbackup):

host # cd /usr/openv/netbackup
host # mkdir admin bpcompatd bpjava-msvc bpsynth symlogs bpbrm bpdbm bpjava-susvc bptm user_ops bpbrmds bpdm bpjobd vnetd bpcd bphdb bprd vopied


b. Then add the following line to your bp.conf file (no restart of NetBackup is necessary for these changes in logging to take effect):

host # echo "VERBOSE = 1" >>/usr/openv/netbackup/bp.conf

2. Now, kick off the job that's constantly failing with the 6 error (do it via the GUI or using bpadm selecting m, browsing to the policy you need to backup, and then typing i to initiate the manual backup)

3. Once everything fails, you'll have some reading to do. For our purposes we'll assume that your backup policy kicks off a script to run some RMAN backups for Oracle (why not?). The first place to look is in /usr/openv/netbackup/logs/bpcd, and read the log with today's date tagged on the end (probably the only log if you just created these dirs, but maybe not). It's also sometimes easier to just tail this file while you kick off your backup:

NOTE: This output is from one job that fails immediately with error 6. It seems like a lot of nonsense and (in most circumstances) you really don't "need" to pay attention to it all. For instance, if you're getting an error 6, you don't have to worry about the server name comparison, generally, since there are several other error codes that deal with that. For all of its bluster, the only thing we really care about, with regards to error 6 (assuming it's not a canard) is the last line (in italics)

host # cd /usr/openv/netbackup/logs/bpcd
host # tail -100 `ls -1tr|tail -1`
16:47:11.062 [3213] <2> bpcd main: offset to GMT 18000
16:47:11.062 [3213] <2> logconnections: BPCD ACCEPT FROM 10.99.99.216.37567 TO 10.99.99.123.13724
16:47:11.062 [3213] <2> bpcd main: setup_sockopts complete
16:47:11.063 [3213] <2> bpcd peer_hostname: Connection from host vhost1 (10.99.99.216) port 37567
16:47:11.063 [3213] <2> bpcd valid_server: comparing vhost1 and vhost1
16:47:11.064 [3213] <4> bpcd valid_server: hostname comparison succeeded
16:47:11.064 [3213] <2> bpcd main: output socket port number = 1
16:47:11.076 [3213] <2> bpcd main: Duplicated vnetd socket on stderr
16:47:11.076 [3213] <2> bpcd main: <---- NetBackup 6.5 0 ------------initiated
16:47:11.076 [3213] <2> bpcd main: VERBOSE = 0
16:47:11.076 [3213] <2> bpcd main: Not using VxSS authentication with vhost1
16:47:11.078 [3213] <2> bpcd main: BPCD_FORK_CMD_RQST
16:47:11.078 [3213] <2> bpcd main: fork cmd = /usr/openv/netbackup/bin/bptm bptm -unload -dn Drive001 -dp /dev/rmt/0cbn -dk 2000027 -m C03426 -mk 4000033 -mds 8 -alocid 34 -jobid -1243881659 -jm
16:47:11.078 [3213] <2> bpcd main: filter type = -1
16:47:11.078 [3213] <2> bpcd main: backuptime before fork = 0
16:47:11.080 [3213] <2> bpcd exit_bpcd: exit status 0 ----------->exiting
16:47:11.082 [3215] <2> bpcd main: Converting args string into an argv
16:47:11.083 [3215] <2> bpcd main: Done converting args string into an argv
16:47:11.083 [3215] <2> bpcd main: child_args[0] = /usr/openv/netbackup/bin/bptm
16:47:11.083 [3215] <2> bpcd main: child_args[1] = bptm
16:47:11.083 [3215] <2> bpcd main: child_args[2] = -unload
16:47:11.083 [3215] <2> bpcd main: child_args[3] = -dn
16:47:11.083 [3215] <2> bpcd main: child_args[4] = Drive001
16:47:11.083 [3215] <2> bpcd main: child_args[5] = -dp
16:47:11.083 [3215] <2> bpcd main: child_args[6] = /dev/rmt/0cbn
16:47:11.083 [3215] <2> bpcd main: child_args[7] = -dk
16:47:11.083 [3215] <2> bpcd main: child_args[8] = 2000027
16:47:11.083 [3215] <2> bpcd main: child_args[9] = -m
16:47:11.083 [3215] <2> bpcd main: child_args[10] = C03426
16:47:11.083 [3215] <2> bpcd main: child_args[11] = -mk
16:47:11.083 [3215] <2> bpcd main: child_args[12] = 4000033
16:47:11.083 [3215] <2> bpcd main: child_args[13] = -mds
16:47:11.083 [3215] <2> bpcd main: child_args[14] = 8
16:47:11.083 [3215] <2> bpcd main: child_args[15] = -alocid
16:47:11.083 [3215] <2> bpcd main: child_args[16] = 34
16:47:11.083 [3215] <2> bpcd main: child_args[17] = -jobid
16:47:11.083 [3215] <2> bpcd main: child_args[18] = -1243881659
16:47:11.083 [3215] <2> bpcd main: child_args[19] = -jm
16:47:11.083 [3215] <2> bpcd main: Before execvp of command


The "Before execvp of command" line that ends the output usually means that your NetBackup command either ran out of time before it started (not likely, but maybe depending upon your setup - different systems in different time zones might cause this error, or very very very slooow machines) or that it failed to execute because one of the files in the policy doesn't exist. There are plenty of other reasons this could happen, but the latter reason, above, is generally it.

4. Once you've determined that your policy is trying to back up a file that either doesn't exist (or it doesn't have permission to access), the next step is to determine what that file is. The "bphpd" directory we created before will give you very specific information with regards to this as long as you have VERBOSE logging enabled and have created the directory yourself (it doesn't get created by the "mklogdir" script). If you've just created the directory and run your job, there will be three files present (one for stdout, one for stderr and one for both. I always use the one with both - log.060209 in this instance):

host # cd /usr/openv/netbackup/logs/bphpd
host # ls
log.060209 obk_stderr.060209 obk_stdout.060209


Checking out this log can bring you to a resolution very quickly. For instance, in the example for today, our policy was attempting to run an Oracle script (that may very well have had problems itself - you'd go looking at that to make sure it worked at all if you couldn't find the problem in here) that had been entered into the policy with an incorrect name (Doh!):

host # cat log.060209
14:53:38.341 [11086] **LOCALE ERROR** locale not found in file
14:53:38.342 [11086] <2> logparams: -sb -rdbms oracle -S host1 -to 300 -c ORACLE_HOT_BACKUP -s piping_hot_backup -clnt vhost1 -FULL -kl 28 -b vhost1_1243968817 -jobid 135 -shm
14:53:38.342 [11086] <4> bphdb main: INF - setenv NB_ORA_POLICY=ORACLE_HOT_BACKUP
14:53:38.342 [11086] <4> bphdb main: INF - setenv NB_ORA_CLIENT=vhost1
14:53:38.342 [11086] <4> bphdb main: INF - setenv NB_ORA_MODE=B
14:53:38.342 [11086] <4> bphdb main: INF - NB_ORA_POLICY=ORACLE_HOT_BACKUP
14:53:38.342 [11086] <4> bphdb main: INF - NB_ORA_SCHED not defined.
14:53:38.342 [11086] <4> bphdb main: INF - NB_ORA_PC_SCHED=piping_hot_backup
14:53:38.342 [11086] <4> bphdb main: INF - NB_ORA_SERV=host1
14:53:38.342 [11086] <4> bphdb main: INF - NB_ORA_PC_BTYPE not set
14:53:38.342 [11086] <4> bphdb main: INF - setenv NB_ORA_FULL=1
14:53:38.342 [11086] <4> bphdb main: INF - setenv NB_ORA_INCR=0
14:53:38.343 [11086] <4> bphdb main: INF - setenv NB_ORA_CINC=0
14:53:38.343 [11086] <4> bphdb main: INF - setenv NB_ORA_SCHEDULED=1
14:53:38.343 [11086] <4> bphdb sync_server: INF - BACKUP START
14:53:38.343 [11086] <4> bphdb sync_server: INF - CONTINUE BACKUP message received.
14:53:38.343 [11086] <2> bphdb get_filelist: INF - Read filename:
14:53:38.343 [11086] <2> bphdb get_filelist: INF - Read filename:
14:53:38.343 [11086] <4> bphdb do_backup: INF - Processing /usr/local/bin/oraback.sh
14:53:38.345 [11086] <4> bphdb keepalive_timeout: INF - bphdb still working.
14:53:38.345 [11086] <2> bphdb keepalive_timeout: INF - bphdb- Sending a keepalive.
14:53:38.345 [11086] <4> bphdb do_backup: INF - Keepalives will be sent every 150 seconds.
14:53:38.345 [11086] <4> bphdb do_backup: INF - Waiting for the child status.
14:53:38.347 [11087] <4> bphdb do_backup: INF - Child executing /usr/local/bin/oraback.sh
14:53:38.347 [11087] <32> bphdb do_backup: FTL - Child exec of /usr/local/bin/oraback.sh failed.
14:53:38.347 [11087] <32> bphdb do_backup: errno = 2: No such file or directory
14:53:38.347 [11087] <16> bphdb Exit: ERR - bphdb exit status = 29: failed trying to exec a command
...


and there's a lot more where that came from, but the final lines (that we're showing above) indicates our issue very clearly. The file "/usr/local/bin/oraback.sh" does not exist. In fact, the file name is supposed to be "/usr/local/bin/oracleback.sh" (We all make mistakes when we're overworked, underfed and sleep deprived. Lots of people make mistakes while they're operating at 100% capacity. There's no shame in it ;)

5. Changing that attribute in our policy, and rerunning the job results in success! Now it's time to undo everything we did in step 1, assuming we don't have a lot of space for useless debug logs (useless only, of course, if everything is okay, for the most part... I smell another disclaimer coming on ;)

Here's the kicker. While this may seem like a very simplistic breakdown of what's certainly a more complex process, it actually is just that; the result of hours of kicking the tires before finding out that the answer was right under my nose! Like I said; we all make mistakes. There's nothing to be ashamed of. I'm going to go curl up in a ball and twitch for a while now ... ;)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, June 1, 2009

Fixing NetBackup Media Management Issues Through Mental Exhaustion

Hey there,

If you're ever setting up a new NetBackup server, and you're pretty sure you've done everything correctly, you very well may have ;)

Today's post is drawn directly from the 3 or 4 hours of insanity I went through trying to fix a broken setup "correctly" (which may work for you :) and then the neat little trick I pulled, as a last ditch effort, that actually ended up solving the problem. This is somewhat of an informal post, so if any of the steps I describe below aren't specific enough, check out our other posts on NetBackup troubleshooting and Set up (and other NetBackup Tips - with some bleed-over) where we've spent more time on the nitty-gritty :)

Note: I spent a lot of time reading NetBackup forums on and off of Veritas' site (or is it Symantec now? Nothing's changed ;) and some of the help will be very valuable to me in the future, I'm sure. However, and this drives me nuts, about 80% of the time, if I found someone who had the "exact" same problem as me, the responses were either:

1. Non-existent. A bummer, but, actually, somewhat comforting, since I could feel like no on else in the world knew what the fuck the deal was with that problem ;)

2. Argumentative and off-topic. This, I will never understand. Not so much that people will write random replies (often spiteful) that are of no use to anyone whatsoever, but that forum moderators (especially on the official NBU site) don't just delete that crap. I realize that reading someone else's opinionated bullshit is absolutely free and I don't "have to read it" (just like everyone who reads this blog is free to check out another web site at any time ;), but I question a world in which opinion, itself, is elevated above substance in the improper venue. If there isn't one out there already, I'm going to start a forum for people who need to vent. I'll keep the topics legitimate sounding, but the whole site will be all about belittling your fellow man for no reason any more noble than inflating your own floundering and pathetic ego. Is that the sound of hate mail, already? ;)

Anyway, back to NetBackup.

THE PROBLEM: All systems came up good. Drives recognized at the OS and Software layer and everything, seemingly, good to go. Unfortunately, every backup resulted in an error 96 (Unable to allocate new media for backup). This was on a server that had been setup in a disciplined manner (I must qualify that with "I think" since I didn't verify that folks were actually following procedure, but the build was close enough that they almost "had" to be) and it actually did have fresh media to allocate).

The Problem's (somewhat) human translation: The EMM (Enterprise Media Manager) database cannot find an entry for any of the media in your tape robot that it can use to satisfy your request for a backup. On a good day, the solution may be as easy as just inventorying your robot (using the "update" flag or checkbox) or reassigning your tapes to the volume pools that your policies belong to).

Assuming that's not the issue, they recommend that you get rid of everything and re-add it. Although this sounds like a big pain in the ass, it's really not that bad of an idea, and makes sense. Especially since I was working with a new setup and didn't have to worry about preserving any old backups. Burn it all down and rebuild. No problem :)

Rather than lifting, and rewording, the content from This Veritas Knowledge Base Page For Error 96, I would suggest you check out that page first if you run into this issue (It's a good jumping off point to various other avenues if your problem doesn't get resolved, as it has a few tests that may help narrow down your issue). I visited a number of other helpful places, but most of the stuff I ended up doing there didn't help me (today) and I don't want this post to get too confusing.

And finally...

THE SOLUTION THAT WORKED FOR ME: After trying to expire media and having NetBackup tell me that it wasn't in the EMM database, and then trying to add it to the EMM database and having the EMM database complain that an entry for the media already existed (a contrary position that I arrived at by taking many different paths ;), I eventually threw my hand up in the air (not literally) and just deleted the "volume group" that all the "volume pools" belonged to, because it was the single stupidest thing I could think of doing at the time ;)

As it turns out, once I whacked that thing (the only volume group we had), my next plaintive re-inventory actually updated the robot. Of course, after doing that, none of the tapes belonged to any of our volume groups anymore, but all I had to do was add the media back to their respective volume groups and, lo and behold, backups started working.

The moral of the story? Don't be afraid to give up. Every once in a while, it works ;)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, April 9, 2009

A Few More Obscure NetBackup Command Line Quickies

Hey There,

To finish off a Hellish week, or so, of NetBackup insanity (that's gone from not too slickly creating a command line NetBackup Activity Monitor to copying and modifying policies, schedules and clients between NetBackup hosts all the way to a simple way to get better NetBackup support for VCS), we bring you the final NetBackup post of the week (and, probably, for a while :)

Today's subject is going to be a little more scatter-brained than I usually am (??? ;) The following are a few extra little command lines you can use to make your NetBackup (Linux and Unix) command line experience somewhat less unenjoyable :) The location of the the binaries (though spelled out fully here) may differ depending on your installation. This post contains the standard defaults for NetBackup on Solaris 10 and OpenSolaris:

1. List out all your backup pools:

host # /usr/openv/volmgr/bin/vmpool -list_all -bx
pool index max partially full description
---------------------------------------------------------------------------------------------
None 0 0 the None pool
NetBackup 1 0 the NetBackup pool


2. Create new backup pools:

host # /usr/openv/volmgr/bin/vmpool -create -pn MY_Backups -description "Not Yours" -mpf 0
host # /usr/openv/volmgr/bin/vmpool -create -pn MY_Database_Backups -description "I said MINE" -mpf 0


and then make sure they're there:

host # /usr/openv/volmgr/bin/vmpool -list_all -bx
pool index max partially full description
---------------------------------------------------------------------------------------------
None 0 0 the None pool
NetBackup 1 0 the NetBackup pool
MY_backups 4 0 Not Yours
MY_Database_backups 5 0 I Said MINE


3. Inventory your robot (the robot type is tld and the robot number is 0):

host # /usr/openv/volmgr/bin/vmcheckxxx -rt tld -rn 0 -list

Robot Contents

Slot Tape Barcode
==== ==== ============
1 Yes CLN099
2 Yes CLN098
3 Yes C04440
4 Yes C04441
5 Yes C04442


4. List out your tape pools and the number of tapes each has:

host # while read a b c;do echo "Pool no. $b = $a";/usr/openv/volmgr/bin/vmquery -p $b -b|awk '{print $1}'|egrep -v '^media|^ID'|echo $(expr `echo $(wc -l)` - 1);done <<<"`/usr/openv/volmgr/bin/vmpool -list_all -bx|sed 1,2d`"

Pool no. 0 = None
2
Pool no. 1 = NetBackup
0
Pool no. 2 = MY_backups
1
Pool no. 3 = My_Database_backups
2


5. Do the same thing a different way:

host # while read a b c;do echo -n "$b ";/usr/openv/volmgr/bin/vmquery -p $b -b|awk '{print $1}'|egrep -v '^media|^ID'|echo $(expr `echo $(wc -l)` - 1);done <<<"`/usr/openv/volmgr/bin/vmpool -list_all -bx|sed 1,2d`"
0 2
1 0
2 1
3 2


6. And again (All this "proof of concept" stuff is great for keeping management at bay ;)

host # count=0;for x in $(while read a b c;do echo -n "$b ";/usr/openv/volmgr/bin/vmquery -p $b -b|awk '{print $1}'|egrep -v '^media|^ID'|echo $(expr `echo $(wc -l)` - 1);done <<<"`/usr/openv/volmgr/bin/vmpool -list_all -bx|sed 1,2d`");do if [[ $count -eq 0 ]];then echo -n "Pool No. $x = ";count=$count+1;else echo "Count $x";count=0;fi;done
Pool No. 0 = Count 2
Pool No. 1 = Count 0
Pool No. 2 = Count 1
Pool No. 3 = Count 2


7. Show the commands you'd need to run to recreate your current setup:

host # count=0;for x in $(while read a b c;do echo -n "$b ";/usr/openv/volmgr/bin/vmquery -p $b -b|awk '{print $1}'|egrep -v '^media|^ID'|echo $(expr `echo $(wc -l)` - 1);done <<<"`/usr/openv/volmgr/bin/vmpool -list_all -bx|sed 1,2d`");do if [[ $count -eq 0 ]];then poolnum=$x;count=$count+1;else numtapes=$x;count=0;if [ $numtapes -gt 0 ];then tape_array=($(/usr/openv/volmgr/bin/vmquery -p $poolnum -b|sed 1,3d|awk '{print $1}'|xargs echo));while [ $numtapes -gt 0 ];do let numtapes=$numtapes-1;if [[ $(expr "${tape_array[$numtapes]}" : 'CLN') -eq 3 ]];then echo "CLN /usr/openv/volmgr/bin/vmchange -p $poolnum -m ${tape_array[$numtapes]}";else echo "POOL $poolnum /usr/openv/volmgr/bin/vmchange -p $poolnum -m ${tape_array[$numtapes]}";fi;done;fi;fi;done
CLN /usr/openv/volmgr/bin/vmchange -p 0 -m CLN099
CLN /usr/openv/volmgr/bin/vmchange -p 0 -m CLN098
POOL 4 /usr/openv/volmgr/bin/vmchange -p 2 -m C04440
POOL 4 /usr/openv/volmgr/bin/vmchange -p 3 -m C04441
POOL 4 /usr/openv/volmgr/bin/vmchange -p 3 -m C04442



8. Yet another way to list your tapes, and the pools to which they belong, using your existing setup as input:

host # while read a b c;do echo "Pool no. $b = $a";/usr/openv/volmgr/bin/vmquery -p $b -b|awk '{print $1}'|egrep -v '^media|^ID'|echo $(expr `echo $(wc -l)` - 1);done <<<"`/usr/openv/volmgr/bin/vmpool -list_all -bx|sed 1,2d`"
Pool no. 0 = None
2
Pool no. 1 = NetBackup
0
Pool no. 2 = MY_backups
1
Pool no. 3 = MY_database_backups
2


9. Create an array of volume pools - each with a number of members equal to the number of members in the pool (you'll see why in a second):

host # tanum=0;while read a b c;do tnum=$(/usr/openv/volmgr/bin/vmquery -p $b -b|awk '{print $1}'|egrep -v '^media|^ID'|echo $(expr `echo $(wc -l)` - 1));if [[ $tnum -gt 0 ]];then while [[ $tnum -gt 0 ]];do let tnum=$tnum-1;tarray[$tanum]=$b;let tanum=$tanum+1;done;fi;done <<<"`/usr/openv/volmgr/bin/vmpool -list_all -bx|sed 1,2d`";echo ${tarray[@]}
0 0 2 3 3


10. Use the array you just created to create new media pools on a separate host (note that this will only assign the CLN tapes to the 0 pool - specifically - and will randomly (in order ;) assign the number of tapes necessary to each of your pools. Don't forget to set those up first (as above :))

PROOF OF CONCEPT RUN

host # tarray=(0 0 2 3 3);count=0;for x in $(echo ${tarray[@]});do tape_array=($(/usr/openv/volmgr/bin/vmquery -a -b|sed 1,3d|awk '{print $1}'|sort -rn|xargs echo));if [[ $(expr "${tape_array[$count]}" : 'CLN') -eq 3 ]];then echo "CLN $x /usr/openv/volmgr/bin/vmchange -p $x -m ${tape_array[$count]}";let count=$count+1;else echo "POOL $x /usr/openv/volmgr/bin/vmchange -p $x -m ${tape_array[$count]}";let count=$count+1;fi;done
CLN 0 /usr/openv/volmgr/bin/vmchange -p 0 -m CLN009
CLN 0 /usr/openv/volmgr/bin/vmchange -p 0 -m CLN010
POOL 2 /usr/openv/volmgr/bin/vmchange -p 4 -m C08880
POOL 3 /usr/openv/volmgr/bin/vmchange -p 4 -m C08881
POOL 3 /usr/openv/volmgr/bin/vmchange -p 4 -m C08882



AND THE REAL DEAL:

host # tarray=(0 0 4 4 4 4 4 4 4 4 4 5 5 7 7 7 7 7 7 7 7 7);count=0;for x in $(echo ${tarray[@]});do tape_array=($(/usr/openv/volmgr/bin/vmquery -a -b|sed 1,3d|awk '{print $1}'|sort -rn|xargs echo));if [[ $(expr "${tape_array[$count]}" : 'CLN') -eq 3 ]];then echo "Running /usr/openv/volmgr/bin/vmchange -p $x -m ${tape_array[$tcount]}";/usr/openv/volmgr/bin/vmchange -p $x -m ${tape_array[$count]};let count=$count+1;else echo "Running /usr/openv/volmgr/bin/vmchange -p $x -m ${tape_array[$count]}";/usr/openv/volmgr/bin/vmchange -p $x -m ${tape_array[$count]};let count=$count+1;fi;done
Running /usr/openv/volmgr/bin/vmchange -p 0 -m CLN009
Running /usr/openv/volmgr/bin/vmchange -p 0 -m CLN010
Running /usr/openv/volmgr/bin/vmchange -p 2 -m C08880
Running /usr/openv/volmgr/bin/vmchange -p 3 -m C08881
Running /usr/openv/volmgr/bin/vmchange -p 3 -m C08882


11. Verify that your tape assignments worked:

host # /usr/openv/volmgr/bin/vmpool -list_all -bx
pool index max partially full description
---------------------------------------------------------------------------------------------
None 0 0 the None pool
NetBackup 1 0 the NetBackup pool
MY_backups 2 0 Not Yours
MY_Database_backups 3 0 I said MINE

host # while read a b c;do echo "Pool no. $b = $a";/usr/openv/volmgr/bin/vmquery -p $b -b|awk '{print $1}'|egrep -v '^media|^ID';done <<<"`/usr/openv/volmgr/bin/vmpool -list_all -bx|sed 1,2d`"
Pool no. 0 = None
-------------------------------------------------------------------------------
CLN009
CLN010
Pool no. 1 = NetBackup
-------------------------------------------------------------------------------
Pool no. 2 = MY_backups
CO8880
-------------------------------------------------------------------------------
Pool no. 3 = MY_Database_backups
C08881
CO8882


And so much more... but not for today ;)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Wednesday, April 8, 2009

A Simple Way To Get Better Symantec NetBackup Support For VCS

Hey there,

This post is a little gift for those of you out there who run clustered NetBackup on VCS to go along with our earlier posts on emulating the NetBackup activity monitor on the command line and copying and modifying NetBackup policies, schedules and clients between hosts:)

As most of you who've run NetBackup in a VCS cluster may know, sometimes getting support for NetBackup (used with VCS) can be a royal pain; never mind that NetBackup (Symantec or, previously, Veritas) can be "purchased" as a VCS cluster add-on. The problem (and, to me, this is inexplicable, since NetBackup used to be a Veritas product) is that, if you ever experience issues with your NetBackup cluster and need to call Symantec for help, they generally have an entirely contrary attitude if they find out that you're actually running NetBackup in a VCS cluster that includes other "certified" add-on components (?)

And, yes, you read that correctly: You're going to have problems getting reasonable support for NetBackup if you've incorporated any other VCS modules in your cluster. If you want to get decent support for your clustered NetBackup setup (in my experience) your cluster should "only" include the NetBackup add-on Module. This is hardly a realistic scenario, but (for instance), if you're running the Oracle and NetBackup add-on modules in the same cluster, your support experience will be less than pleasant.

Hurdling right over the argument that Symantec "should" enthusiastically support NetBackup in a Cluster, no matter what else is clustered with it, we'll proceed directly to the solution. It's not exactly Kosher, but it works :)

Let's say, for instance, that you have a 2 node VCS cluster. Let's also say that your cluster has both Oracle and NetBackup add-on modules installed and operational. Then, finally, let's say the NetBackup component begins to fail miserably. What then?

As a little aside, in the spirit of Airplane:

"For instance, that you have a 2 node VCS cluster. That your cluster has both Oracle and NetBackup add-on modules installed and operational. The NetBackup component begins to fail miserably. What then?"


Sorry; couldn't help it ;)

Basically, in the situation described above (and repeated, per instruction, directly below ;) you'll get half-hearted support for your NetBackup problem, at best, if (and this is important) you "tell the truth about your setup." I'm not advocating dishonesty (although, as they say, it "is" the second best policy ;), but, if you want Symantec to fully support your NetBackup issue and not waste a lot of time pointing fingers at Veritas and, generally, giving you the run-around, you'll need to assure them that you're "only" running NetBackup on your cluster (no matter how cost-inefficient that may be ;)

Please be sure, before you use the method below, that you have conclusively ruled out other add-on modules in your cluster as being a part of (or the entirety of) the problem.

Once you've determined that NetBackup is, indeed, the issue, you'll need to call Symantec for that support you're "paying for" (another thing that makes this whole ordeal ridiculous). And, in order to get that full support, you'll need to implement the following two methods:

1. Always play your cards very close to the vest. Don't divulge unnecessary information and only provide very specific responses to questions asked. For instance, if NetBackup Support wants to see the permissions of your main.cf file, only do an "ls -l" of the one specific main.cf. If they want to see the contents, only show them that "one" file's contents. And, of course, don't let them "take over" your machine via WebEx or any other "remote control" mechanism.

2. Make sure that you have a "prop" main.cf to show them (This is the gift attached below. It may only be a template that needs customizing to suit your own site's naming conventions, etc, but it's a nice gesture, at least ;)

Feel free to manipulate the following workable example as necessary. The only things you should need to change would be the specific "names" that you've given your resources (and NIC device names, IP addresses, etc). And, remember, this main.cf is for "support eyes only" - it probably doesn't do everything you need to do in your "real" cluster configuration (which is why you should be sure you rename it to something else before you fire up your first node ;), but it "does" do the most important thing of all when it comes to getting support for NetBackup on VCS: It describes a VCS cluster that contains the NetBackup add-on module and no others!

Enjoy :)



include "types.cf"
include "/usr/openv/netbackup/bin/cluster/vcs/NetBackupTypes.cf"

cluster MyClusterName (
)

system MyHost1 (
)

system MyHost2 (
)

group MyMainServiceGroup (
SystemList = { MyHost1 = 0, MyHost2 = 1 }
AutoStartList = { MyHost1 }
)



// resource dependency tree
//
// group MyMainServiceGroup
// {
// }


group MyNetBackupServiceGroup (
SystemList = { MyHost1 = 0, MyHost2 = 1 }
AutoStartList = { MyHost1, MyHost2 }
)

DiskGroup MyNetBackupDiskGroup (
DiskGroup = netbackupdg
)

IP MyNetBackupIP (
Device = ce0
Address = "10.99.99.99"
NetMask = "255.255.255.0"
)

Mount MyNetBackupMount (
MountPoint = "/shared/opt/VRTSnbu"
BlockDevice = "/dev/vx/dsk/netbackupdg/sharedoptvrtsnbu"
FSType = vxfs
MountOpt = largefiles
FsckOpt = "-y"
)

NIC MyNetBackupNIC (
Device = ce0
)

NetBackup MyNetBackupServer (
ServerName = MyNetBackupServer
ServerType = NBUMaster
)

Volume MyNetBackupVolume (
Volume = sharedoptvrtsnbu
DiskGroup = netbackupdg
)

MyNetBackupIP requires MyNetBackupNIC
MyNetBackupMount requires MyNetBackupVolume
MyNetBackupServer requires MyNetBackupIP
MyNetBackupServer requires MyNetBackupMount
MyNetBackupVolume requires MyNetBackupDiskGroup


// resource dependency tree
//
// group MyNetBackupServiceGroup
// {
// NetBackup MyNetBackupServer
// {
// IP MyNetBackupIP
// {
// NIC MyNetBackupNIC
// }
// Mount MyNetBackupMount
// {
// Volume MyNetBackupVolume
// {
// DiskGroup MyNetBackupDiskGroup
// }
// }
// }
// }




, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Tuesday, April 7, 2009

Duplicating And Modifying NetBackup Policies, Schedules And Client Via Command Line On Linux And Unix

Hey There,

SPOILER ALERT: THE BULLET POINTS IN THIS POST ARE IN ALL CAPS. I'M SORRY FOR SHOUTING. I HAVE NO SENSE OF HOW OBNOXIOUSLY LOUD I AM!

Actually tomorrow's post has turned into today's and I'm going to do today's tomorrow. I don't know why I felt compelled to write that. I guess I just don't want you to lose track of time like I do ;)

Today we're going to check out a way to copy (and modify) an existing host's NetBackup policies, clients and schedules to a new host, and then modify those policies, clients and schedules (just slightly) to suit the new host (you can't backup to a hostname that isn't the name of the host you want to back up. ...if you want to backup your the new host, that is ;)

The beauty of it is that it can all be done from the command line. No more UI GUI for you :)

And now, in one of my driest pieces to date, a step by step guide on how to perform the process I just described above (If you're interested in staying away from the GUI, check out our old post on our NetBackup command line activity monitor)

1. GET YOUR POLICIES AND SCHEDULES FROM THE KNOWN-GOOD HOST YOU WANT TO EMULATE/REPLICATE (orig_host will be the known-good host and new_host will be the host you want to be just about the same. Also, we're assuming you've installed the base product. This walk-through is focused only on policies, policy schedules and policy clients).

orig_host # ls /usr/openv/netbackup/db/class (you may have more than this - generally there's one directory per policy. Each directory includes the schedules for the policy the directory name indicates):

HOST_BACKUP HOST_OS_BACKUP HOST_CATALOG


You may want to copy off the old policy and schedule output, just so you can compare it with your new host setup later and make sure you didn't forget to change any instances of an old hostname to your new hostname

orig_host # /usr/openv/netbackup/bin/admincmd/bppllist -allpolicies -U >/var/tmp/policies.txt


Then just tar that all up:

orig_host # tar cpf /var/tmp/policies_and_schedules.tar /usr/openv/netbackup/db/class /var/tmp/policies.txt


2. VERIFY THAT EITHER NO "class" DIRECTORY EXISTS ON YOUR NEW HOST, THE EXISTING "class" DIRECTORY IS EMPTY OR THAT IT JUST CONTAINS THE STANDARD TEST GARBAGE YOUR SETUP MAY COME WITH - DELETE IT OR UNTAR OVER IT IF YOU WANT TO (USER DISCRETION ADVISED!) - THIS MAY NOT BE A BIG DEAL SINCE YOU PROBABLY HAVE NO SCHEDULES OR POLICIES ON YOUR NEW HOST ANYWAY.

new_host # ls /usr/openv/netbackup/db
/usr/openv/netbackup/db: No such file or directory
new_host # ls /usr/openv/netbackp/db/class
/usr/openv/netbackp/db/class: No such file or directory
new_host # ls /usr/openv/netbackp/db
/usr/openv/netbackp/db: No such file or directory


3. AFTER SCP'ING/COPYING THE TAR FILE FROM YOUR KNOWN GOOD HOST, UNTAR IT ON THE NEW HOST AND LIST ALL POLICIES TO DOUBLE VERIFY - THE HOST NAMES WILL BE WRONG (FOR YOUR NEW HOST) SO THE DIFF WON'T BE TOO DIFFERENT!

new_host # tar xpf /var/tmp/policies_and_schedules.tar
new_host # /usr/openv/netbackup/bin/admincmd/bppllist -allpolicies -U >/var/tmp/policies_new.txt
diff /var/tmp/policies.txt /var/tmp/policies_new.txt


4. CHECK THAT ALL THE POLICIES ARE THERE IN YOUR policies_new.txt FILE (YOU CAN LOOK IN BPADM, TOO). ALL HOSTNAMES AND TAPE RESIDENCE NAMES WILL STILL BE WRONG (ANYTHING THAT CONTAINS A HOSTNAME, ANYWAY)

new_host # /usr/openv/netbackup/bin/admincmd/bppllist -M new_host
HOST_BACKUP
HOST_OS_BACKUP
HOST_CATALOG


5. DETERMINE YOUR TAPE RESIDENCE (TLD NAME) ON THE NEW HOST (FIRST ENTRY IN OUTPUT BELOW)

new_host # /usr/openv/netbackup/bin/admincmd/bpstulist
new_host-hcart3-robot-tld-o 2 new_host 8 0 20 2 0 "*NULL*" 0 1 1048576 *NULL* 0 1 0 0 0 0 *NULL* new_host


"new_host-hcart3-robot-tld-o" is the residence name

6. ASSUMING ALL POLICIES LISTED ABOVE ARE GOOD, YOU WON'T HAVE TO MODIFY THIS LINE TO REMOVE AND/OR UPDATE THE RESIDENCE FOR ALL POLICIES (OF COURSE, THEY PROBABLY AREN'T SINCE THIS POST WAS WRITTEN FOR THE GENERAL PUBLIC ;)

new_host # while read line;do /usr/openv/netbackup/bin/admincmd/bpplinfo $line -modify -residence new_host-hcart3-robot-tld-o;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host`"


7. LIST OUT ALL THE SCHEDULES NOW - NOTE THAT YOU MAY NOT WANT TO MODIFY YOUR CATALOG POLICY AND THAT SOME POLICIES HAVE MORE THAN ONE CLIENT (This may vary from setup to setup, so it's important to check!)

NOTE ALSO THAT, SINCE YOU'RE NOT CHANGING YOUR SCHEDULES, ALL YOU NEED TO DO TO MODIFY THEM IS TO CHANGE THE CLIENTS ASSOCIATED WITH THEM, WHICH GETS DONE IN THE FOLLOWING STEPS, AS WELL :)

new_host # while read line;do echo "POLICY $line";/usr/openv/netbackup/bin/admincmd/bpplclients $line;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host`"
POLICY HOST_BACKUP
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris10 orig_host
POLICY HOST_OS_BACKUP
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris10 orig_host
Solaris Solaris10 orig_host2
POLICY HOST_CATALOG
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris8 orig_host


8. WITH THE SAME ASSUMPTIONS AS ABOVE, USE THIS TO CHANGE CLIENTS FOR YOUR POLICIES - CHOPPING OFF LAST POLICY AND MODIFIYING CLIENTS BY TAKING INPUT FROM LIST, MODIFYING AND THEN RUNNING "ADD NEW" AND "DELETE OLD" IN A LOOP (The simple sed expression to change the host name can be as specific as you like)

A. DO A "PROOF OF CONCEPT" RUN FIRST

while read line;do count=3;for x in $(/usr/openv/netbackup/bin/admincmd/bpplclients $line|awk '{print $3}'|grep db|/usr/bin/sed 's/orig_/new_/g'|xargs echo);do oldhwos=$(/usr/openv/netbackup/bin/admincmd/bpplclients $line|sed -n ${count}p|awk '{print $1,$2}');let count=$count+1;echo "POC TEST $line /usr/openv/netbackup/bin/admincmd/bpplclients $line -add $x $oldhwos";done;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host|egrep -iv 'vault|catalog'`"
POC TEST HOST_BACKUP /usr/openv/netbackup/bin/admincmd/bpplclients HOST_BACKUP -add new_host Solaris Solaris10
POC TEST HOST_OS_BACKUP /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -add new_host Solaris Solaris10
POC TEST HOST_OS_BACKUP /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -add new_host2 Solaris Solaris10


B. THEN - IF ALL IS WELL - DO IT FOR REAL

while read line;do count=3;for x in $(/usr/openv/netbackup/bin/admincmd/bpplclients $line|awk '{print $3}'|grep db|/usr/bin/sed 's/orig_/new_/g'|xargs echo);do oldhwos=$(/usr/openv/netbackup/bin/admincmd/bpplclients $line|sed -n ${count}p|awk '{print $1,$2}');let count=$count+1;echo "Running /usr/openv/netbackup/bin/admincmd/bpplclients $line -add $x $oldhwos";/usr/openv/netbackup/bin/admincmd/bpplclients $line -add $x $oldhwos;done;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host|egrep -iv 'vault|catalog'`"
Running /usr/openv/netbackup/bin/admincmd/bpplclients HOST_BACKUP -add new_host Solaris Solaris10
Running /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -add new_host Solaris Solaris10
Running /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -add new_host Solaris Solaris10


C. CHECK TO MAKE SURE THE NEW CLIENTS ARE ADDED

while read line;do /usr/openv/netbackup/bin/admincmd/bpplclients $line ;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host`"
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris10 orig_host
Solaris Solaris10 new_host
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris10 orig_host
Solaris Solaris10 orig_host1
Solaris Solaris10 new_host
Solaris Solaris10 new_host1
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris8 orig_host
Solaris Solaris8 new_host


D. NOW SOME POC TO MAKE SURE THE DELETE OF THE OLD HOSTS WORKS OKAY

while read line;do for x in $(/usr/openv/netbackup/bin/admincmd/bpplclients $line|awk '{print $3}'|grep orig_|xargs echo);do echo "POC TEST $line /usr/openv/netbackup/bin/admincmd/bpplclients $line -delete $x";done;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host|egrep -iv 'vault|catalog'`"
POC TEST HOST_BACKUP /usr/openv/netbackup/bin/admincmd/bpplclients HOST_BACKUP -delete orig_host
POC TEST HOST_OS_BACKUP /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -delete orig_host
POC TEST HOST_OS_BACKUP /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -delete orig_host1


E. THEN REMOVE THEM FOR REAL

while read line;do for x in $(/usr/openv/netbackup/bin/admincmd/bpplclients $line|awk '{print $3}'|grep orig_|xargs echo);do echo "Running /usr/openv/netbackup/bin/admincmd/bpplclients $line -delete $x";/usr/openv/netbackup/bin/admincmd/bpplclients $line -delete $x;done;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host|egrep -iv 'vault|catalog'`"
Running /usr/openv/netbackup/bin/admincmd/bpplclients HOST_BACKUP -delete orig_host
Running /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -delete orig_host
Running /usr/openv/netbackup/bin/admincmd/bpplclients HOST_OS_BACKUP -delete orig_host1


F. THEN CHECK AGAIN

while read line;do /usr/openv/netbackup/bin/admincmd/bpplclients $line ;done <<< "`/usr/openv/netbackup/bin/admincmd/bppllist -M new_host`"
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris10 new_host
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris10 new_host
Solaris Solaris10 new_host1
Hardware OS Client
--------------- --------------- --------------
Solaris Solaris8 orig_host


9. NOW THAT YOU'VE GOT THE POLICIES, SCHEDULES AND CLIENTS MOVED OVER, MAKE SURE THAT YOUR CATALOG JOB EXISTS (IF YOU USE ONE)

new_host # /usr/openv/netbackup/bin/admincmd/bppllist HOST_CATALOG
CLASS HOST_CATALOG *NULL* 0 650000 0 *NULL*
NAMES
INFO 35 1 0 0 *NULL* 0 0 1 1 0 1 2 0 0 0 0 0 0 1236208342 EA91EDF01DD111B2AB1900144FEAC8FE 1 0 0 0 0 0 0 0 2 0 0 0 0 0 6
KEY *NULL*
BCMD *NULL*
RCMD *NULL*
RES new_host-hcart3-robot-tld-o *NULL* *NULL* *NULL* *NULL* *NULL* *NULL* *NULL* *NULL* *NULL*
POOL CATALOGPOOL NetBackup NetBackup NetBackup NetBackup NetBackup NetBackup NetBackup NetBackup NetBackup
FOE 0 0 0 0 0 0 0 0 0 0
SHAREGROUP *ANY*
DATACLASSIFICATION *NULL*
CLIENT new_host Solaris Solaris8 0 0 0 0 *NULL*
INCLUDE CATALOG_DRIVEN_BACKUP


10. NOW JUST DEACTIVE ANY POLICIES THAT ARE ACTIVE AND SHOULDN'T BE AND ACTIVATE ANY POLICIES THAT SHOULD BE ACTIVE BUT AREN'T!

All set!

CHEERS! ;)

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.