Getting error with PHP scripts ... cgi vs cli

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Getting error with PHP scripts ... cgi vs cli

Post by pbulteel »

I saw that the ss_fping and ss_host* scripts all have the -q and disable errors, etc in them. However on PHP 4.3.11 I seem to have problems because I get the headers showing up!

I'm talking about the...
text\html
X-Powered-by: PHP

stuff... any way I can force it off in the php.ini? all google searches returned nothing helpful. I'm not sure if it's a bug or what... probably is. I need to update the version here, but thought I'd check here first.

Thanks,

-P
uname -a
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

For 0.8.6g, please apply all patches at: http://www.cacti.net/downloads/patches/ ... re-patched

The respond on progress.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

There are also modified versions of lib/ping.php and scripts/ss_fping.php as well as the Template here: http://forums.cacti.net/viewtopic.php?t=10049&start=30

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

Infortunately didn't work ... this is what's in the log

11/28/2005 11:00:02 AM - CMDPHP: Poller[0] Host[2] DS[154] WARNING: Result from SERVER not valid. Partial Result: Content-type: text/h
11/28/2005 11:00:02 AM - CMDPHP: Poller[0] Host[2] DS[154] SERVER: /var/www/html/cacti-0.8.6g/scripts/ss_fping.php ss_fping 10.53.96.250 20 TCP 80, output: U

-P
uname -a
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Syntax looks good, what happens when you debug the script server?

1) "php script_server.php" (cgi version)

2) /var/www/html/cacti-0.8.6g/scripts/ss_fping.php ss_fping 10.53.96.250 20 TCP 80

3) "quit"

Between 2 and 3, you should have gotten a response.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I also need to update lib/poller.php. We introduced some timeout logic that appears to be very unhappy in PHP. Will rip out and repost. Just send me a PM reminder as it's early morning and I'm about to goto work.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

This is what I got

php script_server.php
PHP Script Server has Started - Parent is cmd
/var/www/html/cacti-0.8.6g/scripts/ss_fping.php ss_fping 10.53.96.250 20 TCP 80
Content-type: text/html
X-Powered-By: PHP/4.3.11



min:0.6500 avg:0.6920 max:1.0400 dev:0.0815 loss:0.0000
uname -a
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

This is the problem:
Content-type: text/html
X-Powered-By: PHP/4.3.11


This is quite ODD. The script server simply includes a file and run's, why it's generating the stuff that's supposed to be suppressed by "-q" is perplexing.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

Yes, I kinda knew that was the problem, and looking through everything ... I couldn't figure (still can't) out why it's giving that! (It's the cli vs cgi) but with the -q and other stuff in it... that shouldn't show...

So... any ideas what to look for?

-P
uname -a
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

I still haven't fixed this but I notice that this error occurs on the ss_host_disk.php file for certain hosts only. This tells me that something is cached somewhere. Now I cleared the poller, but that didn't help, so I'm wondering how I can do that manually (and safely) to test.

TheWitness: I saw you tried to msg me, but I was already at home... I'm in London =P I will try to get in touch with you somehow.

Thanks,

-P
uname -a
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

You may need to place the "I'm running command line mode" directive at the head of the two files:

ss_fping.php and script_server.php

Try both of those and let me know if you have any luck. I have not access to IM this morning.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

If by that you mean

#!/usr/bin/php -q

I just added that to the script_server.php since it doesn't have it. It only had

$no_http_headers = true;

However the other scripts do have it. I'll update this post once the poller goes through a few cycles.

-P
uname -a
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

I am seeing some REALLY strange behaviour like ss_host_cpu showing information that I would imagine would get returned by the ss_fping.php script. ie, min, ave, max, dev, loss ...

I am confused. =\

Do I need to clear out the poller cache?

BTW here's the sample

12/06/2005 04:20:02 PM - CMDPHP: Poller[0] Host[3] DS[23] SERVER: /var/www/html/cacti-0.8.6g/scripts/ss_host_cpu.php ss_host_cpu 10.53.98.145 3 1:161:800:pbulteel:::MD5::[None] get usage 0, output: min:0.1900 avg:0.2430 max:0.5300 dev:0.0792 loss:0.0000

When I run it manually
php -q ../script_server.php
PHP Script Server has Started - Parent is cmd
/var/www/html/cacti-0.8.6g/scripts/ss_host_cpu.php ss_host_cpu 10.53.98.145 3 1:161:800:pbulteel:::MD5::[None] get usage 0
99


-P
uname -a
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

Looks like it's cached?

From looking through the logs I see that the "answer" to the cpu query shows up as a disk query further down, this leads me to believe that something is being cached somewhere.

-P
uname -a
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

I ran it manually...

php -q script_server.php
PHP Script Server has Started - Parent is cmd
/var/www/html/cacti-0.8.6g/scripts/ss_fping.php ss_fping 127.0.0.1 20 ICMP
/var/www/html/cacti-0.8.6g/scripts/ss_host_cpu.php ss_host_cpu 10.53.98.145 3 1:161:800:pbulteel:::MD5::[None] get usage 0
min:0.1900 avg:0.2095 max:0.3200 dev:0.0392 loss:0.0000

99
/var/www/html/cacti-0.8.6g/scripts/ss_fping.php ss_fping 127.0.0.1 20 ICMP
/var/www/html/cacti-0.8.6g/scripts/ss_host_cpu.php ss_host_cpu 10.53.98.145 3 1:161:800:pbulteel:::MD5::[None] get usage 0
min:0.1900 avg:0.2050 max:0.3200 dev:0.0292 loss:0.0000
99
uname -a
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests