Veritas-bu

[Veritas-bu] tapes ready for backup

2004-06-18 13:46:42
Subject: [Veritas-bu] tapes ready for backup
From: scottd AT HanoverDirect DOT com (Deiter Scott)
Date: Fri, 18 Jun 2004 13:46:42 -0400
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_01C4555C.3747D434
Content-Type: text/plain;
        charset="iso-8859-1"

  we have been bitten twice with error status 96 friday evenings and
saturday mornings (YUK)

i have attached the available_media script with our changes that creates a
report to mail to
any one who cares. NBAdmin in our case sends to the operators and us on-call
junkies.

This is the best have come up with so far.
Any suggestions or comments are welcome.



>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
Mark.Donaldson AT cexp DOT com
Sent: Friday, June 18, 2004 11:55 AM
To: Mark.Donaldson AT cexp DOT com; esm AT mnemonic DOT no;
veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] tapes ready for backup


oops!

Add a "-w" to the vmquery for wide output.

-----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 Donaldson,
Mark - Broomfield, CO
Sent: Thursday, June 17, 2004 7:51 PM
To: esm AT mnemonic DOT no; veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] tapes ready for backup


vmquery should be able to do this.  Empty tapes, ready for reuse, will have
an "Assigned time" (field 20 in the wide output) of "00/00/0000".  The
vmquery command will also accept a pool-name as a limiter in the output.

So something like:

vmquery -pn <poolname> | awk 'NR>3 && $3!~/CLN/ && $20~/00.00.00/ {print
$1}'

(the third field restriction keeps it from identifying cleaning tapes,
although the poolname would probably take care of that... the "NR" check
just skips the header on the output)

-M

-----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 Espen
Martinsen
Sent: Thursday, June 17, 2004 3:52 AM
To: veritas-bu AT mailman.eng.auburn DOT edu
Cc: Espen Martinsen
Subject: [Veritas-bu] tapes ready for backup


hi,
   How can i on a command-line
    list which tapes are ready to be used for backup in
    a specific pool. that is, which tape has only backups with 
    retension-periods that is expired?


-- 
Yours
--------------------------------------------------------------
Espen Martinsen                       Email : esm AT mnemonic DOT no
Mnemonic AS, Waldemar Thranesgt. 77   Phone : +47 2299 9710/00
                                      Mobil : +47 915 88 485
N-0175 Oslo, NORWAY                   Fax   : +47 2299 9701
--------------------------------------------------------------
(PADI AOW 87191)                       http://www.mnemonic.no/
pgp print =  99CD 4027 36F4 0A4F 68DA 2925 327A 5BCF 9C21 F277


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


------_=_NextPart_000_01C4555C.3747D434
Content-Type: application/octet-stream;
        name="tapecheck"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
        filename="tapecheck"

#! /bin/sh
# $Header: available_media.sh,v 1.11 2002/02/11 20:58:48 glt Stab $
#
#bcpyrght
#***********************************************************************=
****
#* $VRTScprght: Copyright 1993 - 2002 VERITAS Software Corporation, All =
Rights Reserved $ *
#***********************************************************************=
****
#ecpyrght
#
#  available_media
#
#  This script can be used by an administrator as a convenient way to=20
#  list ALL NetBackup volumes in the Media Manager volume database, and =

#  augment that list with information on the volumes currently =
"assigned"=20
#  to NetBackup.
#  The major benefit of this script is that it eliminates the need to =
track
#  information from multiple databases and do the correlation manually.
#
#  This script can be used in a crontab entry to get periodic reports =
of=20
#  available media.
#
#  caveat:
#     this script assumes that the Media Manager database and NetBackup =

#     media database are both resident on the host where this script is =
run.
#

# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
# June 14, 2004 SKD Modified version of available_media
# Used to determine if enough tapes are available for backups.
# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
get_med_type()
{
        if [ "${vmediatype}" =3D "REWR_OPT" ]
        then
                vmediatype=3D"REWR_OPT"
        elif [ "${vmediatype}" =3D "WORM_OPT" ]
        then
                vmediatype=3D"WORM_OPT"
        elif [ "${vmediatype}" =3D "T120" ]
        then
                vmediatype=3D"T120    "
        elif [ "${vmediatype}" =3D "8MM" ]
        then
                vmediatype=3D"8MM     "
        elif [ "${vmediatype}" =3D "8MM_CLN" ]
        then
                vmediatype=3D"8MM_CLN "
        elif [ "${vmediatype}" =3D "HCART" ]
        then
                vmediatype=3D"HCART   "
        elif [ "${vmediatype}" =3D "HREEL" ]
        then
                vmediatype=3D"HREEL   "
        elif [ "${vmediatype}" =3D "QCART" ]
        then
                vmediatype=3D"QCART   "
        elif [ "${vmediatype}" =3D "4MM" ]
        then
                vmediatype=3D"4MM     "
        elif [ "${vmediatype}" =3D "4MM_CLN" ]
        then
                vmediatype=3D"4MM_CLN "
        elif [ "${vmediatype}" =3D "DLT" ]
        then
                vmediatype=3D"DLT     "
        elif [ "${vmediatype}" =3D "DLT_CLN" ]
        then
                vmediatype=3D"DLT_CLN "
        elif [ "${vmediatype}" =3D "HC_CLN" ]
        then
                vmediatype=3D"HC_CLN  "
        elif [ "${vmediatype}" =3D "HCART2" ]
        then
                vmediatype=3D"HCART2  "
        elif [ "${vmediatype}" =3D "HC2_CLN" ]
        then
                vmediatype=3D"HC2_CLN "
        elif [ "${vmediatype}" =3D "HCART3" ]
        then
                vmediatype=3D"HCART3  "
        elif [ "${vmediatype}" =3D "HC3_CLN" ]
        then
                vmediatype=3D"HC3_CLN "
        elif [ "${vmediatype}" =3D "DLT2" ]
        then
                vmediatype=3D"DLT2    "
        elif [ "${vmediatype}" =3D "DLT2_CLN" ]
        then
                vmediatype=3D"DLT_CLN2"
        elif [ "${vmediatype}" =3D "DLT3" ]
        then
                vmediatype=3D"DLT3    "
        elif [ "${vmediatype}" =3D "DLT3_CLN" ]
        then
                vmediatype=3D"DLT_CLN3"
        elif [ "${vmediatype}" =3D "8MM2" ]
        then
                vmediatype=3D"8MM2    "
        elif [ "${vmediatype}" =3D "8MM2_CLN" ]
        then
                vmediatype=3D"8MM2_CLN"
        elif [ "${vmediatype}" =3D "D2" ]
        then
                vmediatype=3D"D2      "
        elif [ "${vmediatype}" =3D "D2_CLN" ]
        then
                vmediatype=3D"D2_CLN  "
        elif [ "${vmediatype}" =3D "DTF" ]
        then
                vmediatype=3D"DTF     "
        elif [ "${vmediatype}" =3D "DTF_CLN" ]
        then
                vmediatype=3D"DTF_CLN "
        elif [ "${vmediatype}" =3D "8MM3" ]
        then
                vmediatype=3D"8MM3    "
        elif [ "${vmediatype}" =3D "8MM3_CLN" ]
        then
                vmediatype=3D"8MM3_CLN"
        fi
}
# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D

if [ "$1" =3D "-usage" ]
then
        echo "usage: $0 [-summary]"
        exit 0
fi

VMQUERY=3D/usr/openv/volmgr/bin/vmquery
VMPOOL=3D/usr/openv/volmgr/bin/vmpool

if [ -f /usr/openv/netbackup/version ]
then
        HARDWARE=3D`head -1 /usr/openv/netbackup/version | cut -f2 -d" "`
else
        echo "/usr/openv/netbackup/version not found"
        exit 1
fi

TR=3D/usr/bin/tr

case "$HARDWARE" in
        SUN4)
                TR=3D/bin/tr
                ;;
        RS6000)
                TR=3D/bin/tr
                ;;
        SOLARIS)
                TR=3D/bin/tr
                ;;
esac

/bin/rm -rf /tmp/avail_media_output
/bin/rm -rf /tmp/avail_media_sorted_output
/bin/touch /tmp/avail_media_output

TAB=3D`/bin/echo ' ' | $TR ' ' '\011'`

VMPOOL_OUTPUT=3D/tmp/vmpool_output
/bin/rm -rf $VMPOOL_OUTPUT
touch $VMPOOL_OUTPUT

$VMPOOL -listall -b 2>/dev/null | tail +3 | sort +0 1>$VMPOOL_OUTPUT =
2>/dev/null

VMQUERY_OUTPUT=3D/tmp/vmquery.out
ASTERISK_DISPLAYED=3D/tmp/asterisk_displayed

cat $VMPOOL_OUTPUT |
while read poolname poolhost pooluser poolgroup pooldesc
do
        /bin/rm -rf $VMQUERY_OUTPUT
        /bin/rm -rf /tmp/avail_media_output
        touch $VMQUERY_OUTPUT
        $VMQUERY -pn $poolname -bx 2>/dev/null | tail +4 1>>$VMQUERY_OUTPUT =
2>/dev/null

        cat $VMQUERY_OUTPUT |
        while read vmediaid vmediatype vrobottype vrobotnum vrobotslot vside =
vvol vop vmnts vlmtdate vlmttime vasgndate vasgntime vpool=20
        do
                /bin/rm -rf /tmp/bpmediaid_found

                if [ "${vasgndate}" =3D "---" -a "${vasgntime}" =3D "---" ]
                then
                        bpkbytes=3D"-"
                        bpretlev=3D"-"
                        bpstatus=3DAVAILABLE
                =09
                        get_med_type

                        /bin/echo "$vmediaid${TAB}$vmediatype $vrobottype${TAB} 
 =
$vrobotnum${TAB}  $vrobotslot${TAB} $vside${TAB} $bpretlev     =
$bpkbytes${TAB}$bpstatus" >>/tmp/avail_media_output

                else

                        /usr/openv/netbackup/bin/admincmd/bpmedialist -mlist -l 
-ev =
$vmediaid 2>/dev/null |
                        while read bpmediaid bppartner bpver bpden bpalloc 
bplwrite bpexp =
bplrest bpkbytes bpnimages bpvimages bpretlev bpunused1 bpnumrest =
bpstat bprest
                        do
                                /bin/touch /tmp/bpmediaid_found

                                bpstatus=3D""
                                spaces=3D"     "
                                ismpx=3D0

                                # Translate bpstat into a string

                                if [ "$bpstat" -gt 511 ]
                                then
                                        ismpx=3D1
                                        bpstat=3D`expr $bpstat - 512`
                                fi

                                if [ "$bpstat" -gt 255 ]
                                then
                                        # Ignore this bit.
                                        bpstat=3D`expr $bpstat - 256`
                                fi

                                if [ "$bpstat" -gt 127 ]
                                then
                                        bpstat=3D`expr $bpstat - 128`
                                        bpstatus=3DIMPORTED
                                fi

                                if [ "$bpstat" -gt 63 ]
                                then
                                        bpstat=3D`expr $bpstat - 64`
                                        # Add * on retention level to indicate
                                        # this media id has multiple retention
                                        # levels on it.  Reduce the number of
                                        # spaces to account for the *.
                                        bpretlev=3D${bpretlev}*
                                        spaces=3D"    "
                                        touch $ASTERISK_DISPLAYED
                                fi

                                if [ "$bpstat" -gt 31 ]
                                then
                                        # Ignore this bit.
                                        bpstat=3D`expr $bpstat - 32`
                                fi

                                if [ "$bpstat" -gt 15 ]
                                then
                                        # Ignore this bit.
                                        bpstat=3D`expr $bpstat - 16`
                                fi

                                if [ "$bpstat" -gt 7 ]
                                then
                                        bpstat=3D`expr $bpstat - 8`
                                        if [ X"${bpstatus}" =3D X ]
                                        then
                                                bpstatus=3DFULL
                                        else
                                                bpstatus=3D${bpstatus}/FULL
                                        fi
                                fi

                                if [ "$bpstat" -gt 3 ]
                                then
                                        # Ignore this bit.
                                        bpstat=3D`expr $bpstat - 4`
                                fi

                                if [ "$bpstat" -gt 1 ]
                                then
                                        bpstat=3D`expr $bpstat - 2`
                                        if [ X"${bpstatus}" =3D X ]
                                        then
                                                bpstatus=3DSUSPENDED
                                        else
                                                bpstatus=3D${bpstatus}/SUSPENDED
                                        fi
                                fi

                                if [ "$bpstat" -gt 0 ]
                                then
                                        if [ X"${bpstatus}" =3D X ]
                                        then
                                                bpstatus=3DFROZEN
                                        else
                                                bpstatus=3D${bpstatus}/FROZEN
                                        fi
                                fi
                =09
                                if [ X"${bpstatus}" =3D X ]
                                then
                                        if [ $ismpx -eq 1 ]
                                        then
                                                bpstatus=3DACTIVE/MPX
                                        else
                                                bpstatus=3DACTIVE
                                        fi
                                else
                                        if [ $ismpx -eq 1 ]
                                        then
                                                bpstatus=3D${bpstatus}/MPX
                                        fi
                                fi
        =20
                                get_med_type

                                /bin/echo "$vmediaid${TAB}$vmediatype 
