using %::<testname>::<macrovariable>% in ActiveS

If you have information, script, utility, or idea that can be useful for HostMonitor community, you welcome to share information in this forum.
Post Reply
Madman
Posts: 12
Joined: Mon Nov 04, 2002 6:00 pm
Location: Poland
Contact:

using %::<testname>::<macrovariable>% in ActiveS

Post by Madman »

Hi,

I'm trying to create agregation test which become Bad when 3 other tests are Bad at the same time.
I couldn't find any other method so I'm trying vbscript.
I'm using

Code: Select all

%::<testid>::<macrovariable>%
to read current status of selected tests, example:

Code: Select all

%::<1119>::Status%
But in spite of selecting "Translate macros" I can't read the value. Any help please ?
My Script looks like this:

Code: Select all

const statusAlive       = "Host is alive:"
const statusDead        = "No answer:"
const statusUnknown     = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk          = "Ok:"
const statusBad         = "Bad:"
const statusBadContents = "Bad contents:"
dim IDTestowElements


'Tests to check
IDTests = "1139,1138,1140"


IDTestsElements = Split(IDTests, ",")



BadTestsSum = 0
FUNCTION PerformTest()
 For each element in IDTestsElements
	currentstatus = Chr(37)&Chr(58)&Chr(58)&element&Chr(58)&Chr(58)&"Status"&Chr(37)
	If  currentstatus = "Bad" then BadTestsSum = BadTestsSum + 1
 Next

PerformTest = StatusOK&BadTestsSum

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

Post by KS-Soft »

Macros are resolved by HostMonitor before script processing.
"Chr(37)&Chr(58 )&Chr(58 )&element&Chr(58 )&Chr(58 )&"Status"&Chr(37)" does not look like macro variable to HostMonitor.
You should write %::1119::Status% in the script.

Regards
Alex
Madman
Posts: 12
Joined: Mon Nov 04, 2002 6:00 pm
Location: Poland
Contact:

Post by Madman »

thank you for answer, I've just figured that out... had to make separate conditions for those 3 tests...
doesn't "look" nice, but works fine :)
thanx again :)
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You are welcome :)

Regards
Alex
Post Reply