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:

Post by pbulteel »

I think I know what the problem is... extra lines

Code: Select all

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
 
min:0.1900 avg:0.2080 max:0.3200 dev:0.0294 loss:0.0000
/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
6
There's an extra line being returned (blank in this case) that is causing the server to return "U" and then the value shows up for the next entry. I don't know what causes this, but I will look around the code some more to see if I can pinpoint it and I will post it here.

Also, to remove the php headers, I added -q to the cmd.php

line 114 added the -q
$cactiphp = proc_open(read_config_option("path_php_binary") . " -q " . $config["base_path"] . "/script_server.php cmd", $cactides, $pipes);
uname -a
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

RU Running php cgi of fcgi?

php -v

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 »

php -v
PHP 4.3.11 (cgi) (built: Nov 10 2005 21:14:52)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

I still have this problem but now I also have the problem that only the rrds for the localhost are being updated.

'ls -lart' shows the last timestamp for a lot of the rrds to be for different times yesterday.

I upped the logging so I could see the rrd update command being run. It's running! I copied and pasted the line and ran it manually and it worked, the two rrds that I manually updated have a new/current timestamp.

This is really freakin' strange.
uname -a
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I have seen this a few times in the last week all of a sudden. Here is what I would like you to do:

1) Edit <cacti>/include/config.php
2) Goto Line ~137
3) You will see an array with several "*.php" files listed.
4) Add the following two files to the array: "script_server.php", "ss_fping.php"
5) Save the file.
6) Revert your prior changes.
7) Poll and post your results.

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 »

Slet the last comment. I looked at the Proc open command and I don't think it will help. Try it anyway. Interesting that the prior change would affect other hosts. Are you heavily using the script_server? What about traffic graphs?

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 »

I saw another post where you mentioned the array and adding those. I did that but no change.

ALL graphs are not being updated for the other hosts. Not just the script server ones, also the traffic ones. The values come back - same for the scripts, the rrds are just not being updated. Like I said I see it "running" the command

Code: Select all

12/07/2005 11:40:38 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti-0.8.6g/rra/ealssunv490_load_1min_204.rrd --template load_1min 1133955601:0.00
but the rrd isn't updated.

Another thing to note. The rrds were not created originally and I had to manually build them by looking at the create statements in the rra section. Something's messed up. I was thinking of reinstalling but it would be nice to figure out what's really happening.
uname -a
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

Looks like I get some rrdtool processes that are "defunct" - I manage to catch this...

Code: Select all

cacti     2357  2356  0 14:35 ?        00:00:00 /bin/sh -c /usr/bin/php -q /var/www/html/cacti/poller.php >/dev/null 2>&1
cacti     2358  2357 17 14:35 ?        00:00:00 /usr/bin/php -q /var/www/html/cacti/poller.php
cacti     2361     1 20 14:35 ?        00:00:00 /usr/bin/php -q /var/www/html/cacti-0.8.6g/cmd.php 0 15
cacti     2362  2358  0 14:35 ?        00:00:00 [rrdtool] <defunct>
cacti     2364  2361 22 14:35 ?        00:00:00 /usr/bin/php -q /var/www/html/cacti-0.8.6g/script_server.php cmd
uname -a
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

More on this darn thing...

The FIRST time I run the script_server.php with any command, it returns a blank line and then the value. If I then rerun another command, it comes back immediately with no blank line.

doesn't matter which script I use.

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

Post by TheWitness »

very wierd, have you tried other versions of PHP?

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 »

Ok - I now have a better idea of what is happening. Aparently the Advanced Ping script it causing the problem. Once it runs everything AFTER that doesn't work. I was using it on the localhost server and after it would run - none of the others would update.

Strange.

Everything is back to normal... now I need to see if I can get the ss_fping script to work! =(

-P
uname -a
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest