Veritas-bu

[Veritas-bu] count of scratch tapes

2006-05-23 14:59:16
Subject: [Veritas-bu] count of scratch tapes
From: Bluejay at fujigreenwood.com (Bluejay AT fujigreenwood DOT com)
Date: Tue, 23 May 2006 14:59:16 -0400
> Is there a good way to output the number or tapes within a pool or 
> robot, ie: to count the number of SCRATCH tapes within a robot?

You could do something like this, which assumes TLD libraries and works 
with Netbackup V4.5 on Tru64:

#!/bin/ksh

# Show the number of free tapes, and the total number of tapes in each 
media
# pool by library

for POOL in `vmpool -listall -b | tail +3 | cut -d " " -f 1` ; do
   HEADER=0
   for LIBNAM in `tpconfig -d | grep 'TLD(' | awk '{print $1}' | sort -u` 
; do
      LIB=${LIBNAM#TLD\(} ; LIB=${LIB%\)}
      TOTL=`vmquery -w -pn $POOL | awk "\\$8 == \"${LIB}\" { print \\$0 }" 
| wc -l`
      if [[ $TOTL -eq 0 ]] ; then continue ; fi
      FREE=`vmquery -w -pn $POOL | awk "\\$20==\"00/00/0000\" && \\$8 == 
\"${LIB}\" { print \\$0 }" | wc -l`
      if [[ $HEADER -eq 0 ]] ; then echo $POOL ; HEADER=1 ; fi
      echo "   lib$LIB: $FREE / $TOTL"
   done
   TOTL=`vmquery -w -pn $POOL | awk "\\$7 == \"NONE\" { print \\$0 }" | wc 
-l`
   if [[ $TOTL -ne 0 ]] ; then
      if [[ $HEADER -eq 0 ]] ; then echo $POOL ; HEADER=1 ; fi
      FREE=`vmquery -w -pn $POOL | awk "\\$20==\"00/00/0000\" && \\$7 == 
\"NONE\" { print \\$0 }" | wc -l`
      echo "    s/a: $FREE / $TOTL"
   fi
done

                                                - Bluejay Adametz

"The society which scorns excellence in plumbing as a humble activity
and tolerates shoddiness in philosophy because it is an exalted
activity will have neither good plumbing nor good philosophy ...
neither its pipes nor its theories will hold water."


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