PROBLEM (Result from SERVER not valid. Partial Result)

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

Moderators: Developers, Moderators

Post Reply
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

PROBLEM (Result from SERVER not valid. Partial Result)

Post by rualark »

I am using cacti 0.8.6f on FreeBSD 5.3-RELEASE with php4-4.3.9, mysql-server-4.1.5, rrdtool-1.0.49, net-snmp-5.1.2_1. I monitor several servers that are also FreeBSD 5.3-RELEASE with net-snmp-5.1.2_1. I'm monitoring processor, partitions and interfaces data queries. Everything is working fine but on one server there is a very strange problem:

For several data sources (processor and partitions) i get output in logs like that (DEBUG level):

Code: Select all

08/15/2005 10:06:27 AM - CMDPHP: Poller[0] Host[9] DS[171] SERVER: /usr/home/alchemist/www/cacti/scripts/ss_host_disk.php ss_host_disk 192.168.19.254 public 1 9 161 500 get total 9, output: U  
08/15/2005 10:06:27 AM - CMDPHP: Poller[0] Host[9] DS[171] WARNING: Result from SERVER not valid. Partial Result:  
08/15/2005 10:06:27 AM - CMDPHP: Poller[0] Host[9] DS[171] SERVER: /usr/home/alchemist/www/cacti/scripts/ss_host_disk.php ss_host_disk 192.168.19.254 public 1 9 161 500 get used 9, output: U  
08/15/2005 10:06:27 AM - CMDPHP: Poller[0] Host[9] DS[171] WARNING: Result from SERVER not valid. Partial Result:  
First thing is that I do not understand why he tries this two times. Second thing is that this works from command line:

Code: Select all

root@www /home/alchemist/www/cacti# su cactiuser
cactiuser@www /usr/home/alchemist/www/cacti$ php -q script_server.php
PHP Script Server has Started - Parent is cmd
/usr/home/alchemist/www/cacti/scripts/ss_host_disk.php ss_host_disk 192.168.19.254 public 1 9 161 500 get total 9
259766272
quit
PHP Script Server Shutdown request received, exiting
cactiuser@www /usr/home/alchemist/www/cacti$ 
I checked mysql and it seems to be ok:

Code: Select all

select * from poller_item where local_data_id=171;

local_data_id,poller_id,host_id,action,hostname,snmp_community,snmp_version,snmp_username,snmp_password, snmp_port,snmp_timeout,rrd_name,rrd_path,rrd_num,rrd_step,rrd_next_step,arg1,arg2,arg3,

171,0,9,2,192.168.19.254,public,1,,,161,500,hdd_total, /usr/home/alchemist/www/cacti/rra/smolserver_hdd_total_171.rrd, 2,300,0,/usr/home/alchemist/www/cacti/scripts/ss_host_disk.php ss_host_disk 192.168.19.254 public 1 9 161 500 get total 9,,,
171,0,9,2,192.168.19.254,public,1,,,161,500,hdd_used, /usr/home/alchemist/www/cacti/rra/smolserver_hdd_total_171.rrd, 2,300,0,/usr/home/alchemist/www/cacti/scripts/ss_host_disk.php ss_host_disk 192.168.19.254 public 1 9 161 500 get used 9,,,
Here is the log output from the same ds of the other server, which is ok:

Code: Select all

08/15/2005 11:00:53 AM - PHPSVR: Poller[0] DEBUG: INCLUDE: '/usr/home/alchemist/www/cacti/scripts/ss_host_disk.php' SCRIPT: 'ss_host_disk' CMD: '192.168.250.2 public 1 4 161 500 get total 9'
08/15/2005 11:00:53 AM - CMDPHP: Poller[0] Host[4] DS[55] SERVER: /usr/home/alchemist/www/cacti/scripts/ss_host_disk.php ss_host_disk 192.168.250.2 public 1 4 161 500 get total 9, output: 259766272
08/15/2005 11:00:53 AM - PHPSVR: Poller[0] SERVER: /usr/home/alchemist/www/cacti/scripts/ss_host_disk.php ss_host_disk 192.168.250.2 public 1 4 161 500 get total 9 output 59766272
What may be the problem? I absolutely do not understand. I also tried changing maximum memory in php.ini from 8Mb to 64Mb - does not help.

Please help!
Last edited by rualark on Mon Aug 15, 2005 7:58 am, edited 2 times in total.
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Check to see if one server is running php cli and the other php cgi. Let me know what you find.

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?
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

There is only one polling server. It is running php4-4.3.9 from /usr/ports/lang/php4 - CLI as far as I understand. Monitored servers all run some PHP but as far as I understand this is not important for remote monitoring?
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

