Vbsript does not work well!

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
csk026
Posts: 25
Joined: Mon Apr 29, 2002 6:00 pm

Vbsript does not work well!

Post by csk026 »


Hello
I try to run the followin vb script in hostmonitor script test:

'-----------------------------------------------------------------------------
Option Explicit

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:"
'---- entry point ----

FUNCTION performtest()
Dim UnixScriptResult,CodeResult,ValueResult,DescriptionResult
Dim SearchString, SearchChar, MyPos,mypos1,i,j
Dim Mystr
Dim oShell,wsx
set oShell = createobject("wscript.shell")
'set wsx = oShell.exec("rsh adm210 -l srvadmin /homes/bdk026/ypcheck/5nines.sh")
set wsx = oShell.exec("rsh adm210 -l srvadmin /homes/bdk026/ypcheck/5nines-b.sh")
do until wsx.status = 1
'wscript.sleep(10)
For i=1 to 50
j=1
Next
loop
msgbox("1")
UnixScriptResult=wsx.stdout.readall
msgbox(UnixScriptResult)
msgbox("2")
mypos=instr(1,UnixScriptResult,":")
CodeResult=Mid(UnixScriptResult,1, Mypos-1)
msgbox(CodeResult)
mypos1=mypos
mypos=instr(Mypos1+1,UnixScriptResult,":")
ValueResult=Mid(UnixScriptResult,Mypos1+1, Mypos-mypos1-1)
DescriptionResult=Mid(UnixScriptResult,Mypos+1, len(UnixScriptResult))
Select Case CodeResult
Case "No answer" Mystr = CodeResult+":"+ValueResult
Case "Host is alive" Mystr = CodeResult+":"+ValueResult
Case "Unknown" Mystr = CodeResult+":"+ValueResult
Case "Unknown host" Mystr = CodeResult+":"+ValueResult
Case "Ok" Mystr = CodeResult+":"+ValueResult
Case "Bad" Mystr = CodeResult+":"+ValueResult
Case "Bad contents" Mystr = CodeResult+":"+ValueResult
Case "Ok" Mystr = CodeResult+":"+ValueResult
Case Else Mystr ="Unknown:0 %"
End Select
performtest = Mystr
END FUNCTION

'------------------------------------------
the program do not set value to CodeResult
(for debug porpose i add msgbox command)
when i run it without hostmonitor it work well.

Hostmonitor ver is 4.16
OS windows2000 server service pack 3
wsh ver 5.6

Can you help me?

Best regards
shlomo.koren@motorola.com
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Looks like you need HostMonitor 4.30 (will be available soon, probably within 2 weeks).
"Script" test starts VBScript as thread of HostMonitor's process, it has some side effects.. HostMonitor 4.30 has new "Shell Script" test, it starts scripts/external applications as separate process.

Regards
Alex
Post Reply