Get scheduled occupancy report of selected filespaces

combato

ADSM.ORG Member
Joined
Mar 22, 2012
Messages
147
Reaction score
1
Points
0
Location
Sweden
PREDATAR Control23

Hi Pro's

I'm looking for a way to get a scheduled occupancy report for a bunch of filespaces that I want to select from one of my nas nodes (virtualfilespaces). The thing is that I want a total amount of occupied storage for all the selected filespaces.
I have TSMManager but I can't Schedule any report here or select which filespaces I want to pick. (I can do some filtering here but that is not good enough)

Is there any nice Tools for this. Or have anyone done some nice scripts for this?

/C
 
PREDATAR Control23

Something like this in Korn Shell:

#!/bin/ksh

## Environmental variables ##

a=0
COMD="dsmadmc -id=$1 -pass=$2 -noc -dataonly=yes -display=table"

for i in `cat $4`
do
b=`$COMD "SELECT CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB" FROM occupancy where node_name='$3' and filespace_name='$i'"`
a=$(( a + b ))
done
echo "The total for node $3 File Spaces is $a"
exit 0

Save on a file, say total_fs.ksh and make it executable.

To run:

$1 = TSM admin ID
$2 = Admin pasword
$3 is the node you like to query
$4 is a list of filespaces in the form of a list (note case sensitive), like:

for UNIX:

/
/opt

for Windows:

SERVER_NAME\SystemState\NULL\System State\SystemState (note server name in CAPS)
\\server_name\c$ (note server name in lower case)

save this to a file, say fs.txt

RUN:

./total_fs.ksh admin password server_name fs.txt
 
Last edited:
PREDATAR Control23

Hi,
Thanks moon-buddy!
I tried to execute the SQL command but I can't get any occupancy amount from the filespace when it's a virtualfs. An ordinary node filespace does get me the amount in GB. Do you know why? The node is "t=nas". Can this be the reason?

"
tsm: MYTSMSERV>SELECT CAST (FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB" FROM occupancy where node_name='netappfiler.domain.se' and filespace_name='/home_01'
Space in GB
------------

tsm: MYTSMSERV>
 
PREDATAR Control23

Select commands, as far as I know, does not care what type it is. node_names are also case sensitive which, normally, should be in CAPS

To test, run the select command: "select * from nodes" to see the case for your NAS node
 
PREDATAR Control23

Select commands, as far as I know, does not care what type it is. node_names are also case sensitive which, normally, should be in CAPS

To test, run the select command: "select * from nodes" to see the case for your NAS node

Ahh, great! Thank you. CAPS helped! :)
 
PREDATAR Control23

Hi again!
I need some more help :/
I tried to execute a script but I didn't get it running so I know tried to execute this line on my Linux host:

myuser@monkey:~/scripts/tsm> /opt/tivoli/tsm/client/ba/bin/dsmadmc -id=report -pass=password -noc -dataonly=yes -display=table "SELECT CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB" FROM occupancy where node_name='netappfiler.domain.se' and filespace_name='/home_01'"
ANR0162W Supplemental database diagnostic information: -1:42601:-104 ([IBM][CLI Driver][DB2/NT64] SQL0104N An unexpected token "in" was found
following "( 8 , 2 ) ) as Space". Expected tokens may include: "INTO". SQLSTATE=42601
).
ANR0516E SQL processing for statement SELECT CAST ( FLOAT ( SUM ( physical_mb ) ) / 1024 AS DEC ( 8 , 2 ) ) as Space in GB FROM occupancy where
node_name = 'netappfiler.domain.se' and filespace_name = '/home_01' failed.
ANS8001I Return code 3.
myuser@monkey:~/scripts/tsm>

When I run the above step by step I get nothing back:

myuser@monkey:~/scripts/tsm>/opt/tivoli/tsm/client/ba/bin/dsmadmc -id=report -pass=password -noc -dataonly=yes -display=table

tsm: MYTSMSERV> SELECT CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB" FROM occupancy where node_name='netappfiler.domain.se' and filespace_name='/home_01'

tsm: MYTSMSERV>quit
myuser@monkey:~/scripts/tsm>

Does anyone know why it doesn't work?

/C
 
PREDATAR Control23

When you ran this select command in the TSM server CLI:

SELECT CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB" FROM occupancy where node_name='netappfiler.domain.se' and filespace_name='/home_01'

Don't you need to have the node name in CAPS? How about the filespace_name?
 
PREDATAR Control23

Hi,
Yes I have to... Sorry that I entered small letters. (I changed the nodename due I don't want to show the World my real hostname+dnssuffix) :)
I didn't need to have the filespace in CAP.
On the TSM server CLI it worked with:

SELECT CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB" FROM occupancy where node_name='NETAPPFILER.DOMAIN.SE' and filespace_name='/home_01'
 
PREDATAR Control23

For one reason or another a value like "Space in GB" does not work in a script.

Try:

"{Space in GB}", and if this does not work, try "Space_in_GB". Mind you, eliminate "as "Space in GB"" altogether in the script. This is not really needed.
 
PREDATAR Control23

Ok, thanks. After you helped me solve "as "Space in GB" problem I got problems calculating "a+b". I then changed the script to bash:

#!/bin/bash
## DIG ARCH REPORT ##
## Variables ##
ACC=report
PW=password
NODE=MYFILER.DOMAIN.SE
FILE=dig_filespace
a=0
COMD="/opt/tivoli/tsm/client/ba/bin/dsmadmc -id=$ACC -pass=$PW -noc -dataonly=yes -display=table"
echo "Running TSM monthly report for DIG_ARCH"
for i in $(cat $FILE)
do
b=$(echo "SELECT CAST (FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as \"Space_in_GB\" FROM occupancy where node_name='$NODE' and filespace_name='$i'" | $COMD | tr -d '[:space:]' | cut -f1 -d".")
a=$(echo $[a+b])
done
echo "The total for node $NODE File Spaces is $a GB"
exit 0

Works fine. Thank you for all your help!
 
PREDATAR Control23

If you modify your script as below to run in KSH, decimal arithmetic is allowed. This will get you even better results:

#!/bin/ksh
## DIG ARCH REPORT ##
## Variables ##
ACC=report
PW=password
NODE=MYFILER.DOMAIN.SE
FILE=dig_filespace
a=0
COMD="/opt/tivoli/tsm/client/ba/bin/dsmadmc -id=$ACC -pass=$PW -noc -dataonly=yes -display=table"
echo "Running TSM monthly report for DIG_ARCH"
for i in $(cat $FILE)
do
b=$(echo "SELECT CAST (FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as \"Space_in_GB\" FROM occupancy where node_name='$NODE' and filespace_name='$i'" | $COMD | tr -d '[:space:]' | cut -f1)
a=$(( a + b))
done
echo "The total for node $NODE File Spaces is $a GB"
exit 0
 
Top