Poller.php does't update RRD but cmd.php does

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

jobu
Posts: 12
Joined: Mon Nov 13, 2006 5:32 pm

Poller.php does't update RRD but cmd.php does

Post by jobu »

If I run poller.php I get "Waiting on 1/1 pollers" until it times out. If I run cmd.php it returns the snmp and script information correctly. Then if I run poller.php again after that, it generates the graphs properly.

Any ideas why I need to run cmd.php manually?

edit: Guess I should specify a few things. Running on the following:

.i version of Cacti
1.2.15 RRDtool
Apache 2
Slackware
User avatar
TheWitness
Developer
Posts: 17004
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Unders Settings->Poller, you likely have "cactid" selected and not "cmd.php". If you select "cactid", you must have pre-configured and tested it first. Oh, and only poller.php updates the RRD's.

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?
jobu
Posts: 12
Joined: Mon Nov 13, 2006 5:32 pm

Post by jobu »

Thanks for the reply. The poller is set to cmd.php.

When I run cmd.php manually I get:

11/21/2006 09:50:17 AM - CMDPHP: Poller[0] Host[1] SNMP: Host responded to SNMP
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[1] DS[3] CMD: perl /var/www/cacti/scripts/linux_memory.pl MemFree:, output: 12300
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[1] DS[4] CMD: perl /var/www/cacti/scripts/linux_memory.pl SwapFree:, output: 247548
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[1] DS[5] CMD: perl /var/www/cacti/scripts/loadavg_multi.pl, output: 1min:0.09 5min:0.09 10min:0.02
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[1] DS[6] CMD: perl /var/www/cacti/scripts/unix_users.pl , output: 1
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[1] DS[7] CMD: perl /var/www/cacti/scripts/unix_processes.pl, output: 80
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[7] SNMP: Host responded to SNMP
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[7] DS[33] SNMP: v2: Srv03, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.2, output: 57982938
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Host[7] DS[33] SNMP: v2: Srv03, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.2, output: 4251518053
11/21/2006 09:50:18 AM - CMDPHP: Poller[0] Time: 1.0863 s, Theads: N/A, Hosts: 2

Then when I run poller.php again I get:

OK u:0.03 s:0.02 r:0.11
OK u:0.03 s:0.02 r:0.11
OK u:0.03 s:0.03 r:0.11
OK u:0.03 s:0.03 r:0.13
OK u:0.03 s:0.03 r:0.13
OK u:0.03 s:0.03 r:0.13


So it appears to work correctly when I manually do everything, but I'm stumped as to why cmd.php won't work when called my poller.php
jordon
Posts: 20
Joined: Mon Nov 27, 2006 2:58 am

Post by jordon »

0.8.6i, RHEL4

I'm having the same problem, when cmd.php is called by poller.php, it starts giving the.

Waiting on 2/2 pollers.
Waiting on 2/2 pollers.
Waiting on 2/2 pollers.
Waiting on 2/2 pollers.
Waiting on 2/2 pollers.
Waiting on 2/2 pollers.

11/27/2006 02:01:26 AM - POLLER: Poller[0] Maximum runtime of 292 seconds exceeded. Exiting.
11/27/2006 02:01:26 AM - SYSTEM STATS: Time:293.1988 Method:cmd.php Processes:10 Threads:N/A Hosts:2 HostsPerProcess:1 DataSources:5 RRDsProcessed:5
PHP Warning: pclose(): 53 is not a valid stream resource in /home/www/cacti/lib/rrd.php on line 48

I've been trying to fix this for like 16 hours straight now, as far as I can tell everything should work, maybe i'm missing something, maybe it's a bug, or a permission problem... when running in debug mode, cacti.log says:


11/27/2006 01:42:56 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /home/www/cacti/cmd.php 0 0]
11/27/2006 01:42:57 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /home/www/cacti/cmd.php 1 1]
11/27/2006 01:42:58 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "replace into settings (name,value) values ('date',NOW())"
11/27/2006 01:42:58 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
11/27/2006 01:42:58 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
11/27/2006 01:42:59 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
11/27/2006 01:42:59 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
11/27/2006 01:43:00 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
11/27/2006 01:43:00 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
11/27/2006 01:43:01 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
11/27/2006 01:43:01 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
11/27/2006 01:43:02 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
11/27/2006 01:43:02 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
11/27/2006 01:43:03 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
11/27/2006 01:43:03 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"
CaliMonk
Posts: 11
Joined: Fri Nov 24, 2006 7:04 am

Post by CaliMonk »

Hi,

In lib/poller.php try to edit the following:

Code: Select all

if (file_exists($filename)) {
                if ($config["cacti_server_os"] == "win32") {
                        pclose(popen("start \"Cactiplus\" /I \"" . $filename . "\" " . $args, "r"));
                }else{
                        exec($filename . " " . $args . " > /dev/null &");
                }
}
To:

