Forum Discussion

Mark_Donaldson's avatar
2 months ago
Solved

Images being held waiting on SLP completion

I just cancelled a multi-petabyte backlog of SLP replications to a remote AIR target.  nbstlutil told me that if I did it I would be expiring images that were being held for replication.  This is fine - my remote copies are retained for less time than my local copies.

So, I'm keeping my local copy for 2 months & my remote copy for 2 weeks (It's just a DR copy, we only need the latest version over there.  The local copies are for historical recovery). 

If, for some reason, I haven't replicated an image after 2 weeks, I don't care about replicating it anymore.  If it had been replicated, it would've been expired already.  But,SLP's are persistent little buggers and will happily try until the end of time to get a copy over there.

I want to ID these images over 2 weeks old that haven't replicated yet and cancel them.  Better yet, is there a parameter for SLP's that says, "give up on this image after X many hours"?

I think I need to build a script around nbstlutil but I can't figure out which params I need to identify uncompleted image replications.

Thoughts, anyone?
-Mark

  • Hi,  Just thought you  might want my solution that I made following your example above.

    I send the output to a file with a csv extension and mail it to myself.

    export PATH=$PATH:/usr/openv/netbackup/bin/admincmd
    echo "Policy,Backup ID,Size (KB),Epoch Time,Date" >/tmp/output.csv
    for bpid in `nbstlutil list -image_incomplete -b`
    do
      bpimagelist -backupid $bpid | \
        awk '{if($1=="IMAGE"){policy=$7
                              bpid=$6
                              k=split($6,array,"_")
                              size=$19
                              timestamp=array[k]
                              printf("%s,%s,%d,%s,%s\n",policy,bpid,size,timestamp,strftime("%b %e %Y %H:%M",timestamp))}}'
    done | sort -nk4 -t','  >>/tmp/output.csv
    echo "See attached report" | mail -a /tmp/output.csv -s "Backlog Report" someone@mycompany.com

    It makes pretty columns, sorts it, and adds policy information per image.

  • The first step is knowing you've got a problem, then you can worry about what to do with it. =) 

    Running something like the below daily via cron might be useful, and ought to give you a base to work off of to expire images that you no longer need. I'm the sure the code could be tightened up a bit if desired as well, most of my stuff tends towards brute-force vs elegance. 

    #!/bin/sh
    
    SOMEONE_WHO_CARES=me@mycompany.com
    
    # Run the backlog report and mail it out
    
    DATE=`date "+%m%d%y_%H%M"`
    BPDBM=/usr/openv/netbackup/bin/bpdbm
    NBSTLUTIL=/usr/openv/netbackup/bin/admincmd/nbstlutil
    
    OUTPUT=/tmp/backlog_report.txt
    BACKLOG_FILE=/tmp/backlog.tmp
    
    ${NBSTLUTIL} report > ${OUTPUT}
    ${NBSTLUTIL} list -image_incomplete -b > ${BACKLOG_FILE}
    OLDEST_STAMP=`awk -F_ '{print $NF}' ${BACKLOG_FILE} |sort -n |head -1`
    if [ ${OLDEST_STAMP} ];then
            OLDEST_IMAGE=`grep ${OLDEST_STAMP} ${BACKLOG_FILE}`
            echo >> ${OUTPUT}
            printf "Oldest Image =\t${OLDEST_IMAGE}\n" >> ${OUTPUT}
            printf "Backup date =\t`${BPDBM} -ctime ${OLDEST_STAMP} |awk '{$1="";$2="";print}'`\n" >> ${OUTPUT}
            printf "SLP = \t\t`${NBSTLUTIL} list -backupid ${OLDEST_IMAGE} -rt I |awk '{print $10}'`\n" >> ${OUTPUT}
    fi
    
    mailx -s "`hostname` backlog report for $DATE" ${SOMEONE_WHO_CARES} < ${OUTPUT}
    
    rm ${OUTPUT} ${BACKLOG_FILE}
    

     

    • Mark_Donaldson's avatar
      Mark_Donaldson
      Level 3

      Hi,  Just thought you  might want my solution that I made following your example above.

      I send the output to a file with a csv extension and mail it to myself.

      export PATH=$PATH:/usr/openv/netbackup/bin/admincmd
      echo "Policy,Backup ID,Size (KB),Epoch Time,Date" >/tmp/output.csv
      for bpid in `nbstlutil list -image_incomplete -b`
      do
        bpimagelist -backupid $bpid | \
          awk '{if($1=="IMAGE"){policy=$7
                                bpid=$6
                                k=split($6,array,"_")
                                size=$19
                                timestamp=array[k]
                                printf("%s,%s,%d,%s,%s\n",policy,bpid,size,timestamp,strftime("%b %e %Y %H:%M",timestamp))}}'
      done | sort -nk4 -t','  >>/tmp/output.csv
      echo "See attached report" | mail -a /tmp/output.csv -s "Backlog Report" someone@mycompany.com

      It makes pretty columns, sorts it, and adds policy information per image.