New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Custom EXE Fails Only After Passing Parameters

Votes:

0

Your Vote:

Up

Down

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 by  Sean Moreno (0) 1

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



4 Replies

Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Sean Moreno (0) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Sean Moreno (0) 1



Please log in or register to enter your reply.


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.