Veritas-bu

[Veritas-bu] BPCOVERAGE internals

2007-12-12 10:21:13
Subject: [Veritas-bu] BPCOVERAGE internals
From: Bancal <netbackup-forum AT backupcentral DOT com>
To: VERITAS-BU AT mailman.eng.auburn DOT edu
Date: Wed, 12 Dec 2007 00:18:46 -0800
Feel free to modify this scripts.


cat win_coverage.ksh
#!/usr/bin/ksh
#
#This script checks if NetBackup policies cover all the local drives of 
Windows-based clients,
#builds HTMLed report on drives that are turn to be uncovered and sends this 
report as e-mail attachment
#to Netbackup admins team.
#
#


#
#Variables declaration
#
#
BPCOVERAGE='/usr/openv/netbackup/bin/admincmd/bpcoverage -c '
BPCOVERAGE_OPTIONS=' -coverage -no_cov_header '
CurrentDate=`date +'%d%m%Y'`
ReportFile=/tmp/WindowsCoverageReport-$CurrentDate.html
CurrentTimeStamp=`date +'%d/%m/%Y %H:%M'`
ReportHeader="<html><head><title>Windows Hosts Coverage Report on 
$CurrentTimeStamp</title></head><body bgcolor=ivory>"
TableHeader="<table border=1 cellpadding=2 align=center 
width=100%><caption><h1>Windows Hosts Coverage Report o\
n $CurrentTimeStamp</h1></caption>\
<tr>\
<th>Client Name</th>\
<th>Uncovered Disk Drives</th>\
</tr>"
TableFooter="</table>"
ReportFooter="</body></html>"
TempFile="/tmp/`basename $0`"

#
#Put HTML headers to report file
#
print $ReportHeader > $ReportFile
print $TableHeader >> $ReportFile


#
#Get coverage report for each Windows-based NetBackup client, select drives
#that are uncovered by Netbackup policies and append NetBackup client hostname 
and the names of
#uncovered disk drives to a report file.
#
for host in `bpplclients | fgrep Windows | awk '{print $3}'`
do
    if $BPCOVERAGE $host $BPCOVERAGE_OPTIONS 2>/dev/null | fgrep UNCOVERED 
2>/dev/null  | awk '{print $1}' > $TempFile 2>/dev/null
    then
        print "<tr><td>$host</td><td>" >> $ReportFile
        nlines=`cat $TempFile | wc -l`
        if (( $nlines == 0 ))
        then
            print "&nbsp</td></tr>" >> $ReportFile
            continue
        fi
        n=1
        for fs in `cat $TempFile`
        do
          if (( n < nlines ))
          then
              Suffix='<BR>'
          else
              Suffix=''
          fi
          if [[ $fs = @(C*|Shadow*|System_State*) ]]
          then
              print "<font color=red>$fs</font>$Suffix" >> $ReportFile
          else
              print "$fs$Suffix" >> $ReportFile
          fi
          (( n=n+1 ))
       done
       print "</td></tr>" >> $ReportFile
    fi
done


#
#Put HTML footers to report file
#
print $TableFooter >> $ReportFile
print $ReportFooter >> $ReportFile

+----------------------------------------------------------------------
|This was sent by bancal AT walla DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------


_______________________________________________
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>
  • [Veritas-bu] BPCOVERAGE internals, Bancal <=