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 Script sensor error

Votes:

0

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!

custom-sensor mysql php

Created on Feb 6, 2012 7:03:44 PM



6 Replies

Accepted Answer

Votes:

1

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

Created on Feb 7, 2012 2:21:35 PM by  Konstantin Wolff [Paessler Support]



Votes:

0

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!

Created on Feb 7, 2012 5:53:42 PM



Votes:

0

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~

Created on May 30, 2012 7:09:41 PM



Votes:

0

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.

Created on May 31, 2012 11:53:49 AM by  Torsten Lindner [Paessler Support]

Last change on May 31, 2012 11:54:24 AM by  Torsten Lindner [Paessler Support]



Votes:

0

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.

Created on Sep 20, 2012 4:38:51 PM



Votes:

0

Hi tiagoratto,

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

kind regards

Created on Sep 21, 2012 8:53:21 AM by  Dieter Loskarn [Paessler Support]




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.