Code: Select all

// if (file_exists($filename)) {
                if ($config["cacti_server_os"] == "win32") {
                        pclose(popen("start \"Cactiplus\" /I \"" . $filename . "\" " . $args, "r"));
                }else{
                        exec($filename . " " . $args . " > /dev/null &");
                }
// }
Ivo
jordon
Posts: 20
Joined: Mon Nov 27, 2006 2:58 am

Post by jordon »

Ivo, You are da man!!! :)

Finally, got it working... damn who'd have guessed there was a second poller.php file in /lib

Cause - There seems to be some kind of problem with the file_exists on RHEL4 or with my settings, I don't have php safe mode on, but still file_exists doesn't seem to be able to find the file... had the same problem with cactid - said the Poller path is invalid, though it wasn't, ownership permissions imho are also correct. (there was another thread about that here also).

for those disabling commands with the php.ini disable function like me, cacti seems to need: putenv,popen,pclose,execute

Again, thanks!
jobu
Posts: 12
Joined: Mon Nov 13, 2006 5:32 pm

Post by jobu »

I second the thanks. That fixed my problem too. It doesn't work with cactid, but that's OK for now.
CaliMonk
Posts: 11
Joined: Fri Nov 24, 2006 7:04 am

Post by CaliMonk »

The check needs to be altered, file_exists doesn't work with certain setups. I'll try and make a patch tomorrow and submit it.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Um...

I would be more concerned with why that function does not work on the php supplied with RHEL4.

I don't foresee us removing that file_exist check.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
TheWitness
Developer
Posts: 17004
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

There was a post on this relative to Solaris as well. I think it may be a PHP version issue.

For all those experiencing this issue, please state you PHP version.

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?
jordon
Posts: 20
Joined: Mon Nov 27, 2006 2:58 am

Post by jordon »

PHP 4.3.9 Release 3.22

i'm thinking it might be related to open_basedir function
CaliMonk
Posts: 11
Joined: Fri Nov 24, 2006 7:04 am

Post by CaliMonk »

rony wrote:Um...

I would be more concerned with why that function does not work on the php supplied with RHEL4.

I don't foresee us removing that file_exist check.
Hi,

I never said the check needed to be removed, it just needs to be changed :)
"file_exists under safe_mode works (I work with for php 4) doesn't work when owner of the dir where the file stands differs from the php-owner. "
As stated in one of the PHP.net comments.

A test:

Code: Select all

function file_exists_2gb($filename) {
   system("test -f $filename", $rval);
   return ($rval == 0);
}

$php = "/usr/bin/php";
if (file_exists($php))          echo "Exists\n";
else                            echo "Nope!\n";
 
$ph = "cmd.php"; 
if (file_exists($ph))           echo "Exists\n";
else                            echo "Nope!\n";
 
if (file_exists_2gb($php))      echo "Exists\n";
else                            echo "Nope!\n";
This returns:

Code: Select all

Nope!
Exists!
Exists!
Soooo, a possible change:

Code: Select all

function file_exists_2gb($filename) {
           system("test -f $filename", $rval);
           return ($rval == 0);
}       

if (file_exists($filename)) {
     if ($config["cacti_server_os"] == "win32") {
             pclose(popen("start "Cactiplus" /I "" . $filename . "" " . $args, "r"));
       }   else  {
             exec($filename . " " . $args . " > /dev/null &");
       }
} else {
     if (file_exists_2gb($filename)) {
          if ($config["cacti_server_os"] == "win32") {
             pclose(popen("start "Cactiplus" /I "" . $filename . "" " . $args, "r"));
           }   else  {
             exec($filename . " " . $args . " > /dev/null &");
           }
    }
}
my 5 cents..

I've added a patch file to my bug report, do as you please.

Ivo Teel
jordon
Posts: 20
Joined: Mon Nov 27, 2006 2:58 am

Post by jordon »

I've got safemode off and safemodegid on, if that helps
jobu
Posts: 12
Joined: Mon Nov 13, 2006 5:32 pm

Post by jobu »

TheWitness wrote:There was a post on this relative to Solaris as well. I think it may be a PHP version issue.

For all those experiencing this issue, please state you PHP version.

TheWitness
Running php 5.2.0 on slackware 10.1
User avatar
TheWitness
Developer
Posts: 17004
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

CaliMonk,

I see your point now. This must be a recent bug as that code has been in place forever. I am thinking that maybe it's a PHP bug, but it may be a security vulnerability that was recently closed.

This sucks BTB as the "file" system call will likely not work on Windoz. I need to open a bug report with PHP. Sucks sucks sucks...

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?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests