Do shout (pass a variable to a script)

Tools and several solutions to manage Control-M products
Post Reply
User avatar
Diablau
Nouveau
Nouveau
Posts: 44
Joined: 08 Jul 2009 12:00
Location: Québec, Canada

Do shout (pass a variable to a script)

Post by Diablau » 27 Jul 2010 7:19

Hi all!

I would like to know how to pass a variable (severity variable as an example) to a batch file in Windows?

Here are my entries in the Shout Destination table:
# Destination Type Adr Logical Name Physical Name
4 P A SCRIPT1 D:\file.bat

Is my severity variable will be seen by my batch file as %severity% for example???

Also, I would like to know how to fill the "SendAlarmToScript" parameter? I put "D:\file.bat" but I don't think this is the right way to proceed because it does'nt show on which agent this path is located...

Hoping I'm clear, I thank you all!

User avatar
nicolas_mulot
Nouveau
Nouveau
Posts: 149
Joined: 07 Jan 2010 12:00

Post by nicolas_mulot » 27 Jul 2010 9:33

Diablo,

From what you write, I'm afraid you get a bit confused.
SendAlarmtoScript is a control-m/EM variable which allows you to process an EM alarm by a script. The format of the EM alarm is very specific, and has nothing to do whith the SHOUT, which is a control-M SERVER facility.

The shout destination you coded looks well. Since the destination type is "A", your script d:\file.bat should reside on the machine where your job runs.
In addition, your job should issue a Shout.
For example, you can specify, in the PostProc tab:
SHOUT WHEN NOTOK - DEST SCRIPT1 MESSAGE %%ORDERID.

Doing so, you actually use the SCRIPT1 logical destination you coded, and which is not used by EM (sendalarmtoscript etc..)

Just write a first file.bat like this:
echo %~1 %~2 %~3
As far as I remember, the severity is the 3rd parameter passed to the script.

Once you have parsed the parameters, you can adapt your script the way you like to process the severuty for example.

In addition, and unless you have specific constraints -such as accessing a local agent file - you'd better specify the destination type as Server, in which case the file.bat should reside on th eserver machine.

Cheers
Nicolas mulot

Post Reply