What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Custom EXE Fails Only After Passing Parameters

Votes:

0

I have used a vbs script I found in the Paessler KB which uses static entries in the script for a website and a return status code. The sensor works great like this. After I've altered the script to accept parameters the script still works and returns the same status when run on the server but the sensor errors out with "System Error: OK (Code: PEO22)"

sUrl = Wscript.Arguments(0)
sStatusToCheck = Wscript.Arguments(1)


If Wscript.Arguments.Count = 1 then
    sUrl = Wscript.Arguments(0)
End If

If Wscript.Arguments.Count = 2 then
    sUrl = Wscript.Arguments(0)
    sStatusToCheck = Wscript.Arguments(1)
End If

Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
oXMLHTTP.Open "GET", sUrl, False, " "," "
oXMLHTTP.Send

WScript.Echo oXMLHTTP.Status & ":" & oXMLHTTP.StatusText

If oXMLHTTP.Status = sStatusToCheck then
    WScript.Quit("0")
Else
    WScript.Quit("2")
End If

custom-sensor http vbscript

Created on Dec 12, 2013 8:56:24 PM

Last change on Dec 13, 2013 6:52:57 AM by  Konstantin Wolff [Paessler Support]



4 Replies

Votes:

0

Hi,
please activate debugging for this sensor. Therefore switch to tab Settings of the sensor and set option Result Handling to "Write result to disk". This will create a file called Result of Sensor XXXX.txt, where XXXX represents the Sensor ID, to sub folder Logs (Sensors) of your PRTG Data Directory.
May you post the contents of the file?

Created on Dec 13, 2013 6:52:29 AM by  Konstantin Wolff [Paessler Support]

Last change on Dec 13, 2013 6:52:39 AM by  Konstantin Wolff [Paessler Support]



Votes:

0

The result is "200:OK". This is the same output I receive whether the variables are statically configure or are passed as parameters. So I am getting the same output but for some reason PRTG is giving me the error status if I pass the parameters.

Created on Dec 13, 2013 9:36:49 PM



Votes:

0

Sean,
what error message do you get in the debug file when passing the parameters? May you implement some logging functionality in the script to generate a log file of what is happening? Have you tried including the parameters in apostrophes?
Best regards

Created on Dec 16, 2013 6:46:28 AM by  Konstantin Wolff [Paessler Support]



Votes:

0

This had to do with an string/integer mismatch. The error code parameter is passed as a string from PRTG so it must be converted to integer to compare it to the http status returned.

Created on Dec 17, 2013 3:43:06 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.