cacti debug xampp
c:\documents and settings\issdu>c:/xampp/php/php -q c:/xampp/htdocs/cacti/poller
.php --force --debug
09/25/2013 03:31:52 am - poller: poller[0] note: poller int: '300', scheduled ta
sk int: '300', time since last: '118', max runtime '298', poller runs: '1'
09/25/2013 03:31:52 am - poller: poller[0] debug: about to spawn a remote proces
s [cmd: c:/xampp/php/php.exe, args: -q c:/xampp/htdocs/cacti/cmd.php 0 1]
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
ok u:0.01 s:0.03 r:8.19rs.
ok u:0.01 s:0.03 r:8.1909/25/2013 03:32:02 am - system stats: time:9.8750 method
ok u:0.01 s:0.03 r:8.23reads:n/a hosts:2 hostsperprocess:2 datasources:29 rrdspr
ok u:0.01 s:0.03 r:8.23rs.
ok u:0.01 s:0.03 r:8.25rs.
ok u:0.01 s:0.03 r:8.25rs.
ok u:0.01 s:0.03 r:8.25rs.
ok u:0.01 s:0.03 r:8.28rs.
ok u:0.01 s:0.03 r:8.34rs.
ok u:0.01 s:0.03 r:8.34rs.
ok u:0.01 s:0.03 r:8.72rs.
ok u:0.01 s:0.03 r:8.72rs.
ok u:0.01 s:0.03 r:8.72rs.
ok u:0.01 s:0.03 r:8.72rs.
ok u:0.01 s:0.03 r:8.72rs.
ok u:0.01 s:0.03 r:8.73rs.
ok u:0.01 s:0.03 r:8.75rs.
ok u:0.01 s:0.03 r:8.75rs.
loop time is: 10.44llers.
sleep time is: 289.36lers.
total time is: 10.64llers.
waiting on 1 of 1 pollers.
c:\documents and settings\issdu>
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
ok u:0.01 s:0.03 r:3.36w
aiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
ok u:0.01 s:0.03 r:3.45
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
error: not enough argumentsw
aiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
ok u:0.01 s:0.03 r:4.42waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
waiting on 1 of 1 pollers.
ok u:0.01 s:0.03 r:4.50
waiting on 1 of 1 pollers.
ok u:0.01 s:0.03 r:4.51waiting on 1 of 1 pollers.
有解?方法??
strict standards: only variables should be passed by reference in c:\xampp\htdocs\cacti\lib\ping.php on line 382
strict standards: only variables should be passed by reference in c:\xampp\htdocs\cacti\lib\ping.php on line 382
strict standards: only variables should be passed by reference in c:\xampp\htdocs\cacti\lib\ping.php on line 382
回复讨论(解决方案) 那要看 c:\xampp\htdocs\cacti\lib\ping.php 第 382 行是怎么写的了
/*此?382行 get the socket response */
switch(socket_select($r = array($this->socket), $w = null, $f = null, $to_sec, $to_usec)) {
case 2:
/* connection refused */
$error = refused;
break;
case 1:
/* get the end time */
$this->time = $this->get_time($this->precision);
/* get packet response */
$code = @socket_recv($this->socket, $this->reply, 256, 0);
/* get the error, if applicable */
$err = socket_last_error($this->socket);
/* set the return message */
$this->ping_status = $this->time * 1000;
$this->ping_response = udp ping success ( . $this->time*1000 . ms);
$this->close_socket();
return true;
case 0:
/* timeout */
$error = timeout;
break;
}
$retry_count++;
}
} else {
$this->ping_response = destination address not specified;
$this->ping_status = down;
return false;
}
} /* end ping_udp */
function ping_tcp() {
/* host must be nonblank */
if ($this->host[hostname]) {
/* initialize variables */
$this->ping_status = down;
$this->ping_response = default;
/* establish timeout variables */
$to_sec = floor($this->timeout/1000);
$to_usec = ($this->timeout%1000)*1000;
/* clean up hostname if specifying snmp_transport */
$this->host[hostname] = str_replace(tcp:, , strtolower($this->host[hostname]));
$this->host[hostname] = str_replace(udp:, , strtolower($this->host[hostname]));
/* determine the host's ip address */
if ($this->is_ipaddress($this->host[hostname])) {
$host_ip = $this->host[hostname];
}else{
$host_ip = gethostbyname($this->host[hostname]);
if (!$this->is_ipaddress($host_ip)) {
cacti_log(warning: tcp ping error: gethostbyname failed for . $this->host[hostname]);
$this->response = tcp ping error: gethostbyname failed for . $this->host[hostname];
return false;
}
}
/* initilize the socket */
if (substr_count($host_ip,:) > 0) {
if (defined(af_inet6)) {
$this->socket = socket_create(af_inet6, sock_stream, sol_tcp);
}else{
$this->ping_response = php binary does not support ipv6;
$this->ping_status = down;
cacti_log(warning: ipv6 host detected, php version does not support ipv6);
return false;
}
}else{
$this->socket = socket_create(af_inet, sock_stream, sol_tcp);
}
while (1) {
/* set start time */
$this->start_time();
/* allow immediate return */
socket_set_nonblock($this->socket);
@socket_connect($this->socket, $host_ip, $this->port);
socket_set_block($this->socket);
switch(socket_select($r = array($this->socket), $w = array($this->socket), $f = array($this->socket), $to_sec, $to_usec)){
case 2:
/* connection refused */
$this->time = $this->get_time($this->precision);
if (($this->time*1000) timeout) {
$this->ping_response = tcp ping connection refused ( . $this->time*1000 . ms);
$this->ping_status = $this->time*1000;
}
$this->close_socket();
return true; /* connection refused says: host is alive (else ping would time out) */
case 1:
/* connected, so calculate the total time and return */
$this->time = $this->get_time($this->precision);
if (($this->time*1000) timeout) {
$this->ping_response = tcp ping success ( . $this->time*1000 . ms);
$this->ping_status = $this->time*1000;
}
$this->close_socket();
return true;
case 0:
/* timeout */
$this->ping_response = tcp ping timed out;
$this->ping_status = down;
$this->close_socket();
return false;
}
}
} else {
$this->ping_response = destination address not specified;
$this->ping_status = down;
return false;
}
} /* end ping_tcp */
function ping($avail_method = avail_snmp_and_ping, $ping_type = ping_icmp, $timeout=500, $retries=3) {
/* initialize variables */
$ping_ping = true;
$ping_snmp = true;
$this->ping_status = down;
$this->ping_response = ping not performed due to setting.;
$this->snmp_status = down;
$this->snmp_response = snmp not performed due to setting or ping result.;
$this->avail_method = $avail_method;
/* short circuit for availability none */
if ($avail_method == avail_none) {
$this->ping_status = 0.00;
return true;
}
if ((!function_exists(socket_create)) && ($avail_method != avail_none)) {
$avail_method = avail_snmp;
cacti_log(warning: sockets support not enabled in php, falling back to snmp ping);
}
if (($retries 5)) {
$this->retries = 2;
}else{
$this->retries = $retries;
}
if ($timeout $this->timeout = 500;
}else{
$this->timeout = $timeout;
}
/* decimal precision is 0.0000 */
$this->precision = 5;
/* snmp pinging has been selected at a minimum */
$ping_result = false;
$snmp_result = false;
/* icmp/udp ping test */
if (($avail_method == avail_snmp_and_ping) ||
($avail_method == avail_snmp_or_ping) ||
($avail_method == avail_ping)) {
if ($ping_type == ping_icmp) {
$ping_result = $this->ping_icmp();
}else if ($ping_type == ping_udp) {
$ping_result = $this->ping_udp();
}else if ($ping_type == ping_tcp) {
$ping_result = $this->ping_tcp();
}
}
/* snmp test */
if (($avail_method == avail_snmp_or_ping) && ($ping_result == true)) {
$snmp_result = true;
$this->snmp_status = 0.000;
}else if (($avail_method == avail_snmp_and_ping) && ($ping_result == false)) {
$snmp_result = false;
}else if (($avail_method == avail_snmp) || ($avail_method == avail_snmp_and_ping)) {
if (($this->host[snmp_community] == ) && ($this->host[snmp_version] != 3)) {
/* snmp version 1/2 without community string assume snmp test to be successful
due to backward compatibility issues */
$snmp_result = true;
$this->snmp_status = 0.000;
}else{
$snmp_result = $this->ping_snmp();
}
}
switch ($avail_method) {
case avail_snmp_or_ping:
if (($this->host[snmp_community] == ) && ($this->host[snmp_version] != 3)) {
if ($ping_result) {
return true;
}else{
return false;
}
}elseif ($snmp_result) {
return true;
}elseif ($ping_result) {
return true;
}else{
return false;
}
case avail_snmp_and_ping:
if (($this->host[snmp_community] == ) && ($this->host[snmp_version] != 3)) {
if ($ping_result) {
return true;
}else{
return false;
}
}elseif (($snmp_result) && ($ping_result)) {
return true;
}else{
return false;
}
case avail_snmp:
if ($snmp_result) {
return true;
}else{
return false;
}
case avail_ping:
if ($ping_result) {
return true;
}else{
return false;
}
default:
return false;
}
} /* end_ping */
function is_ipaddress($ip_address = '') {
/* check for ipv4/v6 */
if (substr_count($ip_address, :)) {
/* compressed dot format */
if (substr_count($ip_address, ::)) {
$ip_address = str_replace(::, :, $ip_address);
$segments = explode(:, $ip_address);
}else{
$segments = explode(:, $ip_address);
if (sizeof($segments) != 8) {
/* should be 8 segments */
return false;
}
}
$i = 0;
foreach ($segments as $segment) {
$i++;
if ((trim($segment) == ) && ($i == 1)) {
continue;
}elseif (!is_numeric(0x . $segment)) {
return false;
}
}
return true;
}else if (strlen($ip_address) $octets = explode('.', $ip_address);
$i = 0;
if (count($octets) != 4) {
return false;
}
foreach($octets as $octet) {
if ($i == 0 || $i == 3) {
if(($octet 255)) {
return false;
}
}else{
if(($octet 255)) {
return false;
}
}
$i++;
}
return true;
}else{
return false;
}
}
}
?>
可先回避一下
socket_select($r = array($this->socket), $w = null, $f = null, $to_sec, $to_usec)
写作
@socket_select($r = array($this->socket), $w = null, $f = null, $to_sec, $to_usec)
也可以 error_reporting(e_all ^ e_strict); 一下
由原型
int socket_select ( array &read, array &write, array &except, int tv_sec [, int tv_usec] )
可知,前三个参数是引用传递的
从 php5.3 起,引用必须产生于实体,否则就会报错
并不排除以后会联回避都不行了
正确的写法是
$r = array($this->socket);
$w = null;
$f = null;
socket_select($r, $w, $f, $to_sec, $to_usec)
板大,
已?解?了,
感恩!