issues with a script calling multiple instances.

foobar2devnull

ADSM.ORG Member
Joined
Nov 30, 2010
Messages
122
Reaction score
1
Points
0
Location
Belgium
Hi all,

I am trying to write a script that will "scrape" data from multiple instances so that I can generate a basic backup report.

The problem I am facing is with the use of:

instance name: foo​

represented in my script by "$1:" which does not seem to work so I'd have to run the script on each server rather than from a single one... unless one of you has a fab solution. Do you?

My script:
/* ------------------------------------------------------------ */
/* Script Name: REPORT_LASTLNXBACKUPS */
/* Description: List of the Linux backups in the last 24 hours */
/* arg: the argument defines the instance we are querying */
/* ------------------------------------------------------------ */

$1: SELECT cast(SUBSTR(CHAR(e.actual_start),1,19 ) as char(16)) AS "START TIME", e.SCHEDULE_NAME AS "SCHEDULE NAME", e.NODE_NAME AS "NODE NAME", n.PLATFORM_NAME AS "PLATFORM",
e.STATUS, e.RESULT -
FROM events e JOIN nodes n ON e.NODE_NAME = n.NODE_NAME -
WHERE scheduled_start BETWEEN current_timestamp - 24 hours AND current_timestamp -
AND PLATFORM_NAME like '%Linux%' -
ORDER BY e.RESULT desc, SCHEDULE_NAME, e.node_name, e.status​

How I use it:
run REPORT_LASTLNXBACKUPS TSMINST1​

Output:
Regardless of the instance I provide, it only ever outputs the "local instance"

So if I have three servers with three instances inst1, inst2 and inst3 and I run the script from inst1:
run REPORT_LASTLNXBACKUPS inst1
run REPORT_LASTLNXBACKUPS inst2
run REPORT_LASTLNXBACKUPS inst3​

all return the output of inst1
 
Try deleting the space after ":"
Code:
$1:SELECT cast ...
Instead of:
Code:
$1: SELECT cast ...

If that doesn't work, try:
Code:
INST1:SELECT cast ...
If specifying the instance directly doesn't work, it means you cannot do command redirection from a script. If it works, you may need to do 1 script per instance, or 1 script, but repeat the command for each instance.
 
Hi merchant,

Thanks for the help but it seems no command redirection is allowed. I removed the space but no luck. I also tried multiple sql queries to multiple instances in one scrip but still no luck.

Worth a try though. Thanks.
 
What about:
Code:
inst2:run REPORT_LASTLNXBACKUPS
Might have to create the script on the other machine though.
 
Smarty pants! Yeah, it works great!

Thanks a lot!

By the way, the original way you tried will not work as the script does not know how to look for INST2 and INST3.

In retrospect, you really need to invoke dsmadmc (meaning, running outside of any TSM instance) if you want to get the result from any TSM instance from a single command script on any 'reporting' server.

The advantage of this is that you maintain the code from just one location, i.e., the reporting server.
 
Last edited:
I'm sorry moon-buddy, I don't get what you mean. Could you elaborate?

From the looks of it, you want to run reports against all running TSM instances, correct?

What I am proposing is to create the script using dsmadmc to run on one central location (call it the 'reporting' server), wherein dsmadmc logs into the TSM instance, run the select command and get you the result.

This way, you only need to maintain the code on one location, the 'reporting' server.
 
Actually, that was the idea. I wanted a central place to call multiple instances and collect data for reporting but I didn't want to have to deal with multiple TSM threads (one per instance) and user/password per thread.

With marclant's I can do that if I have a script on each server.

If the script evolves, I'll add multithreading but my python skills are not there yet.

Thanks.
 
... but my python skills are not there yet.
Thanks.

You don't need to use python. If you are running under *nix, simple KSH scripts work. On DOS, simple batch files does the work as well.

I use this technique to manage multiple TSM instances/servers - 14 to be exact - and just maintain scripts on one location.

Even daily TSM work can be done this way. For instance, I have a menu driven script to register nodes and associate schedules on any TSM server without even touching that TSM server. I even have scripts to delete nodes, file spaces, unlock a node, etc., from this menu driven script without even having to enter the TSM instance name. It looks for the TSM instance automatically.

And all is done via KSH script. No fancy python, Perl, or Powershell. Yes, there is also a DOS version of it.
 
To be honest, my maintenance script, checkin script, etc are all shell scripts but I want to learn python so I might as well do something useful with it.

This script already exists as a shell script but no one reads the reports. As ppl these days are more interested in the bells and whistles rather than the content, I'll send a fancy html mail rather than dump raw data and for this... python.

Thanks for your advice.
 
Back
Top