Veritas-bu

[Veritas-bu] CLI Activity Monitor equivalent

2004-11-24 13:24:29
Subject: [Veritas-bu] CLI Activity Monitor equivalent
From: scottd AT HanoverDirect DOT com (Deiter Scott)
Date: Wed, 24 Nov 2004 13:24:29 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C4D252.795730C8
Content-Type: text/plain;
        charset="iso-8859-1"


I did this a while ago because the GUI was not available everywhere.
The clientname (clname) variable must be tweaked for this to be used.
Best of luck.

>From    Scott Deiter 
        Hanover Direct, Inc. 
        Tech services 
        (717) 633-3298 
        scottd AT hanoverdirect DOT com 




-----Original Message-----
From: veritas-bu-admin AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu]On Behalf Of Kevin
Freels
Sent: Wednesday, November 24, 2004 12:56 PM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] CLI Activity Monitor equivalent


Greetings!!

I searched through my archives, but didn't see anything regarding this
exact tip/trick, so my apologies if this slipped past me.

I'm looking for a way via a CLI that I can get a daily output of the
jobs that have run in the last 24 hours and some details of what they
backed up. bperror can do some of this, but it seems to only provide
some of the policy info, not really the stuff you would see in the
"details" in the GUI for a particular job. 

When I run bperror with a "-backstat -U" or "-backstat -L", I get a lot
of info about the status for each job, but I need to see what particular
directories are backed up by the job. Some of these jobs are kicked off
by cron jobs on the client (since we have to wait for the particular
dirs to reach a "settled" state), so bperror reports the client and the
start/end times, but not the dir I specified in the bpbackup command on
the client.

Any hints?

If I need to, I can run a bperror listing based on job ID, parse it out,
and then run info based on each job ID if I have to, but that's a lot of
work if something easier exists!  :-)

As always, thanks for the tips! Happy Thanksgiving!!

....k
-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-
Kevin Freels                         kfreels AT askjeeves DOT com
Senior UNIX SysAdmin                          510.985.7444
Ask Jeeves                                         ask.com
"We keep you alive to serve this ship. Row well and live."

_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu


------_=_NextPart_000_01C4D252.795730C8
Content-Type: text/plain;
        name="sr.txt"
Content-Disposition: attachment;
        filename="sr.txt"

#!/bin/ksh 

# How many days --  The default is one.
days=$1  
days=${days:=1}
let hago=24*$days

rm /tmp/burer
exec 2>/tmp/burer

clname=`basename $0`bk  # client name is the script name plus bk
TR=/usr/bin/tr
TAB=`/bin/echo ' ' | $TR ' ' '\011'`
echo " "
echo " "
echo ">>>> Jobs for "$clname":  For the last "$hago" hours "
echo ">>>> Current date is "`date`
echo " "
echo "JOBID${TAB} DATE${TAB}${TAB}TIME ${TAB} STATE${TAB}      STATUS    
MEDIAID${TAB} PATH"
echo 
'==================================================================================='

joblist=`bperror -client $clname -hoursago $hago   | grep jobid|nawk '{print 
$6}'` 

for i in $joblist; do
   
#####################################################
# # Get the path and file for this job
#####################################################
  bperror -jobid $i -hoursago $hago|grep handlin > /dev/null
  retc=$?
  if (($retc==0)) then
    bupath=`bperror -jobid $i -hoursago $hago |grep handling|nawk '{print $15}'`

    ### If more than one file show the last one only and the + sign
    wrds=`echo $bupath | wc -w` #more then one file ??
    if (( $wrds > 1 )) then      #cut it down to one and add plus sign
      bupath=+`echo $bupath | cut -d' ' -f$wrds`
    fi

    ###Trim the name when necessary 
    plen=${#bupath}
    if (($plen>17)); then
      plus="+"
      let startpos=$plen-16
      bupath=`echo $bupath|nawk '{print substr($1,'$startpos',17)}'`
      bupath=`echo $plus$bupath`
    fi
  else
    bupath='Unknown'
  fi

#####################################################
# # Get the time the job started        
#####################################################
  butime=`bperror -U -jobid $i -hoursago $hago | grep added|nawk '{print  $1"  
" $2}'`

#####################################################
# # Get the job state if the job db hasn't been cleared !!
#####################################################
  bustate=`bpdbjobs | grep ^$i| nawk '{print $3}'`
  bustate=${bustate:=Unknown}
  # # Adjust the state length
  if [ "${bustate}" = "Done" ] ; then bustate='Done   ';fi
  if [ "${bustate}" = "Active" ] ; then bustate='Active ';fi 

#####################################################
# # Get the status (return code) for the job              
#####################################################
  bperror  -jobid $i -hoursago $hago | grep STATUS| grep SCHED > /dev/null
  retc=$?
  if (($retc==0)) then  
    bpstatus=`bperror  -jobid $i -hoursago $hago | grep STATUS|nawk '{print 
$19}'|tail -1`
  else
    bpstatus='unknown'
  fi

#####################################################
# # Get the media used for the job
#####################################################
  bperror -jobid $i -hoursago $hago |grep fragment|grep media > /dev/null
  retc=$?
  if (($retc==0)) then
    bumedia=`bperror -jobid $i -hoursago $hago |grep fragment|grep media|nawk 
'{print $23}'`
    wrds=`echo $bumedia | wc -w` #more then one tape
    if (( $wrds > 1 )) then      #cut it down to one and add plus sign
      bumedia=+`echo $bumedia | cut -b2-6`
    fi
  else
    bumedia='******'
  fi


#####################################################
# # Punch out the job record                              
#####################################################
  echo "$i${TAB} $butime${TAB} $bustate${TAB} $bpstatus${TAB} $bumedia${TAB} 
$bupath"
done

echo " "
echo " "

echo `cat /tmp/burer | wc -l` errors in /tmp/burer
exit

------_=_NextPart_000_01C4D252.795730C8--

<Prev in Thread] Current Thread [Next in Thread>