I have a script that counts scratches- my 3494 is shared betweeen two tsm
instances, so I use
a table of category codes to sort out private/scratch for each tsm instance.
This, of course, is
from the library/category point of view, which may not necessarily balance 100%
to TSM's!

Here's the (ksh) script:

lookup_code()
{
   table=/usr/tivoli/tsm/etc/category_table
   desc=`grep ^$1 $table|awk -F= '{print $2}'`
}

echo
echo
echo "--- TSM carts ---"
echo
mtlib -l /dev/lmcp0 -qI|awk '{print $2}'|sort |uniq -c|while read count cat;do
        lookup_code $cat
        printf "%5d " $count
        echo $desc
done

Here's the category table (tsmSF1 and tsmSD1 are my tsm instance names) :

0190=tsmSF1 private
0191=tsmSF1 scratch 3490
0192=tsmSF1 scratch 3590
01F4=tsmSD1 private
01F5=tsmSD1 scratch 3490
01F6=tsmSD1 scratch 3590
F00E=volume in error
FF10=eject pending
FF11=bulk eject
FF00=inserted. (unassigned, in ATL)
FFF7=pending
FFFA=manually ejected
FFFB=purge volume
FFFC=unexpected volume
FFFA=purge volume
FFFD=3590 cleaner
FFFE=3490 cleaner
FFFF=private volume

Cleaner carts don't seem to show in the normal mtlib -qI command, so you can
add the following to count these:

echo
echo "--- Cleaner Carts ---"
echo
mtlib -l /dev/lmcp0 -qC -s fffd|awk '{print $2}'|sort |uniq -c|while read count
cat;do
        lookup_code $cat
        printf "%5d " $count
        echo $desc
done

But this still doesn't show us how many cleaning cycles are available on these
cleaning carts, so add the following to display that (plus the library empty
cell count):
echo
echo
echo "--- Library Status ---"
echo
mtlib -l /dev/lmcp0 -qL|egrep "available cells|3590 cleaner cycles"
echo

Sample output:
 --- Cleaner Carts ---

    4 3590 cleaner


--- TSM carts ---

  106 tsmSF1 private
   82 tsmSF1 scratch 3590
   46 tsmSD1 private
  263 tsmSD1 scratch 3590
   50 inserted. (unassigned, in ATL)


--- Library Status ---

   available cells............311
   avail 3590 cleaner cycles..374


Comments, corrections, and other code swaps welcomed!

JRS.

Reply via email to