Added official patches from the cacti site

This commit is contained in:
Mike McGrath 2007-09-21 14:57:08 +00:00
parent ece2b07b4f
commit c3bc59edf4
14 changed files with 129 additions and 499 deletions

View File

@ -1,6 +1,6 @@
Name: cacti
Version: 0.8.6j
Release: 8%{?dist}
Release: 9%{?dist}
Summary: An rrd based graphing tool
Group: Applications/System
@ -13,6 +13,11 @@ Source3: cacti.README.Fedora
Patch1: cacti-0.8.6h-dbcfg.patch
Patch2: CVE-2007-3112.patch
Patch3: ping_php_version4_snmpgetnext.patch
Patch4: tree_console_missing_hosts.patch
Patch5: thumbnail_graphs_not_working.patch
Patch6: graph_debug_lockup_fix.patch
Patch7: snmpwalk_fix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -34,6 +39,11 @@ used to creating traffic graphs with MRTG.
%setup -q
%patch1 -p0
%patch2 -p3
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
echo "#*/5 * * * * cacti %{_bindir}/php %{_datadir}/%{name}/poller.php > /dev/null 2>&1" >cacti.cron
@ -105,6 +115,9 @@ fi
%attr(0644,root,root) %{_localstatedir}/lib/%{name}/lib
%changelog
* Fri Sep 21 2007 Mike McGrath <mmcgrath@redhat.com> - 0.8.6j-9
- Added rest of official patches
* Fri Sep 14 2007 Mike McGrath <mmcgrath@redhat.com> - 0.8.6j-8
- Fix for CVE-2007-3112 bz#243592

View File

