Veritas-bu

[Veritas-bu] Submitted For Your Approval (Capacity Script)

2003-03-21 09:35:25
Subject: [Veritas-bu] Submitted For Your Approval (Capacity Script)
From: Nathan.Fisk AT roc.celltechgroup DOT com (Fisk, Nathan (ROC))
Date: Fri, 21 Mar 2003 09:35:25 -0500
Hi all,
        I just finished up this script, it reports out the current capacity
(estimate) of your storage library based on the output of available_media.
If you can use it, feel free. Any comments would be great. And, upon
request, I have a shell script that provides a user friendly (I'm the only
UNIX user here, had to make it easy for the NT guys.) interface that will
filter out/move around the output from the script. Thanks for any comments
in advance.
*********BEGIN SCRIPT*************

#******************************************************************** 
# Filename:     avail.awk
# 
# Purpose:      Determine current Storage Tek Library Capacity and 
#               usage trends utilizing the available_media.cmd report
#       
# Author:       Nathan W. Fisk, Celltech Group LTD. -
nathan.fisk AT celltechgroup DOT com
#
# Revision History:
#       03-06-03                Initial Creation 
#       
#*******************************************************************
# This script requires output from the available_media script. If you're
# a UNIX user, just pipe it out straight to the awk script. I envy you. 
# If you're a NT/Cygwin user (like me) just pipe the output to a file
# and drag the file wherever Cygwin is running.
# 
# This script actually prints out 3 reports, if you want them. One is the
.CSV
# report option, which basically just turns the available_media output into
# an easy to work with csv file. The other prints out the current usage in
GB
# and the date for trend analysis. The third is the real point to the script
# and prints out a real, human readable display on what is going on in you
# Library. The script defaults to the human readable report, uncomment the 
# lines that print the other reports to print the other reports.
#
#
BEGIN { TOTALFKB = 0 ; TOTALAKB = 0 ; TOTALFUL = 0 ; TOTALACT = 0 ;
TOTALFROZ = 0 ; TOTALAVAIL = 0 ; i = 1 ; p = 0 ; STORAGETEK = 5872025600 }
#Set all the counters to zero, or one in the case of "i" which increments
after FROZEID/FROZESLOT is assigned a value. 
#STORAGETEK is the (conservative) estimated maximum storage limit (in kb)
for our Library, calculated by multiplying
#the number of tapes being used for onsite storage (80) by 70GB (DLT 30/70
drives). Change as needed.

{
        #       
        #Grab the pool name and put it into the array for later use. Also,
set new values in the counter arrays for incrementing.
        #       
        if ( $2 == "pool" ) {
                ++p
                POOL[p] = $1
                POOLCOUNT[p] = 0
                POOLAVAIL[p] = 0
                POOLKB[p] = 0
        }
        #       
        #If the tape is in the robot ($3=TLD), record the needed data from
the line, add the kilobytes to the totals and increment the counters for
ACTIVE/FULL/FROZEN as appropriate.
        #       
        if ( $3 == "TLD"){
                ID = $1
                SLOT = $5
                RETLEV = $7
                KB = $8
                STATUS = $9
                        if ( STATUS == "ACTIVE" ){
                                ++TOTALACT
                                TOTALAKB = TOTALAKB + KB
                                TOTALKB = TOTALKB + KB
                                POOLKB[p] = POOLKB[p] + KB
                                #print "act"
                        }
                        if ( STATUS == "FULL" ){
                                ++TOTALFUL
                                TOTALFKB = TOTALFKB + KB
                                TOTALKB = TOTALKB + KB
                                POOLKB[p] = POOLKB[p] + KB
                                #print "--------------full  "TOTALKB 
                        }
                        if ( STATUS == "FROZEN" ){
                                ++TOTALFROZ
                                FROZEID[i] = ID
                                FROZESLOT[i] = SLOT
                                ++i
                        }
                        if ( STATUS == "AVAILABLE" ){
                                ++TOTALAVAIL
                                ++POOLAVAIL[p]
                        }
                #       
                #Uncomment the line below for csv output before the report.
fgrep -vi CSVREPORTER to filter out.
                #print "CSVREPORTER,"ID","SLOT","RETLEV","KB","STATUS
                #       
                #Increment the number of tapes in the pool.
                #
                ++POOLCOUNT[p]
        }
}

END {
        #Calculate KB/GB/TB totals for the entire library.
        #
        TOTALMB = TOTALKB / 1024
        TOTALGB = TOTALMB / 1024
        TOTALTB = TOTALGB / 1024
        #
        #Calculate Percent currently being used.
        #
        PERCENT = ( TOTALKB / STORAGETEK ) * 100
        #
        #Print out Trend Analysis Data. Pipe to fgrep -vi $X where
X="/"`date +%Y` to remove.
        print TODAY","TOTALGB
        #
        #Calculate totals for FULL and ACTIVE
        #
        TOTALAMB = TOTALAKB / 1024
        TOTALAGB = TOTALAMB / 1024
        TOTALFMB = TOTALFKB / 1024
        TOTALFGB = TOTALFMB / 1024
        #
        #Begin Report Output
        #       
        print "MEDIA SUMMARY"
        print
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
        printf ("\n")
        printf ("%s\t%.0f%s\n", "Current Usage: ", PERCENT, "%")
        printf ("\n")
        printf ("%s\t%.0f%s\n", "Total KB currently stored on-site: ",
TOTALKB, " KB / 5872025600 KB")
        printf ("%s\t%.0f%s\n", "Total GB currently stored on-site: ",
TOTALGB, " GB / 5600 GB")
        printf ("%s\t%.0f%s\n", "Total TB currently stored on-site: ",
TOTALTB, " TB / 5.47 TB")
        printf ("\n")
        printf ("%s\t%.00f%s\n", "Total GB currently stored on ACTIVE media:
", TOTALAGB, " GB")
        printf ("%s\t\t%.00f%s\n", "Total GB currently stored on FULL media:
", TOTALFGB, " GB")
        printf ("\n")
        printf ("%s\t%s\n", "Total number of AVAILABLE tapes: ", TOTALAVAIL)
        printf ("%s\t%s\n", "Total number of ACTIVE tapes: ", TOTALACT)
        printf ("%s\t\t%s\n", "Total number of FULL tapes: ", TOTALFUL)
        printf ("\n")
        printf ("%s\t%s\n", "Total number of Frozen tapes: ", TOTALFROZ)
        #
        #If the number of Frozen tapes is not zero, print a special header
displaying the Frozen tape ID numbers.
        #
        if ( TOTALFROZ != 0 ){
                print
"<><><><><><><><><><><><><><><><><><><><><><><><><><><><>"
                printf ("%30s\n", "FROZEN")
                for ( x = 1; x < i; x++ ){
                        printf ("%s, ", FROZEID[x])
                }
                printf ("\n")
                print
"<><><><><><><><><><><><><><><><><><><><><><><><><><><><>"
        }
        printf ("\n")
        printf ("\n")
        printf ("%s\t%s\n", "Number of Pools: ", p)
        printf ("\n")
        #
        # Print a small summary for every Pool currently storing data IN the
library (not offsite)
        #
        for ( x = 1; x <= p; x++ ){
                #
                #If there is a tape in the pool, and the total KB stored in
the pool is not equal to zero, start reporting statistics.
                #
                if ( POOLCOUNT[x] != 0 && POOLKB[x] != 0 ){
                        print POOL[x]" Pool:"
                        print
"-----------------------------------------------------"
                        #
                        #Calculate percent of Total storage used by the
pool, and Calculate percent of USED storage used by the pool
                        #
                        POOLPERCENTOFUSED = ( POOLKB[x] / TOTALKB ) * 100
                        POOLPERCENTOFTOTAL = ( POOLKB[x] / STORAGETEK ) *
100
                        printf ("\t%s\t\t%.0f%%\n", "Percent of total
capacity: ", POOLPERCENTOFTOTAL)
                        printf ("\t%s\t\t%.0f%%\n", "Percent of used
capacity: ", POOLPERCENTOFUSED)
                        printf ("%20s\n", "--")
                        printf ("\t%s\t\t%s\n", "Total number of tapes: ",
POOLCOUNT[x])
                        printf ("\t%s\t%s\n", "Number of available tapes: ",
POOLAVAIL[x])
                        POOLMB = POOLKB[x] / 1024
                        POOLGB = POOLMB / 1024
                        printf ("\t%s\t%.00f%s\n", "Total KB: ", POOLKB[x],
" KB")
                        printf ("\t%s\t%.00f%s\n", "Total GB: ", POOLGB, "
GB")
                        print
"-----------------------------------------------------"
                        printf ("\n")
                }
        }
}
                
        
                
        
                                                        
************************END SCRIPT**********************

-Nathan Fisk


The information contained in this email is intended for the personal and 
confidential use of the addressee only. It may also be privileged information. 
If you are not the intended recipient then you are hereby notified that you 
have received this document in error and that any review, distribution or 
copying of this document is strictly prohibited. If you have received this 
communication in error, please notify Celltech immediately on:
+44 (0)1753 534655, or email 'is AT celltech.co DOT uk'
Celltech Group plc
208 Bath Road, Slough, SL1 3WE, Berkshire, UK
Registered Office as above.


<Prev in Thread] Current Thread [Next in Thread>
  • [Veritas-bu] Submitted For Your Approval (Capacity Script), Fisk, Nathan (ROC) <=