Veritas-bu

[Veritas-bu] moving media between pool

2003-11-05 11:22:30
Subject: [Veritas-bu] moving media between pool
From: Mark.Donaldson AT experianems DOT com (Donaldson, Mark)
Date: Wed, 5 Nov 2003 09:22:30 -0700
Here's one in english (I run twice daily via cron):

#!/bin/ksh
## Auto_ScratchPool
## This script is used to identify all tapes which are available for
## use (all expired images) but are not in the "ScratchPool" and change
## them to be in the Scratchpool.  This should increase tape availability
## for all Classes of backups.

# Mark Donaldson - Nov 11, 1999 - Created
# MDD  3/14/2001 - Remove need to have tape in robot to set back to
Scratchpool
#                  Should be able to expire anywhere it is located.  Will
track
#                  Offsite & Cabinet stuff with Volume Groups.
# MDD  8/27/2002 - Removed logging stuff and neatened the code a little
# MDD 12/01/2002 - Confirmed OK for multilibrary - added mailed report
#     12/17/2002 - Added bpexpdate -deassignempty
#     11/04/2003 - Added check for verifying minimum scratch tapes
#                  Pulled bpexpdate -deassignempty

export PATH=$PATH:/usr/openv/volmgr/bin:/usr/openv/netbackup/bin/admincmd
LOGFILE=/usr/openv/netbackup/logs/`basename $0`.log

#Threshhold for alerting to low scratch tape count
LOW=2

#exec 1>$LOGFILE 2>&1
echo "`basename $0` started at `date`."

MAILADDR=you AT yourdomain DOT com

# Note: vmquery col  1 is tape number
#               col  3 is tape type
#               col  8 is robot number
#               col  9 is slot number
#               col 12 is poolname
#               col 20 is "assigned" date
#               col 28 is status code (0=regular backups, 1=NB DB, 2=HSM)

#Now lookup scratchpool pool number. First get name, then get pool number
SPname=`vmpool -listscratch | tail -1`
SPnum=`vmpool -listall | \
   awk -F: '$1=="pool number" {pn=$2}
            $1=="pool name" && $2~/^ *'$SPname'$/ {print pn}'`
tapelist=`vmquery -a -w |  awk '$3 !~ /CLN/ && \
                               $20 ~  /^00/ && \
                               $12 != "'$SPname'" && \
                               $28 == 0 {print $1}' `
for eachtape in $tapelist
do
  #Tape available for reassignment to scratchpool.
  echo "Changing $eachtape to $SPname pool."
  vmchange -p $SPnum -m $eachtape
done
for robnum in `tpconfig -l | awk '$1=="robot" {print $2}'`
do
  count=`vmquery -pn $SPname -w| awk 'BEGIN {sum=0}
                                 {if ($8=='$robnum') {sum++}}
                                 END {print sum}`
  if [ $count -le $LOW ]
  then
    echo "Only $count scratch tapes left in library number ${robnum}." | \
    mailx -s "Low scratch tape warning from library $robnum" $MAILADDR
  fi
done
exit

-----Original Message-----
From: Renato Fabene [mailto:renato.fabene AT primesys.com DOT br]
Sent: Wednesday, November 05, 2003 8:42 AM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] moving media between pool


Hi,

I use this scripts to change any Volume Pool that media expire to go to
Volumne pool "Scratch"

more /usr/openv/netbackup/bin/scratch.sh
#!/bin/ksh
clear
#echo "Entre com o pool number do pool Scratch (para verificar isso, de um
vmpool)"
#read POOLNUMBER
echo "------------------------------------------------------"
date
POOLNUMBER=$1
CONTADOR=1
pool=0
/usr/openv/netbackup/bin/admincmd/bpmedialist -l >/tmp/bpmlist.txt
/usr/openv/volmgr/bin/vmquery -b -a >/tmp/vmquery.txt

T=`wc -l /tmp/vmquery.txt|awk '{print $1}'`
TAPESTOTAL=`expr $T - 3`
TAPESASS=`wc -l /tmp/bpmlist.txt|awk '{print $1}'`


tail -$TAPESTOTAL /tmp/vmquery.txt|awk '{print $1}' >/tmp/vmtotal.txt
awk '{print $1}' /tmp/bpmlist.txt>/tmp/assigned.txt


echo "Total de fitas auditadas pelo Netbackup: $TAPESTOTAL" >
/tmp/lista.fita
echo "Total de fitas assigned................: $TAPESASS" >> /tmp/lista.fita

TAPESCRATCH=1
while [ $CONTADOR -le $TAPESTOTAL ]
        do
        ID=`awk 'NR == '$CONTADOR /tmp/vmtotal.txt`
        /usr/openv/volmgr/bin/vmquery -m $ID>/tmp/query.txt
        ASSQUERY=`cat /tmp/query.txt|awk 'NR == 13'|awk '{print $2}'`
        POOLQUERY=`cat /tmp/query.txt|awk 'NR == 6'|awk '{print $3}'`
        if [ $ASSQUERY = "---" ]
                then
                if [ $POOLQUERY != "Scratch" ]
                then
                        echo A MIDIA ID: $ID PERTENCENTE AO POOL: $POOLQUERY
ESTA EXPIRADA!
                        #echo "DESEJA ALTERA-LA PARA SCRATCH???? (S/N)???"
                        #read ANSWER
                        #if [ $ANSWER = "s" ]
                        #       then
                                /usr/openv/volmgr/bin/vmchange -p
$POOLNUMBER -m $ID
                                echo FITA TROCADA PARA SCRATCH
                                TAPESCRATCH=`expr $TAPESCRATCH + 1`
                        #fi
                fi
        fi
        CONTADOR=`expr $CONTADOR + 1`
        done

echo "Total de fitas movidas p/ scratches.....: $TAPESCRATCH" >>
/tmp/lista.fita
pool=`/usr/openv/volmgr/bin/vmquery -b -pn Scratch  |grep DLT |  wc -l`
echo "Total de Fitas em Scratch...............: $pool" >> /tmp/lista.fita
echo "----------------------------------------------------"  >>
/tmp/lista.fita

for i in `cat /usr/openv/netbackup/lista.email1`

do

   mailx -s "Audit de fitas do netbackup - " $i < /tmp/lista.fita

done

cat /tmp/lista.fita
echo "----------------------------------------------------"


Message: 7
From: "Donaldson, Mark" <Mark.Donaldson AT experianems DOT com>
To: "'Feroz F. Basir'" <dbase77 AT yahoo DOT com>
Cc: veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] moving media between pool
Date: Tue, 4 Nov 2003 10:34:14 -0700

Note, only media that hasn't been assigned (no backups on it) can have its
pool changed.
-M


-----Original Message-----
From: Feroz F. Basir [mailto:dbase77 AT yahoo DOT com]
Sent: Tuesday, November 04, 2003 10:02 AM
To: scott.kendall AT abbott DOT com
Cc: veritas-bu AT mailman.eng.auburn DOT edu
Subject: Re: [Veritas-bu] moving media between pool


Hi,

Thank you for replying. I read vmchange manual and can
you comfirm this is the correct syntax to move media
between pool.

vmchange -h hostname -p pool_num -m mediaid

to get pool_num run "vmpool -listall"

Thank you again.

regards,
Feroz Basir

_______________________________________________
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>