Tsm library capacity monitor warning

I want to monitor tsm library capacity with db2 select statement and then send email when the capacity is over 80%
If there is any idea what to monitor - scratch or vol or slot
And how can I do it with db2 select statement

vb scriptAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carlos IjalbaIT Systems DirectorCommented:
You will have to do it with a TSM select statement, which is not quite the same as a DB2 select statement.

TSM is mounted over a DB2 tailored DB, but it has enhanced commands specific for TSM, which are more powerful than DB2 selects.

The thing is, a library can be full of tapes, but they may all be Private/Full, which is no good for backups (great for restores), or they may be Scratch (great for backups).

In any case, try with the following:

select count(*) from libvolumes where status='Scratch'

if you want to monitor all the tapes in your library/libraries:

query libvol

you can also use a

query drm

if you do use DRM, to track the status of all the tapes mountable/not mountable/in vault
vb scriptAuthor Commented:
I know this select statement but how can I knew then the library is over 80% capacity
Carlos IjalbaIT Systems DirectorCommented:
Well as far as I know, I don't think that TSM knows how many slots its libraries has...

It's simple, if you try to do a checkin in a full library, it will try to do it, and then fail.

Checking TSM commands for library details you can see it has no control of a slot count, try this:

q library f=d

And then you can try the following undocumented TSM command:

show library

You will see that in both cases TSM does not keep track of slot capacity. (It does know the home elements, but this are hardware addresses and change with different library models).

AFAIK, the only way to find out a library slot capacity from command line is by using the tape library drivers and invoking them from the OS. In my case I have a few IBM TS libraries that use the mtlib driver:

[root@tsm:/]mtlib -l /dev/smc0 -qL
Library Data:
   operational state..........Automated Operational State
   functional state...........00
   input stations.............1
   output stations............1
   input/output status........ALL input stations empty
                              ALL output stations empty
                              I/O stations in input mode
   machine type...............0
   sequence number............75927
   number of cells............44
   available cells............7
   convenience capacity.......3
   accessor config............01
   accessor 0 status..........Unknown
   comp avail status..........Convenience input station installed.
                              Convenience input station available.
                              Convenience output station installed.
                              Convenience output station available.
   library facilities.........00
   bulk input capacity........0
   bulk input empty cells.....0
   bulk output capacity.......0
   bulk output empty cells....0
   avail 3490 cleaner cycles..0
   avail 3590 cleaner cycles..0
   avail 3592 cleaner cycles..0
   distributed library ID.....0
   extended operation state...0
   pools out of scratch.......0
   pools with volumes.........0

Open in new window

And here you can see that my TS3200 library has a total of 44 slots (number of cells............44), and that it has 7 empty slots (available cells............7), therefore it has more than 80% capacity, since 80% capacity will be less than 9 slots.

So it looks like your best bet is to write a KSH or BASH script and control it from outside TSM, since TSM simply doesn't care how many slots it has, if it doesn't have a tape, it just launches a REQUEST for the operator...

NOTE:  With IBM libraries the drivers or CLIs used would be one of the following:


With other hardware vendors you will have to look at the manual.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vb scriptAuthor Commented:
Carlos IjalbaIT Systems DirectorCommented:
Thanks vb script,

Adding some more info on this, since my last post I have found an undocummented command from TSM to query the tape drivers directly:


You can read a bit further on the command and it's use in the following IBM page:


The problem is, that undocummented commands do change between versions of TSM, so it may work today and dissapear tomorrow (like it has happened with dozens of SHOW commands).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.