I am currently having a similar problem of "works separately, but not when called from poller" with the new script which I have written:

Code: Select all

#!/usr/local/bin/php
<?
  $os = "unix";

  error_reporting(E_ERROR);

  function checkoneping($ip, $timeout, $id) {
    GLOBAL $timeoutopt;
    $path="/sbin/ping -c 1 $timeoutopt $timeout $ip > /tmp/$ip-$id.pingres &";
    $rv=exec($path, $ra, $ret);
    return $ret;
  }

  $timeoutopt="-t";
  if ($os=="linux") $timeoutopt="-w";

  $ip=$_SERVER["argv"][1];
  $timeout=$_SERVER["argv"][2];
  $tries=$_SERVER["argv"][3];

  for ($i=0; $i<$tries; $i++) {
    checkoneping($ip, $timeout, $i);
  }

  Sleep($timeout+1);

  $date=date("Y-m-d H:i:s");
  $fp=fopen("/tmp/$ip.pinglast", "w");
  fputs($fp, $date);
  fclose($fp);

  $time=0.0;
  $good=0;
  for ($i=0; $i<$tries; $i++) {
    $fa=file("/tmp/$ip-$i.pingres");
    for ($x=0; $x<count($fa); $x++) {
      $st=$fa[$x];
      if (strpos($st, " 0%")>0) $good++;
      if (strpos($st, "time=")>0) {
        $st1=substr($st, strpos($st, "time=")+5, strlen($st));
        $st1=substr($st1, 0, strpos($st1, " "));
        //echo "$st1 ";
        $time+=$st1;
      }
    }
  }
  if ($good>0) $time/=$good;
  $loss=100*($tries-$good)/$tries;
  echo "$loss\n$time\n";
?>
in the logs i see:

Code: Select all

08/15/2005 02:36:02 PM - CMDPHP: Poller[0] Host[4] DS[191] WARNING: Result from CMD not valid.  Partial Result: 
08/15/2005 02:36:02 PM - CMDPHP: Poller[0] Host[4] DS[191] CMD: php /usr/home/alchemist/www/cacti/scripts/pingloss.php 192.168.250.2 2 10, output: U
but it works fine separately:

Code: Select all

root@www /home/alchemist/www/cacti# su cactiuser
cactiuser@www /usr/home/alchemist/www/cacti$ php /usr/home/alchemist/www/cacti/scripts/pingloss.php 192.168.250.2 2 10
40
0.8775
cactiuser@www /usr/home/alchemist/www/cacti$ 
Is there a more poller-close testing? What shall I do to resolve this "works only separately" problem?
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

Ultimately I found out, that the scripts ss_host_disk.php and my pingloss.php are not even started, because the logging that must be run in any case in them does not work.

So we have the case of not starting child script_server and separate CMD php scripts. What shall I do to resolve this?
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

SUDDENLY ss_host_disk.php started to work correctly for this host as soon as i changed "Maximum Concurrent Poller Processes" from 1 to 5 and "Maximum Threads per Process" from 1 to 5.

The popen() of my pingloss.php script still does not work. I tried to change from popen to `pingloss.php` method, but it did not return any data either.
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

BTW poller works on the following installation:

Code: Select all

CPU: Pentium II/Pentium II Xeon/Celeron (273.64-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x633  Stepping = 3
  Features=0x80f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,MMX>
real memory  = 134152192 (127 MB)
avail memory = 121626624 (115 MB)
Disk space is ok
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

I changed my pingloss.php script to the following

Code: Select all

#!/usr/local/bin/php
<?
  $no_http_headers = true;
  include(dirname(__FILE__) . "/../include/config.php");

  echo "40\n0.5\n";
?>
But it aint work either!

What does all this mean?
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

I do not have /usr/ports/www/php4-cgi installed, because it cannot be installed both with /usr/ports/lang/php4, but they are both listed on the cacti docs site
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

I downloaded and installed cactid and got the same result:

Code: Select all

08/15/2005 06:00:39 PM - CACTID: Poller[0] Host[2] DS[194] WARNING: Result from SCRIPT not valid. Partial Result: ...  
08/15/2005 06:00:39 PM - CACTID: Poller[0] Host[2] ERROR: Empty result [213.234.196.66]: 'php /usr/home/alchemist/www/cacti/scripts/pingloss.php 213.234.196.66 2 10'  
rualark
Posts: 19
Joined: Thu Aug 04, 2005 2:53 am

Post by rualark »

Eventually I resolved the problem using RTFM ;)
My script output was incorrect and poller didn't tell me about that.
Corrected the output and everything worked.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests