I have a PHP script that does a query on a slave mysql database. The script has an output of either 1(its working) or 0(its not). How ever when I have the batch file kick it off I see a "Last Message" of "Response not wellformed: "1 "" I am not sure why it says not well formed, the result will be either a 0 or 1, and it sees the "1" in there".

My Batch file is: @echo off c:\progra2\PHP\php.exe -f c:\check.php exit 1

Is there something else i'm missing?

Thanks!


Article Comments

Hi,
please try adding for example a ":ok" to your output, which is delivered back to PRTG. The responses have to be the following format: value:message Best regards


Feb, 2012 - Permalink

I noticed that about 10 minutes after I submitted the question. I was looking over those other scripts and saw the ":OK" in them. So gave it a try.

Thanks!


Feb, 2012 - Permalink

Would it be possible to expand on this resolution? I am new to NetMon and I am unsure what the EXACT syntax is for completing this function.

Thank you for your time!

John~


May, 2012 - Permalink

John, you can check the detailed documentation in your very own PRTG under "Setup"->"PRTG API"->"Custom Sensors". Please also check the "example" custom sensors coming with PRTG, they should give you an idea how this works.


May, 2012 - Permalink

I have a problem like that, but the case is that the parameters are being interpreted as the message. And the return values of my script are being ignored.

For example:

I've created a hard link on my server to php.exe, then I've added a custom sensor pointing to the php executabe. Then I'd set the parameters to something like "-f scripts/script.php %host".

When the probe runs the sensor, the message I get depends on how I've written the parameters, if I dont enclose the parameters between quotes, I get 0 as the channel value and "scripts/script.php 192.168.0.1" as the message. If I enclose the parameters between quotes, I get "scripts/script.php"as the message and 0 as the channel value.

I'm pretty sure that my script is working and returning the output and the exit cade correctly.

Any suggestion or tip ?

PS: I;ve used that approach since the powershell scripts takes too long to execute and uses a lot of CPU.


Sep, 2012 - Permalink

Hi tiagoratto,

can you give us an output of the call when you start it from the commandline with the two options?

kind regards


Sep, 2012 - Permalink