Veritas-bu

RES: [Veritas-bu] trylogs

2005-01-24 18:57:00
Subject: RES: [Veritas-bu] trylogs
From: carlos_listas AT yahoo.com DOT br (Carlos Alberto Lima dos Santos)
Date: Mon, 24 Jan 2005 21:57:00 -0200
        This is a script made by David Chapa in this forum, to calculate the
client throughput I use in the versions 4.5 and 5.0 without problems.

#!/bin/ksh 
#
#       PLEASE DO NOT MODIFY THE SCRIPT HEADER INFORMATION              #
#                                                                       #
#########################################################################
#                                                                       #
# Script to report average throughput for a particular client(s)        #
# This may be passed an individual client name or a file containing     #
# the clients to report on.                                             #
#                                                                       #
# David A. Chapa                                                        #
#                                                                       #
#                                                                       #
#       This script generates a status report for average               #
#       throughput for backups, restores and duplication jobs           #
#                                                                       #
#       Set up with options on the command line                         #
#       Directory for each client reported on created                   #
#       under the report_dir location.                                  #
#                                                                       #
#       NOTE: This has not been fully tested on NB 4.5, while all of    #
#             the CLI's should still work, there may be some variations #
#########################################################################
#
#       --NetBackup Paths--
VRTS=/usr/openv
NBBIN=$VRTS/netbackup/bin
ADMCMD=$NBBIN/admincmd
VMBIN=$VRTS/volmgr/bin
#  
#       --Working Directory--
#         You Define These
special=/usr/openv/netbackup/special
report_dir=$special/logs/clntreport
# Sleep_timer is used to determine if there are active Backup Jobs
# currently running at the time the clnt_thruput.sh script is running.
# If there are active jobs it will SLEEP for $sleep_timer number of 
# seconds.  
#
# If you have an active environment and do not want this feature 
# turned on, be sure to use the IMMEDIATE switch on the command
# line.
sleep_timer=600 #Default 5 minutes or 600 seconds
#
#       --STD Header--
Hostname=`/bin/uname -n`
Me=`basename $0`
#
#       --Script Environment--
master_server=`$ADMCMD/bpgetconfig | head -1 | awk '{print $3}'`
# Who to send this (ese) report(s) to
someone_who_cares=david AT datastaff DOT com
AWKPROG=/tmp/clntawk.prog
stats=/tmp/clntnb.stats
DATE=`date +%m%d%y_%H%M%S`
clntname=""
clntfile=""
hoursago=24
parameters=$#
#
#       ---Functions---
#
#
fileusage()
{
echo "Error: Can not find Client file"
echo "       Please use absolute path"
}
not_enough()
{
echo "Error: Not enough options"
echo "Must either submit a client name OR a client name file."
echo ""
}
too_many()
{
echo "Error: Too many options"
echo "Must either submit a client name OR a client name file."
echo ""
}
usage()
{
echo "
Usage:

clnt_thruput.sh [-c <ClientName>|-f <file>] -hours <PreviewHours|Default
24Hrs> [-i]

-c      Valid NetBackup Client | -f Optionally you may pass the script 
                                    an ascii file containing a list of
clients, 
                                    one per line.

-hours  Number of hours to preview for report
-i      Optional Force flag.  Signals script run report regardless of any
ACTIVE jobs
-h      Display this message
"
}
reportclean()
{
if [ -s $AWKPROG ]
then
#       echo "cleaning AWKPROG $AWKPROG"
        rm $AWKPROG
fi

if [ -s $stats ]
then
        echo "cleaning stats"
        rm $stats
fi
}
thruputformat() 
{
echo "\n             => Backup <="  >>$OUTPUT
 cat $stats | grep -v duplicate | grep -v restore |
 awk -F\, '{print $NF}' |
 awk -f $AWKPROG >>$OUTPUT

echo "\n             => Restore <=" >>$OUTPUT
 cat $stats  | grep restore |
 awk -F\, '{print $NF}' |
 awk -f $AWKPROG >>$OUTPUT
echo "" >> $OUTPUT
echo
"<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
><><" >> $OUTPUT
echo "" >> $OUTPUT
}
#
#       ---End Functions---
#
#       ---Begin Script---
reportclean
#               Create an awk program file to be used later
echo '
    BEGIN {Kbytes=0;thruput=0;items=0}

    $2=="Kbytes" && $3=="at" {Kbytes+=$1; thruput+=$4;items++}
    $1=="total" && $2=="Kbytes" {Kbytes+=$3; thruput+=$5;items++}
    $2=="total" && $5=="Kbytes" {Kbytes+=$4; thruput+=$7;items++}

    END {
        print "Total Volume: " (Kbytes/1024)/1024 " Gbytes";
        if  (items>0) {print "Average Throughput: " thruput/items "
KBytes/sec    "int(((thruput/items)*60)/1024) " MBytes/min"}
        }
    '> $AWKPROG 
if [ $parameters -eq 0 ];then
usage
exit 2
elif [ $parameters -eq 1 ];then
        if [ "$1" = "-h" ];then
        usage
        exit 0
        else
        echo "Error: Unrecognized Number of options"
        echo ""
        usage
        exit 2
        fi
fi
#
#       --Get Parameters--
#
for i in `echo $@`  
 do
  if [ "$i" = "-f" ];then
   shift 
    clntfile=$1
   shift
   

  elif [ "$i" = "-hours" ];then
   shift 
    hoursago=$1
   shift
    

  elif [ "$i" = "-c" ];then
   shift
    clntname=$1
   shift
   

  elif [ "$i" = "-i" ];then
   shift 
    IMMEDIATE=0

  fi
done

if [ "$clntname"x = "x" -a "$clntfile"x = "x" ];then
 not_enough
  usage
   exit 2
elif [ "$clntname"x != "x" -a "$clntfile"x != "x" ];then
 too_many
  usage
   exit 2
fi

if [ "$clntname"x = "x" -a "$clntfile"x != "x" ];then
 ls $clntfile > /dev/null 2>&1

  if [ $? -ne 0 ];then
   fileusage
    exit 2
  else
    clnt=`cat $clntfile`
  fi

elif [ "$clntname" != "" -a "$clntfile"x = "x" ];then
 clnt=$clntname
fi

for client in $clnt
do
 if [ ! -d $report_dir/$client ];then
  mkdir -p $report_dir/$client
 fi

 OUTPUT=$report_dir/$client/thruput_stats.$DATE
#
#       Check to see if this is a force
#
 if [ "$IMMEDIATE"x = "x" ];then
  echo "Checking for Active Jobs..."
   $ADMCMD/bpdbjobs -M $master_server -report | grep Active >/dev/null
    NOJOBS=$?
#
    until [ $NOJOBS -ne 0 ]
     do
      echo "Found Active Jobs...waiting"
       sleep $sleep_timer
        $admcmd/bpdbjobs -M $master_server report | grep Active >/dev/null
         NOJOBS=$?
     done
 fi
#
#       Now the report can be run on the thruput.
#
 echo "Beginning Thruput Report for client $client"
  $ADMCMD/bperror -M $master_server -hoursago $hoursago -client $client|grep
Kbytes/sec > $stats
   echo "\t \t    Total Client Thruput Summary Report">>$OUTPUT
    echo
"___________________________________________________________________________
____" >>$OUTPUT
     echo "\t`date`\n" >>$OUTPUT
      echo "\t \t \t   CLIENT THRUPUT REPORT">> $OUTPUT
       echo "\t \t \t \t$client" >>$OUTPUT
        echo "">> $OUTPUT
         echo "\t \t \t      >>AGGREGATE<<" >> $OUTPUT
          echo "">> $OUTPUT
           echo "\t \t \t     Master:$master_server" >> $OUTPUT
            echo "" >> $OUTPUT
             echo "Reports on the client performance in the NetBackup Master
Server's domain" >> $OUTPUT
            echo "" >> $OUTPUT
           echo "The first section reports on the average speeds across all"
>> $OUTPUT
          echo "NetBackup Servers in $master_server's domain" >> $OUTPUT
         echo "" >> $OUTPUT
        echo "Each subsequent section reports on the average speeds" >>
$OUTPUT
       echo "per media server for this particular client" >> $OUTPUT
      echo "" >> $OUTPUT
     echo "Reporting on the previous $hoursago hours" >>$OUTPUT
   echo
"___________________________________________________________________________
____" >>$OUTPUT
#
#               Call Thruput function
 thruputformat
#
#               Find all Media Servers to report on
#
  $ADMCMD/bpstulist -L | grep Host | sort -u| awk '{print $3}' | 
  while read mediaserver
   do
    $ADMCMD/bperror -M $master_server -server $mediaserver -client $client
-hoursago $hoursago | 
     grep Kbytes/sec > $stats
      echo
"===========================================================================
====" >>$OUTPUT
       echo "\n\t`date`" >>$OUTPUT
        echo "\t \t \t   CLIENT THRUPUT REPORT">> $OUTPUT
         echo "\t \t \t \t$client" >>$OUTPUT
          echo "">> $OUTPUT
           echo "\t \t \t      >>$mediaserver<<" >> $OUTPUT
            echo "">> $OUTPUT
             echo "The following reports on the average speeds for NetBackup
Media Server $mediaserver" >> $OUTPUT
              echo "" >> $OUTPUT
               echo "                      Reporting on the previous
$hoursago hours" >>$OUTPUT
        echo
"===========================================================================
====" >>$OUTPUT
#
#               Call Thruput function
       thruputformat
#
   done
#
# Uncomment if you want this to be delivered to someone_who_cares
#cat $OUTPUT | mailx -s "Thru-put Stats Summary for $client"
$someone_who_cares
Done

T+ 

-----Mensagem original-----
De: veritas-bu-admin AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu] Em nome de N. Z.
Enviada em: segunda-feira, 24 de janeiro de 2005 18:46
Para: veritas-bu AT mailman.eng.auburn DOT edu
Assunto: [Veritas-bu] trylogs

Hello all,

We've recently upgraded to NetBackup 4.5GA on our Solaris 8 Sun box which
acts as our NetBackup Server.
I would like to know if there is a way to increase verbosity or have the
trylogs print more details (files i'm referring to are in
~/netbackup/db/jobs/trylogs).

This would help us greatly as we have a script that looks in these files to
gather and display transfer speeds of backups. This has been working fine
prior to our upgrade (3.x) and now the contents of these files have minimal
data while the backup is in process (ie, it doesnt show transfer speeds or
other/more detailed info anymore):

# more 177029.t
Try 1
PROCESS 1106585977 9037 bpbrm
CONNECT 1106585977
CONNECTED 1106585977
MOUNTED 1106585978
POSITIONING 1106585978 000481 17
POSITIONED 1106585996
BEGIN_WRITING 1106585996
#

Thanks in advance, I tried looking for a trylog from when more data was
written to it, but it seems our old logs have been removed.


                
__________________________________
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250
_______________________________________________
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>