perl script Consolidated Bootstrap report for NetWorker

This is a Perl script that can be used to get a consolidated list of the latest bootstrap saveset information to your inbox. The best use of this script will be to add it to a scheduler or a cron tab to be executed once or more times a day so that you have a latest copy of all the bootstrap information in your email. The resulting report will contain information like the backup server hostname, backup date and time, saveset id, volume name, volume access information and jukebox or data domain hostname. Ensure the email reached the correct stake holders to get the best use of it. The hostnames of the NetWorker servers for which the information has to be collated is placed on a seperate file located in the same directory as the script.
This script was developed and tested on
  • Platform : Linux and UNIX
  • Application : DELL EMC NetWorker 8.2/9.1


The input to this script is being provided via an external file backup_server_list.txt . Make sure keep the file at the same location as the script and in case you are using this in the cron tab then edit the variable in the script to the complete path to this file to avoid errors during the execution of the script.

Along with the external file you might also want to assign appropriate values to the below listed variables in the script.

Variable Value description
$server_details_file_name Complete path to the backup_server_list.txt file on the local system.
$email_from Sender's email address.
$email_to Recipient's email address.
$email_subject Subject for the email that would contain the consolidated report.

Output from the script on the console

The output of the script migh be required to check the errors during the run of the script. This can be usually redirected to a log file that gets over written wverytime the script runs to avoid the log taking a lot of disk space.

nwserver:/home/rovin $ /home/rovin/scripts/bootstrap_report/
------------------ Script Initiated ------------------
Collecting Bootstrap information for nwserver1.
Collecting Bootstrap information for nwserver2.
Collecting Bootstrap information for nwserver3.
Collecting Bootstrap information for nwserver4.
Collecting Bootstrap information for nwserver5.
Collecting Bootstrap information for nwserver6.
Collecting Bootstrap information for nwserver7.
Collecting Bootstrap information for nwserver8.
Collecting Bootstrap information for nwserver9.
Collecting Bootstrap information for nwserver10.
87988:mminfo: Unable to connect to media database server on host nwserver11: Unable to connect to nsrexecd on host nwserver1 for RAP credentials: Unknown host

Sample email report


    #! /usr/bin/perl -w

# Details regarding this script can be found on

my $today_date = `date +'%d-%m-%Y'`;
chomp $today_date;
my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
(my $sec,my $min,my $hour,my $mday,my $mon,my $year,my $wday,my $yday,my $isdst) = localtime();

my $server_details_file_name = "backup_server_list.txt"; 
my $email_holder = "/tmp/bootstrap_email_holder.txt";
my $email_from="sender\";
my $email_to="stake_holders\";
my $email_subject="CUSTOMER_NAME Bootstrap Report - $today_date";
my @server_lists;

print "------------------ Script Initiated ------------------\n";
@server_lists = `cat $server_details_file_name`;
email_header($email_holder, $email_subject, $email_from, $email_to);
open(my $fh, '>>', $email_holder) or die "Could not open file '$email_holder' $!";

for my $server (@server_lists)
	print "Collecting Bootstrap information for $server. \n";
    print $fh "<tr>
            <td style=\"background-color: #CCCCCC; color:#003366 ;padding: 3px\">".uc($server)."</t>";
    print $fh ` /usr/sbin/mminfo -s $server -B -xc, | grep -v record | tail -1 | awk -F',' '{ print "<td style=\\\"background-color: #CCCCCC; color:#003366 ;padding: 3px\\\">",\$1, "</td><td style=\\\"background-color: #CCCCCC; color:#003366 ;padding: 3px\\\">", \$2, "</td><td style=\\\"background-color: #CCCCCC; color:#003366 ;padding: 3px\\\">",\$5, "</td><td style=\\\"background-color: #CCCCCC; color:#003366 ;padding: 3px\\\">",\$7,"</td><td style=\\\"background-color: #CCCCCC; color:#003366 ;padding: 3px\\\">",\$9,"</td>"  }'`;
    print $fh "</tr>";



print "\n------------------ Sending email now ------------------\n";
system("cat $email_holder | /usr/sbin/sendmail -t");
print "------------------ Script Completed ------------------\n";

# Subroutines

sub email_header{
	my $holder = $_[0];
	open(my $fh, '>', $holder) or die "Could not open file '$holder' $!";
	print $fh 'From: $_[2]
To: $_[3]
Subject: $_[1]
Content-Type: text/html
MIME-Version: 1.0
<!doctype html>
<meta charset=\"utf-8\">
<title>CUSTOMER_NAME Bootstrap Report by Rovin D\'Souza</title>

<body style=\"font-family:Segoe, \'Segoe UI\', \'DejaVu Sans\', \'Trebuchet MS\', Verdana, sans-serif \">
<div id=\"main_heading\" align=\"center\" style=\"margin-top: 20px;margin-bottom:20px;font-size:larger;background:#00628B;height:60px;\">
<b><p><span style=\"color:#FFFFFF;height: 100%\">".$email_subject."</span></p></b>

<div class=\"content\" align=\"center\" style=\"margin-left:2%;margin-right:2%\">
<table style=\"font-family:Segoe, \'Segoe UI\', \'DejaVu Sans\', \'Trebuchet MS\	', Verdana, sans-serif \"width=\"100%\" border=\"0\">
  <tbody style=\"height:20px\">
      <td> </td>

 <table  width=\"80%\" align=\"center\" style=\"background-color: background ;\">
            <th style=\"padding: 5px; background-color: #003366; color: #CCCCCC\">Server</th>
            <th style=\"padding: 5px; background-color: #003366; color: #CCCCCC\">Date</th>
            <th style=\"padding: 5px; background-color: #003366; color: #CCCCCC\">SSID</th>
            <th style=\"padding: 5px; background-color: #003366; color: #CCCCCC\">Volume</th>
			<th style=\"padding: 5px; background-color: #003366; color: #CCCCCC\">Volume Location</th>
			<th style=\"padding: 5px; background-color: #003366; color: #CCCCCC\">Volume access information</th>
close ($fh);

sub email_footer{
my $holder = $_[0];
open(my $fh, '>>', $holder) or die "Could not open file '$holder' $!";
print $fh '
</html>	';
close ($fh);



Email your feedback to