Tuesday, October 4, 2016

TSM Script for UNIX server for multible TSM instance

Before we see the script we should know in which environment we can use this script .

  1. All the TSM instance should run in UNIX server 
  2. All the UNIX server should have network connection
  3. The server where you running script from that server you should able to connect all the TSM instance ( For this connectivity we need to add all the TSM instances following information in the dsm.sys file in this unix server

    Servername                      TSMINSTANCENAMETCPPort                         1500
    TCPServeraddress                20.28.24.14

Now we can see the script 

we need two files for this script 
File 1 -- All the TSM instances server names 
File 2 -- Script File

The below is the script for collecting DB backup status for past 24 hours
-----------------------------------------------------------------------------------------------------------------
for i in `cat FILE1`

do

echo "$i"

echo "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"

dsmadmc -id=yyyyy -password=xxxxxxxxx -DATAOnly=yes -se=$i -tab "SELECT TO_CHAR(CHAR(date_time),'YYYY-MM-DD HH24:MI:SS') AS Date_Time, type, devclass FROM volhistory WHERE type='BACKUPFULL' AND date_time>=current_timestamp-24 hours"|uniq
 
done-----------------------------------------------------------------------------------------------------------------

In the script file(File 2) we need to add this script and give execute privilege 

for run this script we need all the TSM instance id and password should be same if you have different id password then we need to modify this script (if anybody want that script please mention in comment)

Now we can see one examble

FILE 1 - Name -- TSMINSTANCES below is the entries 
TSM01
TSM02
TSM03

FILE 2 - Name -- DB_BACKUP_STATUS.ksh below is the enries

 

for i in `cat TSMINSTANCES`

do

echo "$i"

echo "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"

dsmadmc -id=yyyyy -password=xxxxxxxxx -DATAOnly=yes -se=$i -tab "SELECT TO_CHAR(CHAR(date_time),'YYYY-MM-DD HH24:MI:SS') AS Date_Time, type, devclass FROM volhistory WHERE type='BACKUPFULL' AND date_time>=current_timestamp-24 hours"|uniq
 
done


to run the script just give the script file name

DB_BACKUP_STATUS.ksh     and enter then script will start to run and give the output in the screen like below.

TSM01
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
2016-10-04 08:00:24     BACKUPFULL      DEVICECLASSNAME
2016-10-04 15:00:27     BACKUPFULL      DEVICECLASSNAME
TSM02
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
2016-10-04 08:00:21     BACKUPFULL      DEVICECLASSNAME
2016-10-04 15:00:23     BACKUPFULL      DEVICECLASSNAME
TSM03
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
2016-10-04 06:00:20     BACKUPFULL      DEVICECLASSNAME
2016-10-04 17:00:20     BACKUPFULL      DEVICECLASSNAME
 
**if anybody want any script please comment I will help you



No comments: