Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.
Backup and Recovery Community Blog

Generating Policy Schedule Reports (Script Provided)

Created: 16 Sep 2011 • Updated: 16 Sep 2011
AlanTLR's picture
+1 1 Vote
Login to vote

Managing your policies is important, but also being able to quickly communicate the policy schedules to customers is just as important.  At our site, we use OpsCenter to send reports to the customers, but I wanted a way to show the customers what their backup windows were.  The NetBackup Admin Console allows you to view them, but you can't export it.  OpsCenter also lets you view them, but you can't email or export them.  Luckily, NetBackup has a few command-line tools that allow you to view policy schedules: bppllist and bpplsched.  I mostly use bppllist, but you can examine the output and see what works best for you.

 #!/bin/ksh

BASENAME=$(basename $0);
DIRNAME=$(dirname $0);
CMD_ECHO="/usr/bin/echo";
CMD_EGREP="/usr/bin/egrep";
CMD_BPPLSCHED="/usr/openv/netbackup/bin/admincmd/bpplsched";
CMD_BPPLLIST="/usr/openv/netbackup/bin/admincmd/bppllist";
CMD_BPGETCONFIG="/usr/openv/netbackup/bin/admincmd/bpgetconfig";

POLICYLIST="";
GO="NO";

usage()
{
  printf "\n  ${BASENAME} [policy1] [policy2] ...\n";
  printf "\n     If policy names are not provided, ${BASENAME} provides schedules on ALL policies.\n\n";
}

if [ "$LOGNAME" != "root" ]; then
  printf "ERROR: You must be root to run this script\n";
  exit 1;
fi

while getopts "h(help)" OPTION
do
  case ${OPTION} in
  h) usage; exit ;;
  \?) usage; exit BADOPTION ;;
  esac
done
shift $OPTIND-1