@ -1,137 +0,0 @@
diff -ruBbd cacti-0.8.6i/cmd.php cacti-0.8.6i-patch/cmd.php
--- cacti-0.8.6i/cmd.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/cmd.php 2007-01-01 12:27:15.328125000 -0500
@@ -26,7 +26,7 @@
*/
/* do NOT run this script through a web browser */
-if (!isset($_SERVER["argv"][0])) {
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
@@ -70,6 +71,10 @@
$print_data_to_stdout = false;
if ($_SERVER["argc"] == "3") {
if ($_SERVER["argv"][1] <= $_SERVER["argv"][2]) {
+ /* address potential exploits */
+ input_validate_input_number($_SERVER["argv"][1]);
+ input_validate_input_number($_SERVER["argv"][2]);
+
$hosts = db_fetch_assoc("select * from host where (disabled = '' and " .
"id >= " .
$_SERVER["argv"][1] .
diff -ruBbd cacti-0.8.6i/copy_cacti_user.php cacti-0.8.6i-patch/copy_cacti_user.php
--- cacti-0.8.6i/copy_cacti_user.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/copy_cacti_user.php 2007-01-01 12:27:15.312500000 -0500
@@ -25,9 +25,10 @@
*/
/* do NOT run this script through a web browser */
-if (! isset($_SERVER["argv"][0])) {
- die("This script is only meant to run at the command line.\n");
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
}
+
if (empty($_SERVER["argv"][2])) {
die("\nSyntax:\n php copy_cacti_user.php <template user> <new user>\n\n");
}
diff -ruBbd cacti-0.8.6i/include/html/inc_timespan_settings.php cacti-0.8.6i-patch/include/html/inc_timespan_settings.php
--- cacti-0.8.6i/include/html/inc_timespan_settings.php 2006-10-09 00:05:58.000000000 -0400
+++ cacti-0.8.6i-patch/include/html/inc_timespan_settings.php 2007-01-02 11:55:45.953125000 -0500
@@ -24,6 +24,20 @@
+-------------------------------------------------------------------------+
*/
+/* ================= input validation ================= */
+input_validate_input_number(get_request_var_request("predefined_timespan"));
+/* ==================================================== */
+
+/* clean up date1 string */
+if (isset($_REQUEST["date1"])) {
+ $_REQUEST["date1"] = sanitize_search_string(get_request_var("date1"));
+}
+
+/* clean up date2 string */
+if (isset($_REQUEST["date2"])) {
+ $_REQUEST["date2"] = sanitize_search_string(get_request_var("date2"));
+}
+
/* initialize the timespan array */
$timespan = array();
diff -ruBbd cacti-0.8.6i/poller.php cacti-0.8.6i-patch/poller.php
--- cacti-0.8.6i/poller.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/poller.php 2007-01-01 12:27:15.328125000 -0500
@@ -26,7 +26,7 @@
*/
/* do NOT run this script through a web browser */
-if (!isset($_SERVER["argv"][0])) {
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
diff -ruBbd cacti-0.8.6i/poller_commands.php cacti-0.8.6i-patch/poller_commands.php
--- cacti-0.8.6i/poller_commands.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/poller_commands.php 2007-01-01 12:27:15.328125000 -0500
@@ -27,7 +27,7 @@
define("MAX_RECACHE_RUNTIME", 296);
/* do NOT run this script through a web browser */
-if (!isset($_SERVER["argv"][0])) {
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
diff -ruBbd cacti-0.8.6i/poller_export.php cacti-0.8.6i-patch/poller_export.php
--- cacti-0.8.6i/poller_export.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/poller_export.php 2007-01-01 12:27:15.328125000 -0500
@@ -25,7 +25,7 @@
*/
/* do NOT run this script through a web browser */
-if (!isset($_SERVER["argv"][0])) {
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
diff -ruBbd cacti-0.8.6i/poller_reindex_hosts.php cacti-0.8.6i-patch/poller_reindex_hosts.php
--- cacti-0.8.6i/poller_reindex_hosts.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/poller_reindex_hosts.php 2007-01-01 12:27:15.328125000 -0500
@@ -25,7 +25,7 @@
*/
/* do NOT run this script through a web browser */
-if (!isset($_SERVER["argv"][0])) {
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
diff -ruBbd cacti-0.8.6i/rebuild_poller_cache.php cacti-0.8.6i-patch/rebuild_poller_cache.php
--- cacti-0.8.6i/rebuild_poller_cache.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/rebuild_poller_cache.php 2007-01-01 12:27:15.312500000 -0500
@@ -25,7 +25,7 @@
*/
/* do NOT run this script through a web browser */
-if (!isset($_SERVER["argv"][0])) {
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
diff -ruBbd cacti-0.8.6i/script_server.php cacti-0.8.6i-patch/script_server.php
--- cacti-0.8.6i/script_server.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/script_server.php 2007-01-01 12:27:15.312500000 -0500
@@ -26,9 +26,8 @@
$no_http_headers = true;
/* do NOT run this script through a web browser */
-if (!isset($_SERVER["argv"][0])) {
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
- exit(-1);
}
/* define STDOUT/STDIN file descriptors if not running under CLI */

View File

@ -1,106 +0,0 @@
diff -ruBbd cacti-0.8.6i/scripts/query_host_cpu.php cacti-0.8.6i-patch/scripts/query_host_cpu.php
--- cacti-0.8.6i/scripts/query_host_cpu.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/scripts/query_host_cpu.php 2007-01-01 12:50:55.781250000 -0500
@@ -1,6 +1,12 @@
<?php
+/* do NOT run this script through a web browser */
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
+}
+
$no_http_headers = true;
+
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");
diff -ruBbd cacti-0.8.6i/scripts/query_host_partitions.php cacti-0.8.6i-patch/scripts/query_host_partitions.php
--- cacti-0.8.6i/scripts/query_host_partitions.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/scripts/query_host_partitions.php 2007-01-01 12:50:55.781250000 -0500
@@ -1,6 +1,12 @@
<?php
+/* do NOT run this script through a web browser */
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
+}
+
$no_http_headers = true;
+
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");
diff -ruBbd cacti-0.8.6i/scripts/sql.php cacti-0.8.6i-patch/scripts/sql.php
--- cacti-0.8.6i/scripts/sql.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/scripts/sql.php 2007-01-01 12:50:55.781250000 -0500
@@ -1,6 +1,12 @@
<?
+/* do NOT run this script through a web browser */
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
+}
+
$no_http_headers = true;
+
include(dirname(__FILE__) . "/../include/config.php");
if ($database_password == "") {
diff -ruBbd cacti-0.8.6i/scripts/ss_fping.php cacti-0.8.6i-patch/scripts/ss_fping.php
--- cacti-0.8.6i/scripts/ss_fping.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/scripts/ss_fping.php 2007-01-01 12:50:55.796875000 -0500
@@ -1,7 +1,11 @@
<?php
#!/usr/bin/php -q
-//STANDARD SCRIPT SERVER HEADER!!!
+/* do NOT run this script through a web browser */
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
+}
+
$no_http_headers = true;
/* display No errors */
diff -ruBbd cacti-0.8.6i/scripts/ss_host_cpu.php cacti-0.8.6i-patch/scripts/ss_host_cpu.php
--- cacti-0.8.6i/scripts/ss_host_cpu.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/scripts/ss_host_cpu.php 2007-01-01 12:50:55.796875000 -0500
@@ -1,4 +1,10 @@
<?php
+
+/* do NOT run this script through a web browser */
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
+}
+
$no_http_headers = true;
/* display No errors */
diff -ruBbd cacti-0.8.6i/scripts/ss_host_disk.php cacti-0.8.6i-patch/scripts/ss_host_disk.php
--- cacti-0.8.6i/scripts/ss_host_disk.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/scripts/ss_host_disk.php 2007-01-01 12:50:55.796875000 -0500
@@ -1,4 +1,10 @@
<?php
+
+/* do NOT run this script through a web browser */
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
+}
+
$no_http_headers = true;
/* display No errors */
diff -ruBbd cacti-0.8.6i/scripts/ss_sql.php cacti-0.8.6i-patch/scripts/ss_sql.php
--- cacti-0.8.6i/scripts/ss_sql.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/scripts/ss_sql.php 2007-01-01 12:50:55.781250000 -0500
@@ -1,5 +1,10 @@
<?php
+/* do NOT run this script through a web browser */
+if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
+ die("<br><strong>This script is only meant to run at the command line.</strong>");
+}
+
$no_http_headers = true;
/* display ALL errors */

View File

@ -1,27 +0,0 @@
--- cacti-0.8.6h/host.php 2006-01-03 21:08:30.000000000 -0600
+++ cacti-fixed/host.php 2006-01-06 22:45:51.630701318 -0600
@@ -726,18 +726,18 @@
unset($_REQUEST["host_status"]);
}
- if (!empty($_SESSION["sess_host_status"])) {
- if ($_SESSION["sess_host_status"] != $_REQUEST["host_status"]) {
- $_REQUEST["page"] = 1;
- }
- }
-
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_device_current_page", "1");
load_current_session_value("filter", "sess_device_filter", "");
load_current_session_value("host_template_id", "sess_device_host_template_id", "-1");
load_current_session_value("host_status", "sess_host_status", "-1");
+ if (!empty($_SESSION["sess_host_status"])) {
+ if ($_SESSION["sess_host_status"] != $_REQUEST["host_status"]) {
+ $_REQUEST["page"] = 1;
+ }
+ }
+
html_start_box("<strong>Devices</strong>", "98%", $colors["header"], "3", "center", "host.php?action=edit&host_template_id=" . $_REQUEST["host_template_id"] . "&host_status=" . $_REQUEST["host_status"]);
include("./include/html/inc_device_filter_table.php");

View File

@ -1,22 +0,0 @@
--- cacti-0.8.6h/graph.php 2006-01-03 21:08:30.000000000 -0600
+++ cacti-fixed/graph.php 2006-01-06 22:40:29.643671752 -0600
@@ -130,13 +130,13 @@
$timespan = -($rra["timespan"]);
/* find the step and how often this graph is updated with new data */
- $ds_step = db_fetch_cell("select
+ $ds_step = db_fetch_cell("SELECT
data_template_data.rrd_step
- from (data_template_data,data_template_rrd,graph_templates_item)
- where graph_templates_item.task_item_id=data_template_rrd.id
- and data_template_rrd.local_data_id=data_template_data.local_data_id
- and graph_templates_item.local_graph_id=" . $_GET["local_graph_id"] .
- "limit 0,1");
+ FROM (data_template_data,data_template_rrd,graph_templates_item)
+ WHERE graph_templates_item.task_item_id=data_template_rrd.id
+ AND data_template_rrd.local_data_id=data_template_data.local_data_id
+ AND graph_templates_item.local_graph_id=" . $_GET["local_graph_id"] .
+ " LIMIT 0,1");
$ds_step = empty($ds_step) ? 300 : $ds_step;
$seconds_between_graph_updates = ($ds_step * $rra["steps"]);

View File

@ -0,0 +1,18 @@
--- cacti-0.8.6j/lib/rrd.php 2007-01-17 19:23:10.000000000 -0500
+++ cacti-0.8.6j-patch/lib/rrd.php 2007-03-01 15:32:18.609375000 -0500
@@ -83,6 +83,7 @@
if ($config["cacti_server_os"] == "unix") {
/* an empty $rrd_struc array means no fp is available */
if (sizeof($rrd_struc) == 0) {
+ session_write_close();
$fp = popen(read_config_option("path_rrdtool") . escape_command(" $command_line"), "r");
}else{
fwrite(rrd_get_fd($rrd_struc, RRDTOOL_PIPE_CHILD_READ), escape_command(" $command_line") . "\r\n");
@@ -91,6 +92,7 @@
}elseif ($config["cacti_server_os"] == "win32") {
/* an empty $rrd_struc array means no fp is available */
if (sizeof($rrd_struc) == 0) {
+ session_write_close();
$fp = popen(read_config_option("path_rrdtool") . escape_command(" $command_line"), "rb");
}else{
fwrite(rrd_get_fd($rrd_struc, RRDTOOL_PIPE_CHILD_READ), escape_command(" $command_line") . "\r\n");

View File

@ -1,14 +0,0 @@
--- cacti-0.8.6i/lib/import.php 2006-10-09 00:06:00.000000000 -0400
+++ cacti-0.8.6i-patch/lib/import.php 2007-01-02 08:17:09.593750000 -0500
@@ -687,6 +687,11 @@
while (list($field_name, $field_array) = each($fields_data_input_edit)) {
/* make sure this field exists in the xml array first */
if (isset($xml_array[$field_name])) {
+ /* fix issue with data input method importing and white spaces */
+ if ($field_name == "input_string") {
+ $xml_array[$field_name] = str_replace("><", "> <", $xml_array[$field_name]);
+ }
+
$save[$field_name] = addslashes(xml_character_decode($xml_array[$field_name]));
}
}

View File

@ -1,52 +0,0 @@
diff -ruBbd cacti-0.8.6h/cacti.sql yak/cacti.sql
--- cacti-0.8.6h/cacti.sql 2006-01-03 22:08:36.000000000 -0500
+++ yak/cacti.sql 2006-01-07 16:21:36.406250000 -0500
@@ -1846,7 +1846,7 @@
avg_time decimal(10,5) default '0.00000',
total_polls int(12) unsigned default '0',
failed_polls int(12) unsigned default '0',
- availability decimal(7,5) NOT NULL default '100.00000',
+ availability decimal(8,5) NOT NULL default '100.00000',
PRIMARY KEY (id)
) TYPE=MyISAM;
diff -ruBbd cacti-0.8.6h/lib/database.php yak/lib/database.php
--- cacti-0.8.6h/lib/database.php 2006-01-03 22:08:36.000000000 -0500
+++ yak/lib/database.php 2006-01-07 14:43:36.156250000 -0500
@@ -214,14 +214,14 @@
@arg $table_name - the name of the table to make the replacement in
@arg $key_cols - the primary key(s)
@returns - the auto incriment id column (if applicable) */
-function sql_save($array_items, $table_name, $key_cols = "id") {
+function sql_save($array_items, $table_name, $key_cols = "id", $autoinc = TRUE) {
global $cnn_id;
while (list ($key, $value) = each ($array_items)) {
$array_items[$key] = "\"" . sql_sanitize($value) . "\"";
}
- if (!$cnn_id->Replace($table_name, $array_items, $key_cols, false)) { return 0; }
+ if (!$cnn_id->Replace($table_name, $array_items, $key_cols, FALSE, $autoinc)) { return 0; }
/* get the last AUTO_ID and return it */
if ($cnn_id->Insert_ID() == "0") {
diff -ruBbd cacti-0.8.6h/lib/template.php yak/lib/template.php
--- cacti-0.8.6h/lib/template.php 2006-01-03 22:08:36.000000000 -0500
+++ yak/lib/template.php 2006-01-07 15:08:31.953125000 -0500
@@ -643,10 +642,16 @@
/* if there are no '|' characters, all of the substitutions were successful */
if (!strstr($subs_string, "|query")) {
+ if (sizeof(db_fetch_row("show columns from data_template_data like '" . $suggested_value["field_name"] . "'"))) {
db_execute("update data_template_data set " . $suggested_value["field_name"] . "='" . addslashes($suggested_value["text"]) . "' where local_data_id=" . $cache_array["local_data_id"]{$data_template["id"]});
+ }
/* once we find a working value, stop */
$suggested_values_ds{$data_template["id"]}{$suggested_value["field_name"]} = true;
+
+ if (sizeof(db_fetch_row("show columns from data_template_rrd like '" . $suggested_value["field_name"] . "'"))) {
+ db_execute("update data_template_rrd set " . $suggested_value["field_name"] . "='" . $subs_string . "' where local_data_id=" . $cache_array["local_data_id"]{$data_template["id"]});
+ }
}
}
}

View File

@ -1,94 +0,0 @@
--- cacti-0.8.6h/lib/graph_variables.php 2006-01-03 21:08:30.000000000 -0600
+++ cacti-fixed/lib/graph_variables.php 2006-01-06 22:40:31.032460462 -0600
@@ -302,27 +302,34 @@
/* format the output according to args passed to the variable */
if ($regexp_match_array[4] == "current") {
+ if (! empty($nth_cache{$graph_item["local_data_id"]}{$graph_item["data_source_name"]})) {
$nth = $nth_cache{$graph_item["local_data_id"]}{$graph_item["data_source_name"]};
$nth = ($regexp_match_array[2] == "bits") ? $nth * 8 : $nth;
$nth /= pow(10,intval($regexp_match_array[3]));
+ }
}elseif ($regexp_match_array[4] == "total") {
for ($t=0;($t<count($graph_items));$t++) {
if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
+ if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]})) {
$local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]};
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));
$nth += $local_nth;
+ }
}
}
}elseif ($regexp_match_array[4] == "max") {
+ if (! empty($nth_cache{$graph_item["local_data_id"]}["nth_percentile_maximum"])) {
$nth = $nth_cache{$graph_item["local_data_id"]}["nth_percentile_maximum"];
$nth = ($regexp_match_array[2] == "bits") ? $nth * 8 : $nth;
$nth /= pow(10,intval($regexp_match_array[3]));
+ }
}elseif ($regexp_match_array[4] == "total_peak") {
for ($t=0;($t<count($graph_items));$t++) {
if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
+ if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"])) {
$local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"];
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));
@@ -330,9 +337,11 @@
$nth += $local_nth;
}
}
+ }
}elseif ($regexp_match_array[4] == "all_max_current") {
for ($t=0;($t<count($graph_items));$t++) {
if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
+ if (! empty($ninety_fifth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]})) {
$local_nth = $ninety_fifth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]};
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));
@@ -342,9 +351,11 @@
}
}
}
+ }
}elseif ($regexp_match_array[4] == "all_max_peak") {
for ($t=0;($t<count($graph_items));$t++) {
if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
+ if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"])) {
$local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"];
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));
@@ -354,28 +365,23 @@
}
}
}
+ }
}elseif ($regexp_match_array[4] == "aggregate") {
- if (empty($nth_cache{0}["nth_percentile_aggregate_total"])) {
- $nth = 0;
- }else{
+ if (! empty($nth_cache{0}["nth_percentile_aggregate_total"])) {
$local_nth = $nth_cache{0}["nth_percentile_aggregate_total"];
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));
$nth = $local_nth;
}
}elseif ($regexp_match_array[4] == "aggregate_max") {
- if (empty($nth_cache{0}["nth_percentile_aggregate_max"])) {
- $nth = 0;
- }else{
+ if (! empty($nth_cache{0}["nth_percentile_aggregate_max"])) {
$local_nth = $nth_cache{0}["nth_percentile_aggregate_max"];
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));
$nth = $local_nth;
}
}elseif ($regexp_match_array[4] == "aggregate_sum") {
- if (empty($nth_cache{0}["nth_percentile_aggregate_sum"])) {
- $nth = 0;
- }else{
+ if (! empty($nth_cache{0}["nth_percentile_aggregate_sum"])) {
$local_nth = $nth_cache{0}["nth_percentile_aggregate_sum"];
$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
$local_nth /= pow(10,intval($regexp_match_array[3]));

View File

@ -0,0 +1,42 @@
--- cacti-0.8.6j/lib/ping.php 2007-01-17 19:23:10.000000000 -0500
+++ cacti-0.8.6j-patch/lib/ping.php 2007-01-20 19:45:55.015625000 -0500
@@ -281,7 +281,13 @@
/* poll sysUptime for status */
$retry_count = 0;
+
+ /* getnext does not work in php versions less than 5 */
+ if (version_compare("5", phpversion(), "<")) {
$oid = ".1";
+ }else{ $oid = ".1.3.6.1.2.1.1.3.0";
+ }
+
while (1) {
if ($retry_count >= $this->retries) {
$this->snmp_status = "down";
@@ -289,6 +295,8 @@
return false;
}
+ /* getnext does not work in php versions less than 5 */
+ if (version_compare("5", phpversion(), "<")) {
$output = cacti_snmp_getnext($this->host["hostname"],
$this->host["snmp_community"],
$oid,
@@ -298,6 +306,16 @@
$this->host["snmp_port"],
$this->host["snmp_timeout"],
SNMP_CMDPHP);
+ }else{ $output = cacti_snmp_get($this->host["hostname"],
+ $this->host["snmp_community"],
+ $oid,
+ $this->host["snmp_version"],
+ $this->host["snmp_username"],
+ $this->host["snmp_password"],
+ $this->host["snmp_port"],
+ $this->host["snmp_timeout"],
+ SNMP_CMDPHP);
+ }
/* determine total time +- ~10% */
$this->time = $this->get_time($this->precision);

View File

@ -1,46 +0,0 @@
diff -ruBbd cacti-0.8.6i/lib/poller.php cacti-0.8.6i-patched/lib/poller.php
--- cacti-0.8.6i/lib/poller.php 2006-10-08 23:06:01.000000000 -0400
+++ cacti-0.8.6i-patched/lib/poller.php 2006-11-21 23:41:02.000000000 -0500
@@ -213,7 +213,7 @@
/* process_poller_output - grabs data from the 'poller_output' table and feeds the *completed*
results to RRDTool for processing
@arg $rrdtool_pipe - the array of pipes containing the file descriptor for rrdtool */
-function process_poller_output($rrdtool_pipe) {
+function process_poller_output($rrdtool_pipe, $remainder = FALSE) {
global $config;
include_once($config["library_path"] . "/rrd.php");
@@ -221,6 +221,12 @@
/* let's count the number of rrd files we processed */
$rrds_processed = 0;
+ if ($remainder) {
+ $limit = "";
+ }else{
+ $limit = "LIMIT 10000";
+ }
+
/* create/update the rrd files */
$results = db_fetch_assoc("select
poller_output.output,
@@ -231,7 +237,7 @@
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");
+ $limit");
if (sizeof($results) > 0) {
/* create an array keyed off of each .rrd file */
diff -ruBbd cacti-0.8.6i/poller.php cacti-0.8.6i-patched/poller.php
--- cacti-0.8.6i/poller.php 2006-10-08 23:06:01.000000000 -0400
+++ cacti-0.8.6i-patched/poller.php 2006-11-12 11:49:05.000000000 -0500
@@ -166,7 +166,7 @@
$polling_items = db_fetch_assoc("select poller_id,end_time from poller_time where poller_id = 0");
if (sizeof($polling_items) == $process_file_number) {
- $rrds_processed = $rrds_processed + process_poller_output($rrdtool_pipe);
+ $rrds_processed = $rrds_processed + process_poller_output($rrdtool_pipe, TRUE);
/* take time and log performance data */
list($micro,$seconds) = split(" ", microtime());

15
snmpwalk_fix.patch Normal file
View File

@ -0,0 +1,15 @@
diff -ruBbd cacti-0.8.6j/lib/snmp.php cacti-0.8.6j-patched/lib/snmp.php
--- cacti-0.8.6j/lib/snmp.php 2007-01-17 19:23:10.000000000 -0500
+++ cacti-0.8.6j-patched/lib/snmp.php 2007-05-15 21:26:14.000000000 -0400
@@ -221,9 +219,9 @@
$temp_array = exec_into_array(read_config_option("path_snmpwalk") . " -v$version -t $timeout -r $retries $hostname:$port $snmp_auth $oid");
}else {
if (file_exists($path_snmpbulkwalk) && ($version > 1)) {
- $temp_array = exec_into_array($path_snmpbulkwalk . " -O n $snmp_auth -v $version -t $timeout -r $retries -Cr50 $hostname:$port $oid");
+ $temp_array = exec_into_array($path_snmpbulkwalk . " -O Qn $snmp_auth -v $version -t $timeout -r $retries -Cr50 $hostname:$port $oid");
}else{
- $temp_array = exec_into_array(read_config_option("path_snmpwalk") . " -O n $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid");
+ $temp_array = exec_into_array(read_config_option("path_snmpwalk") . " -O Qn $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid");
}
}

View File

@ -0,0 +1,20 @@
--- cacti-0.8.6j/lib/rrd.php 2007-01-17 19:23:10.000000000 -0500
+++ cacti-0.8.6j-patch/lib/rrd.php 2007-02-01 20:29:59.687500000 -0500
@@ -1080,9 +1080,15 @@
if ($graph_item_types{$graph_item["graph_type_id"]} == "COMMENT") {
if (read_config_option("rrdtool_version") == "rrd-1.2.x") {
- $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":\"" . str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]) . $hardreturn[$graph_item_id] . "\" ";
+ $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":\"" . str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]) . $hardreturn[$graph_item_id] . "\" ";
+ if (trim($comment_string) != "COMMENT:\"\"") {
+ $txt_graph_items .= $comment_string;
+ }
}else {
- $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":\"" . $graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id] . "\" ";
+ $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":\"" . $graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id] . "\" ";
+ if (trim($comment_string) != "COMMENT:\"\"") {
+ $txt_graph_items .= $comment_string;
+ }
}
}elseif (($graph_item_types{$graph_item["graph_type_id"]} == "GPRINT") && (!isset($graph_data_array["graph_nolegend"]))) {
$graph_variables["text_format"][$graph_item_id] = str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]); /* escape colons */

View File

@ -0,0 +1,20 @@
--- cacti-0.8.6j/lib/html_tree.php 2007-01-17 19:23:10.000000000 -0500
+++ cacti-0.8.6j-patch/lib/html_tree.php 2007-01-27 15:48:50.390625000 -0500
@@ -328,7 +328,7 @@
while ($i > 1) {
$i--;
- $parent_tier = substr($tier_string, 0, $i * CHARS_PER_TIER);
+ $parent_tier = tree_tier_string(substr($tier_string, 0, $i * CHARS_PER_TIER));
$parent_variable = "sess_tree_leaf_expand_" . $leaf["graph_tree_id"] . "_" . $parent_tier;
$effective = @$_SESSION[$parent_variable];
@@ -365,8 +365,6 @@
@returns - the string representing the leaf position
*/
function tree_tier_string($order_key, $chars_per_tier = CHARS_PER_TIER) {
- $root_test = str_pad('', $chars_per_tier, '0');
-
$new_string = preg_replace("/0+$/",'',$order_key);
return $new_string;