Macros on external program command line

General chat about HostMonitor (all messages posted before March 07, 2003 available here).
Locked
jricha34
Posts: 59
Joined: Sun Jul 07, 2002 6:00 pm
Location: USA

Post by jricha34 »

Is it possible to specify macros on the command line for external programs? I have tried it and they don't seem to be getting expanded.
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Yes, its possible. But it depends on how do you start external program. Do you use "Execute external program" action? And what is your command line?

Regards
Alex
jricha34
Posts: 59
Joined: Sun Jul 07, 2002 6:00 pm
Location: USA

Post by jricha34 »

Yes, I am using by external program.
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

External program action? Or External program test? What command line do you use? What version of HM do you use? I cannot say what's wrong because I do not see your configuration. Please, tell me as much as possible.

Regards
Alex
jricha34
Posts: 59
Joined: Sun Jul 07, 2002 6:00 pm
Location: USA

Post by jricha34 »

o Select ADD to add a new test
o Select "by External Program" from dropdown
o I specify a little perl script with the command line

perl ..addontestsHM-LOGTEST.pl %HostName%

All of the HM-LOGTEST.pl script does is write a time stamp and the parameters it was initiated with to an external log file.

Here is what it writes

Wed Oct 9 13:13:10 2002 - %HostName%
--------------------------------------------------------------------------------
Wed Oct 9 13:13:55 2002 - %HostName%
--------------------------------------------------------------------------------
Wed Oct 9 13:13:58 2002 - %HostName%
--------------------------------------------------------------------------------
Wed Oct 9 13:14:00 2002 - %HostName%
--------------------------------------------------------------------------------
Wed Oct 9 13:14:02 2002 - %HostName%

KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

jricha34,

First my question was: Do you use "Execute external program" action? You said yes. Now you say you use External test. Its complette different modules. HM supports macro variables for actions execution because hundreds different tests can start the same action. HM does not support macros in configuration of the test because you already know test's parameters, you specify these parameters.

Regards
Alex

<font size=-1>[ This Message was edited by: KS-Soft on 2002-10-09 12:00 ]</font>

<font size=-1>[ This Message was edited by: KS-Soft on 2002-10-09 12:01 ]</font>
jricha34
Posts: 59
Joined: Sun Jul 07, 2002 6:00 pm
Location: USA

Post by jricha34 »

Actually I didn't say action the first time, I specified external program, then you asked which one and I was specific. Picks in the GUI are labeled the same, you only know the difference when in the different sections. I wasn't in the action section so wasn't aware that the label was identical.

That being said, the reason I was trying to use a macro in the parameter is so I can set this up as generically as possible so when I try to take advantage of the 20 million tests I don't have to customize multiple lines in each test import section. I can have the same line for the command line and then the differences would be in the host name and the comments, etc... Currently I would have to have a import setup of

Method = ExternalPrg
;--- Common properties ---
Title = OOR: server1.testdomain.com
Comment = server1.testdomain.com
RelatedURL =
ScheduleMode= Regular
Schedule =
Interval = 900
Alerts = REDC-EIG-EMAIL
ReverseAlert= No
UnknownIsBad= Yes
UseCommonLog= Yes
PrivLogMode = Default
SyncCounters= Yes
SyncAlerts = No
MasterTest-Alive = server1.testdomain.com
;--- Test specific properties ---
CommandLine = perl ..addontestshm-oor.pl server1.testdomain.com
Condition = DifferentFrom
ErrorLevel = 0
KillAfter = 60
WindowMode = hide


Which could be

Method = ExternalPrg
;--- Common properties ---
Title = OOR: server1.testdomain.com
Comment = server1.testdomain.com
RelatedURL =
ScheduleMode= Regular
Schedule =
Interval = 900
Alerts = REDC-EIG-EMAIL
ReverseAlert= No
UnknownIsBad= Yes
UseCommonLog= Yes
PrivLogMode = Default
SyncCounters= Yes
SyncAlerts = No
MasterTest-Alive = server1.testdomain.com
;--- Test specific properties ---
CommandLine = perl ..addontestshm-oor.pl %commentline1%
Condition = DifferentFrom
ErrorLevel = 0
KillAfter = 60
WindowMode = hide



Or something similar and when I write the documentation for people to make a change I can say, change the comment to this versus make the following changes in the following locations and make sure you get them all so that it works right.

On the automation side it simply makes the script easier to write to automate things as well.

I can go either way, just think it is more consistent to allow macros to be used there.

joe


KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Joe,
want to make a bet? :smile:

>Actually I didn't say action the first time
Correct, that's why I said "First MY question was: Do you use "Execute external program" action?"

Anyway, now I see your point. I have added your request into "to do" list with low priority

Regards
Alex
jricha34
Posts: 59
Joined: Sun Jul 07, 2002 6:00 pm
Location: USA

Post by jricha34 »

Hahaha. But I said

>"Yes, I am using by external program."

Not - External Program Action

Which prompted you to clarify

>"External program action? Or External program test?"

to which I clarified with

"o Select ADD to add a new test
o Select "by External Program" from dropdown "

So once you asked it in a clear way that showed there were two valid possible answers I gave step by step...

:eek:)

Thanks for adding to the to do. I was thinking how I would want to implement and possibly you may consider doing %%macro%% so you could also do %environment variable%?

Just thinking out loud.
Locked