if [ $# -ne 0 ]; then
  POLICYLIST=$*
else
  POLICYLIST=`$CMD_BPPLLIST`
fi

for i in $POLICYLIST; do
  GO=`$CMD_BPPLLIST $i -U | awk '/^  Active:/{print $2}'`;
  if [ "$GO" = "yes" ]; then
    $CMD_ECHO ""
#    $CMD_ECHO ">>>$i<<<"
#    $CMD_BPPLSCHED $i -U | $CMD_EGREP -v "MPX|PFI|Copies|Fail on Error|same as|not required|Residence is Storage"
    $CMD_BPPLLIST $i -U | $CMD_EGREP -v "MPX|PFI|Copies|Fail on Error|same as|not required|Residence is Storage|Mult. Data|Encrypt|Checkpoint|Policy Priority|Disaster Recovery|Collect BMR info|Server Group|Keyword|Data Classification|attributes:|Synthetic:|Max Jobs/Policy:|Granular Restore Info|Ignore Client Direct|Client Compress:|Follow NFS Mounts:|Cross Mount Points:|Collect TIR info:|Block Incremental:Active:.*yes"
  fi
done 

I've set the commands as variables so if you have an alternate path for your installation, you can easily change it.  As you can see, I first check to see if Root is the user running the script, then I'll grab every policy in the bppllist command.  For each policy that's active, I generate its output (the "-U" option gives a more readable output).  If I want, I can specify a list of policies at the command-line.

In the sample output below, I've selected those fields that I think would be important to the customer that's asking.  Names have been changed to protect the innocent.

EXAMPLE:

 /usr/local/bin $ sudo ./generate_backup_schedules.ksh Solaris_OS-totape Solaris_OS

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

Policy Name:       Solaris_OS-totape

  Policy Type:         Standard
  Active:              yes
  Effective date:      02/03/1991 12:26:39
  Block Incremental:   no
  Residence:           MASTER-SL500-LTO4
  Volume Pool:         Solaris_OS
  Application Discovery:      no
  Discovery Lifetime:      0 seconds

  HW/OS/Client:  Solaris       Solaris9      mrmaster

  Include:  /XXX
            /YYY
            /ZZZ

  Schedule:          Weekly_Full
    Type:            Full Backup
    Retention Level: 1 (2 weeks)
    Calendar sched: Enabled
      Friday, Week 1
      Friday, Week 2
      Friday, Week 3
      Friday, Week 4
      Friday, Week 5
    Daily Windows:
          Friday     17:00:00  -->  Saturday   05:00:00

  Schedule:          Daily_Incremental
    Type:            Differential Incremental Backup
    Retention Level: 1 (2 weeks)
    Calendar sched: Enabled
      Tuesday, Week 1
      Wednesday, Week 1
      Thursday, Week 1
      Friday, Week 1
      Saturday, Week 1
      Tuesday, Week 2
      Wednesday, Week 2
      Thursday, Week 2
      Friday, Week 2
      Saturday, Week 2
      Tuesday, Week 3
      Wednesday, Week 3
      Thursday, Week 3
      Friday, Week 3
      Saturday, Week 3
      Tuesday, Week 4
      Wednesday, Week 4
      Thursday, Week 4
      Friday, Week 4
      Saturday, Week 4
      Tuesday, Week 5
      Wednesday, Week 5
      Thursday, Week 5
      Friday, Week 5
      Saturday, Week 5
    Daily Windows:
          Tuesday    01:30:00  -->  Tuesday    06:30:00
          Wednesday  01:30:00  -->  Wednesday  06:30:00
          Thursday   01:30:00  -->  Thursday   06:30:00
          Friday     01:30:00  -->  Friday     06:30:00
          Saturday   01:30:00  -->  Saturday   06:30:00

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

Policy Name:       Solaris_OS

  Policy Type:         Standard
  Active:              yes
  Effective date:      02/03/1991 12:25:54
  Block Incremental:   no
  Residence:           mrmaster-disk_staging_unit
  Volume Pool:         Solaris_OS
  Application Discovery:      no
  Discovery Lifetime:      0 seconds

  HW/OS/Client:  Solaris       Solaris9      ftpserver1
                 Solaris       Solaris9      mrmaster
                 Solaris       Solaris10     dbserver1
                 Solaris       Solaris10     appserver1
                 Solaris       Solaris10     webserver1
                 Solaris       Solaris10     webserver2
                 Solaris       Solaris10     dbserver2
                 Solaris       Solaris10     vmwaresol1
                 Solaris       Solaris10     appserver2
                 Solaris       Solaris_x86_1 devwebserver
                 Solaris       Solaris10     soljump1
                 Solaris       Solaris10     sanadminscomp

  Include:  /

  Schedule:          Yearly_Full
    Type:            Full Backup
    Retention Level: 9 (infinity)
    Calendar sched: Enabled
      SPECIFIC DATE 0 - 03/11/2006
      SPECIFIC DATE 1 - 03/18/2006
      SPECIFIC DATE 2 - 01/07/2007
      SPECIFIC DATE 3 - 01/06/2008
      SPECIFIC DATE 4 - 01/04/2009
      SPECIFIC DATE 5 - 01/09/2011
    Daily Windows:
          Sunday     14:00:00  -->  Monday     06:00:00

  Schedule:          Monthly_Full
    Type:            Full Backup
    Retention Level: 8 (1 year)
    Calendar sched: Enabled
      Sunday, Week 1
      EXCLUDE DATE 0 - 01/06/2007
      EXCLUDE DATE 1 - 01/07/2007
      EXCLUDE DATE 2 - 01/05/2008
      EXCLUDE DATE 3 - 01/03/2009
    Daily Windows:
          Sunday     14:00:00  -->  Sunday     21:00:00

  Schedule:          Weekly_Full
    Type:            Full Backup
    Retention Level: 3 (1 month)
    Calendar sched: Enabled
      Sunday, Week 2
      Sunday, Week 3
      Sunday, Week 4
      Sunday, Week 5
      EXCLUDE DATE 0 - 03/11/2006
      EXCLUDE DATE 1 - 03/18/2006
      EXCLUDE DATE 2 - 01/09/2011
    Daily Windows:
          Sunday     14:00:00  -->  Sunday     21:00:00

  Schedule:          Daily_Incremental
    Type:            Differential Incremental Backup
    Retention Level: 1 (2 weeks)
    Residence:       wayback-disk_staging_unit
    Calendar sched: Enabled
      Tuesday, Week 1
      Wednesday, Week 1
      Thursday, Week 1
      Friday, Week 1
      Saturday, Week 1
      Tuesday, Week 2
      Wednesday, Week 2
      Thursday, Week 2
      Friday, Week 2
      Saturday, Week 2
      Tuesday, Week 3
      Wednesday, Week 3
      Thursday, Week 3
      Friday, Week 3
      Saturday, Week 3
      Tuesday, Week 4
      Wednesday, Week 4
      Thursday, Week 4
      Friday, Week 4
      Saturday, Week 4
      Tuesday, Week 5
      Wednesday, Week 5
      Thursday, Week 5
      Friday, Week 5
      Saturday, Week 5
    Daily Windows:
          Tuesday    01:30:00  -->  Tuesday    05:30:00
          Wednesday  01:30:00  -->  Wednesday  05:30:00
          Thursday   01:30:00  -->  Thursday   05:30:00
          Friday     01:30:00  -->  Friday     05:30:00
          Saturday   01:30:00  -->  Saturday   05:30:00