Hello,
Here is the first draft of a script for dumping the physical content
of the library. You will no
doubt need to customise it for your environment. It doesn't yet emulate the
physical layout by
putting columns in parallel. That's version 2.0.0 :-)
Your LIBRARY_ADDR parameter may need to be altered, as may your numbering
structure.
Maybe modify and include it in a cgi-script and webify it? Possibilities are
endless.
Note, our column 5 and 7 are only 13 slots large, as we've removed 13 to
make space for our 5 LTO
drives on the drive side slots. (Usually 26 each)
We do not currently have an active door on the LTO unit, so you will note
the absence of this,
make your own modifications if you want that.
I've had no issues running it, but I must emphasise that what you do in your
environment is your
own business, and I take no responsibility if anything untoward happens
through the use of this program.
Thanks, Mike.
-----------------8<---------------------------------------------------------
--8<-----------------------------------------------------------8<
--8<-----------------------------------------------------------8<
#!/bin/ksh
#!/bin/ksh
#
# Script Name : show_lto
# Author : Mike Benjamin
# Date : 04/11/2001
# Version : v1.0.1
# Platform : AIX 4.3.3.0
# Shell Target : ksh - Korn Shell script
# Log files created :
# Temp files created :
# Screen Mode : Designed for 132 column wide terminals.
#
# Processes Launched : tapeutil
#
# Execution Time :
#
# Dependencies : tapeutil
# :
#
# Purpose : To list physical contents of a 3584 LTO D34 Library.
#
# History : 04/11/2000 - MB - Creation.
# : 05/11/2001 - Functions implemented.
#
# Notes : Code needs improvement. Column output will be altered
# : to match physical layout, another array required.
#
# : This script has proved safe to run with ADSM/TSM
executing.
# : Occasionally if direct access to the library is
occurring
# : tapeutil will not run. Try again later.
#
# : I TAKE NO RESPONSIBILITY FOR ANY DAMAGE CAUSED BY
RUNNING THIS CODE
# : IT'S ENTIRELY UP TO YOU TO TEST CODE IN THIS
IMPORTANT ENVIRONMENT BEFORE
# : UTILISING.
#
INVENTORY_LINE=""
TEMP_FILE="/tmp/$(basename $0).$$"
TEMP_FILE2="/tmp/$(basename $0)2.$$"
LIBRARY_ADDR="smc1"
COUNTER=0
OUTPUT_COUNTER=0
bold=`tput bold`
dim=`tput dim`
rev=`tput smso`
norm=`tput rmso`
typeset -L45 tsm_inventory[1500]
typeset -L20 output_array[1000]
load_arrays()
{
# Prepare initial lists
/bbs/rtscripts/adsm_cmd "q libvol" | grep 3584LIB1 > ${TEMP_FILE2}
#cat ${TEMP_FILE2}
clear
echo "Loading main array with tapeutil inventory"
tapeutil -f /dev/${LIBRARY_ADDR} inv > ${TEMP_FILE}
while read -r INVENTORY_LINE
do
tsm_inventory[${COUNTER}]=$(echo ${INVENTORY_LINE})
(( COUNTER += 1 ))
done < ${TEMP_FILE}
echo ${COUNTER} Total elements loaded into array...
}
display_slots()
{
# Local variables
COL1_COUNT=0
COL3_COUNT=0
OUT_ARRAY_COUNT=0
SLOT_ELEMENT=""
SLOT_COUNTER=0
SLOT_CONTENT=""
SLOT_MEDIA_VOLSER=""
TEMP_SLOT_COUNTER=0
OUT_SLOT_ADDR=""
OUT_SLOT_MEDIA=""
OUT_SLOT_MEDIA_VOLSER=""
GREP_STRING=""
SEARCH_VOLSER=""
# Slots Section
${dim}
while [ ${SLOT_COUNTER} -lt ${COUNTER} ]
do
if [ $(echo ${tsm_inventory[${SLOT_COUNTER}]} | grep -c "Slot Address")
-gt 0 ]
then
then
SLOT_ELEMENT=$(echo ${tsm_inventory[${SLOT_COUNTER}]} | awk {'print
$3'})
(( TEMP_SLOT_COUNTER = SLOT_COUNTER + 3 ))
SLOT_CONTENT=$(echo ${tsm_inventory[${TEMP_SLOT_COUNTER}]} | awk
{'print $4'})
(( OUT_ARRAY_COUNT += 1 ))
if [ ${SLOT_CONTENT} = "Yes" ]
then
OUT_SLOT_MEDIA="1"
(( TEMP_SLOT_COUNTER = SLOT_COUNTER + 7 ))
SLOT_MEDIA_VOLSER=$(echo ${tsm_inventory[${TEMP_SLOT_COUNTER}]} |
awk {'print $4'})
elif [ ${SLOT_CONTENT} = "No" ]
then
OUT_SLOT_MEDIA="0"
SLOT_MEDIA_VOLSER="______"
fi
if [ ${SLOT_ELEMENT} -eq 1025 ]
then
echo "\n COLUMN 1 "
echo " ----[DIAGTAPE]"
elif [ ${SLOT_ELEMENT} -eq 1068 ]
then
echo "\n COLUMN 3 "
elif [ ${SLOT_ELEMENT} -eq 1112 ]
then
echo "\n COLUMN 5 "
elif [ ${SLOT_ELEMENT} -eq 1125 ]
then
echo "\n COLUMN 7 "
fi
SEARCH_VOLSER=$(echo ${SLOT_MEDIA_VOLSER} | cut -c1-6)
if [ ${SEARCH_VOLSER} != "______" ]
then
GREP_STRING=$(egrep ${SEARCH_VOLSER} ${TEMP_FILE2})
if [ $(echo ${GREP_STRING} | egrep -c "Scratch") -eq 1 ]
then
echo " ${SLOT_ELEMENT}[ ${bold}${SEARCH_VOLSER}${norm} ]"
elif [ $(echo ${GREP_STRING} | egrep -c "DbBackup") -eq 1 ]
then
echo " ${SLOT_ELEMENT}[ ${rev}${SEARCH_VOLSER}${norm} ]"
else
echo " ${SLOT_ELEMENT}[ ${SEARCH_VOLSER} ]"
fi
else
echo " ${SLOT_ELEMENT}[ ${SEARCH_VOLSER} ]"
fi
fi
(( SLOT_COUNTER += 1 ))
done
echo
echo "Key: ${dim}000000${norm} = Non-scratch"
echo " ${bold}000000${norm} = Scratch"
echo " ${dim}______${norm} = Empty Slot"
echo " ${rev}000000${norm} = DbBackup volume"
}
display_drives()
{
# Local variables
NUM_DRIVES=0
DRIVE_COUNTER=0
DRIVE_ELEMENT=""
DRIVE_MEDIA_VOLSER=""
DRIVE_MEDIA_PRESENT=""
TEMP_DRIVE_COUNTER=0
CONTENT_INDICATOR=0
# Drives Section
echo
echo "Drive\tMedia\tVOLSER"
while [ ${DRIVE_COUNTER} -lt ${COUNTER} ]
do
if [ $(echo ${tsm_inventory[${DRIVE_COUNTER}]} | grep -c "Drive Address")
-gt 0 ]
then
then
(( NUM_DRIVES += 1 ))
DRIVE_ELEMENT=$(echo ${tsm_inventory[${DRIVE_COUNTER}]} | awk {'print
$3'})
(( TEMP_DRIVE_COUNTER = DRIVE_COUNTER + 3 ))
DRIVE_MEDIA_PRESENT=$(echo ${tsm_inventory[${TEMP_DRIVE_COUNTER}]} |
awk {'print $4'})
if [ ${DRIVE_MEDIA_PRESENT} = "Yes" ]
then
DRIVE_MEDIA_PRESENT="1"
(( TEMP_DRIVE_COUNTER = DRIVE_COUNTER + 10 ))
DRIVE_MEDIA_VOLSER=$(echo ${tsm_inventory[${TEMP_DRIVE_COUNTER}]}
| awk {'print $4'})
elif [ ${DRIVE_MEDIA_PRESENT} = "No" ]
then
DRIVE_MEDIA_PRESENT="0"
DRIVE_MEDIA_VOLSER="None"
fi
echo
"${DRIVE_ELEMENT}\t${DRIVE_MEDIA_PRESENT}\t${DRIVE_MEDIA_VOLSER}"
fi
(( DRIVE_COUNTER += 1 ))
done
echo "\nNumber of LTO drives detected: ${NUM_DRIVES}"
echo
}
# Program mainline
load_arrays
display_slots
display_drives
rm -f ${TEMP_FILE}
rm -f ${TEMP_FILE2}
exit 0
-----------------8<---------------------------------------------------------
--8<-----------------------------------------------------------8<
--8<-----------------------------------------------------------8<
Mike Benjamin
Mike Benjamin
Systems Administrator
IT&T Systems Department - Store Support
Bunnings Building Supplies, Perth, Western Australia.
**************************************************************************
Bunnings Legal Disclaimer:
1) This document is confidential and may contain legally privileged
information. If you are not the intended recipient you must not
read, copy, distribute or act in reliance on it.
If you have received this document in error, please telephone
us immediately on (08) 9365-1555.
2) All e-mails sent to and sent from Bunnings Building Supplies are
scanned for content. Any material deemed to contain inappropriate
subject matter will be reported to the e-mail administrator of
all parties concerned.
**************************************************************************
|