CRAZYROV STUDIO

perl scriptNetWorker Client Backup Volume Report

This script when run with the applicable switches will grab the backup volume(capacity) information for the past week. This script can be used to analyse the full and incremental backup volume patterns. Also, you can use this script verify the total volume backed up by for a client to be compared to the original volume information during new implementations.
This script was developed and tested on
  • Platform : Linux and UNIX
  • Application : DELL EMC NetWorker 8.2/9.1

Prerequisites


There are a few perquisites that you need to meet before using this script.
  • NetWorker client and extended client binaries are instaleld on the system where the script will be run
  • In case you are running this for a NetWorker 9.x system please run nsrlogin before running this script so that you have a valid auth token assigned to your session.

Input


The script takes in 2 inputs, the server name and the client name. Where the server name is optional but the client name is mandatory.

SYNTAX :
get_total_time_size.sh [ -s backup_server_hostname ] [ -c client_hostname ]

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.

[rovin@nwserver script_sandbox]$ ./get_backup_duration_total.sh -s nwserver -c nwclient

Date        Total Time(minutes)        Total Size(GB)

01/21/2018        448        495.11
01/22/2018        459        481.23
01/23/2018        460        500.23
01/24/2018        455        521.78
01/25/2018        468        537.59
01/26/2018        522        548.43
01/27/2018        249        282.92

get_total_time_size.sh

    #!/bin/ksh

get_duration(){
        ONE=`date -d "$1" +%s`
        TWO=`date -d "$2" +%s`

        ONE=$((ONE + 0))
        TWO=$((TWO + 0))

        DIFF=$((TWO - ONE))
        #DIFF=$((DIFF/60))
        #DIFF=`awk "BEGIN { printf \"%.2f\n\", $DIFF/60 } "`
        echo "$DIFF "
        }

# Listen to user entered options

while getopts :s:c: arg; do
   case $arg in
      s)  BACKUP_SERVER=$OPTARG;;
      c)  CLIENT=$OPTARG;;
      esac
   done

shift `expr $OPTIND - 1 `

#Gather the raw information from the respective backup server
`mminfo -s $BACKUP_SERVER -avot -c $CLIENT -r "sscreate(22),sscomp(22),sumsize(22)" -t "last week" -xc, > /tmp/output.txt`
`sed -i '1d' /tmp/output.txt`


TEMP=`head -1 /tmp/output.txt | awk '{ print $1 }'`

TOTAL_DURATION=0
TOTAL_SIZE=0
echo
echo "Date              Total Time(minutes)             Total Size(GB)"
while IFS='' read -r line || [[ -n "$line" ]]; do
        if [ $TEMP == `echo $line | awk '{ print $1 }'` ]
        then
        START=`echo "$line" | awk -F ',' '{ print $1 }'`
        END=`echo "$line" | awk -F ',' '{ print $2 }'`
        SIZE=`echo "$line" | awk -F ',' '{ print $3 }'`
        TEMP_DURATION=$(get_duration "$START" "$END")
        TOTAL_DURATION=$((TOTAL_DURATION+TEMP_DURATION))
        SIZE=$((SIZE + 0))
        TOTAL_SIZE=$((TOTAL_SIZE + SIZE))
        else

        TOTAL_MIN=$(($TOTAL_DURATION/60))
        TOTAL_SIZE=`awk "BEGIN { printf \"%.2f\n\", $TOTAL_SIZE/1024/1024/1024 } "`
        echo "$TEMP             $TOTAL_MIN                      $TOTAL_SIZE"
        TEMP=`echo $line | awk '{ print $1 }'`

        TOTAL_DURATION=0
        START=`echo "$line" | awk -F ',' '{ print $1 }'`
        END=`echo "$line" | awk -F ',' '{ print $2 }'`
        SIZE=`echo "$line" | awk -F ',' '{ print $3 }'`
        TEMP_DURATION=$(get_duration "$START" "$END")
        TOTAL_DURATION=$((TOTAL_DURATION+TEMP_DURATION))
        SIZE=$((SIZE + 0))
        TOTAL_SIZE=$((TOTAL_SIZE + SIZE))
        fi

done < "/tmp/output.txt"
TOTAL_MIN=$(($TOTAL_DURATION/60))
TOTAL_SIZE=`awk "BEGIN { printf \"%.2f\n\", $TOTAL_SIZE/1024/1024/1024 } "`
echo "$TEMP             $TOTAL_MIN                      $TOTAL_SIZE"
echo

rm /tmp/output.txt

Support/Contact

Email your feedback to support@crazyrov.com.

CRAZYROVSTUDIO