View previous topic :: View next topic |
Author |
Message |
Madman
Joined: 04 Nov 2002 Posts: 12 Location: Poland
|
Posted: Thu Sep 18, 2008 12:10 am Post subject: using %::<testname>::<macrovariable>% in ActiveS |
|
|
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: | %::<testid>::<macrovariable>% | to read current status of selected tests, example:
But in spite of selecting "Translate macros" I can't read the value. Any help please ?
My Script looks like this:
Code: |
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
|
|
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Thu Sep 18, 2008 10:58 am Post subject: |
|
|
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 |
|
Back to top |
|
|
Madman
Joined: 04 Nov 2002 Posts: 12 Location: Poland
|
Posted: Thu Sep 18, 2008 12:14 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Thu Sep 18, 2008 12:38 pm Post subject: |
|
|
You are welcome
Regards
Alex |
|
Back to top |
|
|
|