$vrobottype${TAB}  =
$vrobotnum${TAB}  $vrobotslot${TAB} $vside${TAB} =
$bpretlev$spaces$bpkbytes${TAB}$bpstatus" >>/tmp/avail_media_output

                        done

                        if [ ! -f /tmp/bpmediaid_found ]
                        then
                                bpkbytes=3D"-"
                                bpretlev=3D"-"
                                bpstatus=3DDBBACKUP

                                get_med_type

                                /bin/echo "$vmediaid${TAB}$vmediatype 
$vrobottype${TAB}  =
$vrobotnum${TAB}  $vrobotslot${TAB} $vside${TAB} $bpretlev     =
$bpkbytes${TAB}$bpstatus" >>/tmp/avail_media_output

                        fi
                fi
        done

        /bin/echo "$poolname pool" >>/tmp/avail_media_sorted_output
        /bin/echo "" >>/tmp/avail_media_sorted_output

        # Sort the entries on media id.

        if [ -f /tmp/avail_media_output ]
        then
                cat /tmp/avail_media_output | sort +8 +0 >> =
/tmp/avail_media_sorted_output
                /bin/echo "" >>/tmp/avail_media_sorted_output
        fi
done


#/bin/echo =
"media${TAB}media${TAB}robot${TAB}robot${TAB}robot${TAB}side/${TAB}ret  =
  size${TAB}status"
#/bin/echo " ID${TAB}type${TAB}type${TAB}  =
#${TAB}slot${TAB}face${TAB}level  KBytes"
#/bin/echo =
"-----------------------------------------------------------------------=
-----"

#/bin/cat /tmp/avail_media_sorted_output


awk '{ =20
        if ( $2 =3D=3D "pool" ) pool =3D substr($1"          ",1,10)
        if ( NF =3D=3D 9 ) s[pool" "substr($2"          ",1,10)" "$9]++ =

}
END {=20
        for (state in s)=20
                printf("%6d %s\n",s[state],state)=20
     }' /tmp/avail_media_sorted_output | sort +1 > /tmp/medsum

# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

# Begin the email !!! NOTE pool names are trunc'd to 10 bytes !!!
# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=


echo "Subject: server's tape checker" >/tmp/tcmail$$
echo " " >>/tmp/tcmail$$
echo "The tape check ran at " `date` >>/tmp/tcmail$$
echo " " >>/tmp/tcmail$$
=20

# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
# Display the number active and available tapes
# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
cat /tmp/medsum | grep AVAILABLE > /tmp/dispmed
cat /tmp/medsum | grep ACTIVE >> /tmp/dispmed

echo "Summary of active and available tapes by pool:" >>/tmp/tcmail$$
echo "" >>/tmp/tcmail$$
echo "#Media Pool       Type       State" >>/tmp/tcmail$$
echo "------ ---------- ---------- -----" >>/tmp/tcmail$$
cat /tmp/dispmed| sort -k 2 >>/tmp/tcmail$$
=20
# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

# Search the pools for available or active volumes
# =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

nbpools=3D`vmpool -listall -b| tail +3|nawk '{print $1}' |nawk '{print =
substr($1,1,10)}'| sort `
for i in $nbpools;do
  case $i in
 =20
       CatBack)         ;;    =20
       DataStore)       ;;    =20
       Duplicates)      ;;    =20
       None)            ;;    =20
       ScratchPool)     ;;
          *)=20
              grep $i /tmp/dispmed > /dev/null
              if [ $? -gt 0 ]; then
                 echo " " >>/tmp/tcmail$$
                 echo $i has no available or active tapes !! =
>>/tmp/tcmail$$
              fi
              ;;
  esac
done
echo " " >>/tmp/tcmail$$
echo " " >>/tmp/tcmail$$

cat /tmp/tcmail$$ | mail NBAdmin

/bin/rm -rf /tmp/avail_media_sorted_output /tmp/avail_media_output =
$VMQUERY_OUTPUT $VMPOOL_OUTPUT /tmp/medsum /tmp/dispmed /tmp/tcmail$$

------_=_NextPart_000_01C4555C.3747D434--

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