1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

Help using Op Reporting to email completion of admin script

Discussion in 'Scripting' started by mi-court-buadmin, Oct 26, 2009.

  1. mi-court-buadmin

    mi-court-buadmin New Member

    Joined:
    Jul 11, 2008
    Messages:
    31
    Likes Received:
    0
    Occupation:
    BU Admin, DR planner, Storage admin
    Location:
    Lansing, Moooochigan
    I need to generate an e-mail when my administrative script is complete (specifically, when reclaim is done and the DB backup is complete meaning it's time to take tapes out of library). I've read in this forum that this can be done with Hourly Monitors in Operational Reporting, as long as a rule can be written that detects the proper copnditions.

    Here is where I need help: Can someone post a Select statement that would either detect that there are one or more volumes in the library of type DBBackup, or that there are no Reclaim operations running? I could use a COUNT of greater than zero on the dbbackup volume type or a COUNT of greater than 0 for running reaclaim processes to trigger the monitor alert.

    With that in hand I think it's a simple matter of using that as an alert rule in an Hourly Monitor. Otherwise it appears impossible to get TSM to send an e-mail as part of the daily admin script. It would be easy if TSM were capable of launching an external batch or executable from within a script, or capable of outputting the results of a command line to a file from within a script. But, alas, neither seems to be possible. If versions later than 5.4 are natively capable of such a thing I would consider upgrading.

    TSM 5.4.2 Extended on Windows Server 2003R2, IBM TS3310 library (and no money to spend on add-ons or 3rd party apps).

    Thanks in advance.
     
  2.  
  3. JohanW

    JohanW Moderator

    Joined:
    Nov 12, 2006
    Messages:
    986
    Likes Received:
    14
    Occupation:
    sysadmin
    Location:
    Netherlands
    Yes you can launch an external batchfile from a script.
    Code:
    DEFINE CLIENTACTION NODE ACT=COMMAND OBJECT=script.cmd
    would start script.cmd on node NODE. script.cmd should be in the tsm/baclient/ directory, the node should use prompted scheduling. Call blat or something from the batchfile.

    There will be a slight delay before the one-time action is initiated by the server, you can't use it synchronously.
     
  4. mi-court-buadmin

    mi-court-buadmin New Member

    Joined:
    Jul 11, 2008
    Messages:
    31
    Likes Received:
    0
    Occupation:
    BU Admin, DR planner, Storage admin
    Location:
    Lansing, Moooochigan
    Right

    Thanks, Johan, I messed around with Define ClientAction a little, thought it pretty kludgy to have to involve a second machine that could disappear some time in the future. Plus the node I picked refuses to run a batch file as scheduled through ClientAction, and further, the one-time schedule and association that results never goes away (apparently). I ended up with a whole bunch of schedules with names like @5, @6, @7, etc that I had to clean out manually.

    I'm working on a single-machine option using a scheduled batch file and BMail that seems to be working. As soon as I finish testing it I'll post the batch file.
     
  5. JohanW

    JohanW Moderator

    Joined:
    Nov 12, 2006
    Messages:
    986
    Likes Received:
    14
    Occupation:
    sysadmin
    Location:
    Netherlands
    I use the client on my server, so no second machine. The schedules disappear after a day here; can't figure out offhand why that is so, but it can be done.
     
  6. mi-court-buadmin

    mi-court-buadmin New Member

    Joined:
    Jul 11, 2008
    Messages:
    31
    Likes Received:
    0
    Occupation:
    BU Admin, DR planner, Storage admin
    Location:
    Lansing, Moooochigan
    OK, that makes sense. Has some advantages over the other way around, calling DSMADMC from the batch file. I'll try again using the server as the node.
     
  7. mi-court-buadmin

    mi-court-buadmin New Member

    Joined:
    Jul 11, 2008
    Messages:
    31
    Likes Received:
    0
    Occupation:
    BU Admin, DR planner, Storage admin
    Location:
    Lansing, Moooochigan
    Works, sort of.

    OK, I can get the Tivoli server/node (in PROMPTED mode) to execute a command like BMAIL...., but it won't launch a batch file. Activity log just shows Failed and RC=1. Nothing in the Windows system log, only the same RC=1 message in the application log. No detail in the dsmsched.log file either.

    Is it legal to call a batch file from a Define ClientAction?

    Also, the one-time schedules are defaulting to a DURATION of 5 and a DURUNIT of DAYS. Anyone know where to adjust the Duration and DURUnit defaults for one-time schedules? It's not an option in the Define ClientAction command.

    Thanks,
    SR
     
  8. mi-court-buadmin

    mi-court-buadmin New Member

    Joined:
    Jul 11, 2008
    Messages:
    31
    Likes Received:
    0
    Occupation:
    BU Admin, DR planner, Storage admin
    Location:
    Lansing, Moooochigan
    Here's why I need a batch file

    :(
    While I can execute commands to send notification e-mails, most command-line e-mail apps require quotes for text like the subject and body of the message. Tivoli can't handle all the nested quotes on one line:

    BMAIL -s 10.10.43.18 -t fred@company.com -f Tivoli@company.com -a Test -b Test

    works fine, but

    BMAIL -s 10.10.43.18 -t fred@company.com -f Tivoli@company.com -a "Test Message" -b "Test from your friendly Tivoli Server"

    does not. Putting the line in a batch file works and makes the object of the define clientaction legal. But it refuses to run.
     
  9. mi-court-buadmin

    mi-court-buadmin New Member

    Joined:
    Jul 11, 2008
    Messages:
    31
    Likes Received:
    0
    Occupation:
    BU Admin, DR planner, Storage admin
    Location:
    Lansing, Moooochigan
    Solved

    :cool:

    When launching a batch file from a DEFINE CLIENTACTION command, leave out the file extension. Using the object 'TAPES.BAT' will fail, but 'TAPES' will work. You just need to make sure that no other type of executable (.com, .exe ect) exists with the same name in the search path.
     

Share This Page