Same here...
CentOS 4.x
PHP 4.3.9 (Release 3.22.12)
My Workaround:
Code: Select all
--- rrd.php.orig 2009-01-27 15:10:39.000000000 +0100
+++ rrd.php 2009-01-27 17:45:03.000000000 +0100
@@ -65,7 +65,7 @@
}
}
-function rrdtool_execute($command_line, $log_to_stdout, $output_flag, &$rrd_struc = array(), $logopt = "WEBLOG") {
+function rrdtool_execute($command_line, $log_to_stdout, $output_flag, $rrd_struc = array(), $logopt = "WEBLOG") {
global $config;
if (!is_numeric($output_flag)) {
@@ -92,7 +92,7 @@
/* use popen to eliminate the zombie issue */
if ($config["cacti_server_os"] == "unix") {
/* an empty $rrd_struc array means no fp is available */
- if (sizeof($rrd_struc) == 0) {
+ if (sizeof($rrd_struc['fd']) == 0) {
session_write_close();
$fp = popen(read_config_option("path_rrdtool") . escape_command(" $command_line"), "r");
}else{
@@ -301,7 +301,7 @@
if ($show_source == true) {
return read_config_option("path_rrdtool") . " create" . RRD_NL . "$data_source_path$create_ds$create_rra";
}else{
- rrdtool_execute("create $data_source_path $create_ds$create_rra", true, RRDTOOL_OUTPUT_STDOUT, $rrd_struc, "POLLER");
+ rrdtool_execute("create $data_source_path $create_ds$create_rra", true, RRDTOOL_OUTPUT_STDOUT, array(&$rrd_struc), "POLLER");
}
}
@@ -353,7 +353,7 @@
$i++;
}
- rrdtool_execute("update $rrd_path --template $rrd_update_template $rrd_update_values", true, RRDTOOL_OUTPUT_STDOUT, $rrd_struc, "POLLER");
+ rrdtool_execute("update $rrd_path --template $rrd_update_template $rrd_update_values", true, RRDTOOL_OUTPUT_STDOUT, array(&$rrd_struc), "POLLER");
$rrds_processed++;
}
}
@@ -535,7 +535,7 @@
return $fetch_array;
}
-function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rrd_struc = array()) {
+function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rrd_struc) {
global $config, $consolidation_functions;
include_once($config["library_path"] . "/cdef.php");
@@ -1399,7 +1399,7 @@
print "<PRE>" . read_config_option("path_rrdtool") . " graph $graph_opts$graph_defs$txt_graph_items</PRE>";
}else{
if (isset($graph_data_array["export"])) {
- rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, $rrd_struc);
+ rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, RRDTOOL_OUTPUT_NULL, array(&$rrd_struc));
return 0;
}else{
if (isset($graph_data_array["output_flag"])) {
@@ -1408,7 +1408,7 @@
$output_flag = RRDTOOL_OUTPUT_GRAPH_DATA;
}
- return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, $rrd_struc);
+ return rrdtool_execute("graph $graph_opts$graph_defs$txt_graph_items", false, $output_flag, array(&$rrd_struc));
}
}
}
@@ -1972,7 +1972,7 @@
$output_flag = RRDTOOL_OUTPUT_STDOUT;
- $xport_array = rrdxport2array(rrdtool_execute("xport $xport_opts$xport_defs$txt_xport_items", false, $output_flag, $rrd_struc));
+ $xport_array = rrdxport2array(rrdtool_execute("xport $xport_opts$xport_defs$txt_xport_items", false, $output_flag, array(&$rrd_struc)));
/* add host and graph information */
$xport_array["meta"]["title_cache"] = $graph["title_cache"];
Changed all backreferences.
And changed $rrd_struc array check for fp. No idea... but if i let the original line sieof($rrd_struc) returns 1. And therefore the "rrd Crashed" shows up (false positive). This is why i changed the check to $rrd_struc['fd'].
Btw: This patch works for me. But it does need a review. Because I didn't analyized the whole cacti code, but just tracked back the problem and fixed this particular problem.