From 97f04d33369dd1a9a11f2aef8ef654c226a3e636 Mon Sep 17 00:00:00 2001 From: Mike McGrath Date: Tue, 7 Feb 2006 01:42:50 +0000 Subject: [PATCH] auto-import cacti-0.8.6h-4 on branch devel from cacti-0.8.6h-4.src.rpm --- .cvsignore | 1 + cacti-0.8.6h-dbcfg.patch | 104 +++++++++++ cacti-httpd.conf | 11 ++ cacti.README.Fedora | 9 + cacti.logrotate | 7 + cacti.spec | 161 ++++++++++++++++++ fix_search_session_clear_issue.patch | 27 +++ ...sql_syntax_related_to_default_rra_id.patch | 22 +++ mysql_5x_strict.patch | 52 ++++++ nth_percentile_empty_return_set_issue.patch | 94 ++++++++++ sources | 1 + 11 files changed, 489 insertions(+) create mode 100644 cacti-0.8.6h-dbcfg.patch create mode 100644 cacti-httpd.conf create mode 100644 cacti.README.Fedora create mode 100644 cacti.logrotate create mode 100644 cacti.spec create mode 100644 fix_search_session_clear_issue.patch create mode 100644 fix_sql_syntax_related_to_default_rra_id.patch create mode 100644 mysql_5x_strict.patch create mode 100644 nth_percentile_empty_return_set_issue.patch diff --git a/.cvsignore b/.cvsignore index e69de29..13a721b 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +cacti-0.8.6h.tar.gz diff --git a/cacti-0.8.6h-dbcfg.patch b/cacti-0.8.6h-dbcfg.patch new file mode 100644 index 0000000..a082f1f --- /dev/null +++ b/cacti-0.8.6h-dbcfg.patch @@ -0,0 +1,104 @@ +--- include/config.php.orig 2006-01-13 14:44:09.000000000 -0600 ++++ include/config.php 2006-01-13 14:44:23.000000000 -0600 +@@ -23,15 +23,7 @@ + | - raXnet - http://www.raxnet.net/ | + +-------------------------------------------------------------------------+ + */ +- +-/* make sure these values refect your actual database/host/user/password */ +-$database_type = "mysql"; +-$database_default = "cacti"; +-$database_hostname = "localhost"; +-$database_username = "cactiuser"; +-$database_password = "cactiuser"; +-$database_port = "3306"; +- ++require_once("db.php"); + /* ----- you probably do not need to change anything below this line ----- */ + + /* Files that do not need http header information - Command line scripts */ +--- include/db.php.orig 1969-12-31 18:00:00.000000000 -0600 ++++ include/db.php 2006-01-13 15:14:07.000000000 -0600 +@@ -0,0 +1,9 @@ ++ +--- docs/text/manual.txt.orig 2006-01-13 15:21:40.000000000 -0600 ++++ docs/text/manual.txt 2006-01-13 15:22:42.000000000 -0600 +@@ -144,7 +144,7 @@ + mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somep + assword'; + mysql> flush privileges; +- 5. Edit include/config.php and specify the MySQL user, ++ 5. Edit /etc/cacti/db.php and specify the MySQL user, + password and database for your Cacti configuration. + $database_default = "cacti"; + $database_hostname = "localhost"; +@@ -379,7 +379,7 @@ + all the DLL files and sh.exe from the c:\cacti directory. + + Configure Cacti +- 1. Edit cacti_web_root/cacti/include/config.php and specify ++ 1. Edit cacti_web_root/cacti/include/db.php and specify + the MySQL user, password, database, and database port for + your Cacti configuration. + $database_default = "cacti"; +@@ -504,7 +504,7 @@ + shell> tar xzvf cacti-version.tar.gz + 4. Rename the new Cacti directory to match the old one. + shell> mv cacti-version cacti +- 5. Edit include/config.php and specify the MySQL user, ++ 5. Edit /etc/cacti/db.php and specify the MySQL user, + password and database for your Cacti configuration. + $database_default = "cacti"; + $database_hostname = "localhost"; +--- ./docs/UPGRADE.orig 2006-01-13 15:32:34.000000000 -0600 ++++ ./docs/UPGRADE 2006-01-13 15:35:37.000000000 -0600 +@@ -21,7 +21,7 @@ + + shell> mv cacti-version cacti + +- 5. Edit include/config.php and specify the MySQL user, password and ++ 5. Edit /etc/cacti/db.php and specify the MySQL user, password and + database for your Cacti configuration. + + $database_default = "cacti"; +--- ./docs/INSTALL.orig 2006-01-13 15:32:45.000000000 -0600 ++++ ./docs/INSTALL 2006-01-13 15:35:46.000000000 -0600 +@@ -19,7 +19,7 @@ + mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword'; + mysql> flush privileges; + +- 5. Edit include/config.php and specify the MySQL user, password and ++ 5. Edit /etc/cacti/db.php and specify the MySQL user, password and + database for your Cacti configuration. + + $database_default = "cacti"; +--- ./docs/html/upgrade.html.orig 2006-01-13 15:32:22.000000000 -0600 ++++ ./docs/html/upgrade.html 2006-01-13 15:35:18.000000000 -0600 +@@ -67,7 +67,7 @@ + + +
  • +-

    Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.

    ++

    Edit /etc/cacti/db.php and specify the MySQL user, password and database for your Cacti configuration.

    +
    + $database_default = "cacti";
    + $database_hostname = "localhost";
    +--- ./docs/html/install_unix.html.orig	2006-01-13 15:32:28.000000000 -0600
    ++++ ./docs/html/install_unix.html	2006-01-13 15:35:26.000000000 -0600
    +@@ -67,7 +67,7 @@
    +       
  • + +
  • +-

    Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.

    ++

    Edit /etc/cacti/db.php and specify the MySQL user, password and database for your Cacti configuration.

    +
    + $database_default = "cacti";
    + $database_hostname = "localhost";
    diff --git a/cacti-httpd.conf b/cacti-httpd.conf
    new file mode 100644
    index 0000000..b8b9a5c
    --- /dev/null
    +++ b/cacti-httpd.conf
    @@ -0,0 +1,11 @@
    +#
    +# Cacti: An rrd based graphing tool
    +#
    +Alias /cacti    /usr/share/cacti
    +
    +
    +	Order Deny,Allow
    +	Deny from all
    +	Allow from 127.0.0.1
    +
    +
    diff --git a/cacti.README.Fedora b/cacti.README.Fedora
    new file mode 100644
    index 0000000..97bf64a
    --- /dev/null
    +++ b/cacti.README.Fedora
    @@ -0,0 +1,9 @@
    +As of Feb. 6, 2006 Cacti does not work correctly with SELinux.  This will
    +change in the future.  If you're having issues getting Cacti to work properly
    +and SELinux is enabled, please run the following commands after installing
    +Cacti:
    +
    +chcon -R -t httpd_sys_content_t /var/log/cacti/
    +chcon -R -t httpd_sys_content_t /var/lib/cacti/rra/
    +
    +
    diff --git a/cacti.logrotate b/cacti.logrotate
    new file mode 100644
    index 0000000..2d8c53c
    --- /dev/null
    +++ b/cacti.logrotate
    @@ -0,0 +1,7 @@
    +/var/log/cacti/cacti.log {
    +	missingok
    +	monthly
    +	notifempty
    +	compress
    +	create 0664 cacti apache
    +}
    diff --git a/cacti.spec b/cacti.spec
    new file mode 100644
    index 0000000..b300e78
    --- /dev/null
    +++ b/cacti.spec
    @@ -0,0 +1,161 @@
    +Name: cacti
    +Version: 0.8.6h
    +Release: 4
    +Summary: An rrd based graphing tool
    +
    +Group: Applications/System
    +License: GPL
    +URL: http://www.cacti.net/
    +Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
    +Source1: cacti-httpd.conf
    +Source2: cacti.logrotate
    +Source3: cacti.README.Fedora
    +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
    +
    +Requires: php, php-mysql, mysql, httpd, rrdtool, net-snmp, php-snmp
    +Requires(pre): %{_sbindir}/useradd
    +Requires(postun): /sbin/service 
    +BuildArch: noarch
    +
    +Patch1: cacti-0.8.6h-dbcfg.patch
    +Patch2: http://www.cacti.net/downloads/patches/0.8.6h/fix_search_session_clear_issue.patch
    +Patch3: http://www.cacti.net/downloads/patches/0.8.6h/fix_sql_syntax_related_to_default_rra_id.patch
    +Patch4: http://www.cacti.net/downloads/patches/0.8.6h/nth_percentile_empty_return_set_issue.patch
    +Patch5: http://www.cacti.net/downloads/patches/0.8.6h/mysql_5x_strict.patch
    +
    +%description
    +Cacti is a complete frontend to RRDTool. It stores all of the
    +necessary information to create graphs and populate them with
    +data in a MySQL database. The frontend is completely PHP
    +driven. Along with being able to maintain graphs, data
    +sources, and round robin archives in a database, Cacti also
    +handles the data gathering. There is SNMP support for those
    +used to creating traffic graphs with MRTG.
    +
    +%prep
    +%setup -q
    +%patch1 -p0
    +%patch2 -p1
    +%patch3 -p1
    +%patch4 -p1
    +%patch5 -p1
    +
    +echo "*/5 * * * *	cacti	%{_bindir}/php %{_datadir}/%{name}/poller.php > /dev/null 2>&1" >cacti.cron
    +
    +%install
    +rm -rf %{buildroot}
    +%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}
    +%{__install} -d -m 0755 %{buildroot}/%{_docdir}/%{name}-%{version}
    +%{__install} -d -m 0755 %{buildroot}/%{_datadir}/%{name}/
    +%{__install} -m 0644 *.php %{buildroot}/%{_datadir}/%{name}/
    +%{__install} -d -m 0775 log/ %{buildroot}/%{_localstatedir}/log/%{name}/
    +%{__install} -m 0664 log/* %{buildroot}/%{_localstatedir}/log/%{name}/
    +%{__install} -d -m 0755 rra/ %{buildroot}/%{_localstatedir}/lib/%{name}/rra/
    +%{__install} -d -m 0755 scripts/ %{buildroot}/%{_localstatedir}/lib/%{name}/scripts/
    +%{__install} -m 0755 scripts/* %{buildroot}/%{_localstatedir}/lib/%{name}/scripts/
    +%{__install} -D -m 0644 cacti.cron %{buildroot}/%{_sysconfdir}/cron.d/cacti
    +%{__install} -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/cacti.conf
    +%{__install} -D -m 0644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/logrotate.d/cacti
    +%{__cp} -a images/ include/ install/ lib/ resource/ %{buildroot}%{_datadir}/%{name}
    +%{__cp} %{SOURCE3} ./docs/README.cacti
    +%{__cp} -a docs/ %{buildroot}/%{_docdir}/%{name}-%{version}
    +%{__mv} %{buildroot}/%{_datadir}/%{name}/include/db.php %{buildroot}/%{_sysconfdir}/%{name}/db.php
    +%{__chmod} +x %{buildroot}/%{_datadir}/%{name}/cmd.php %{buildroot}/%{_datadir}/%{name}/poller.php
    +ln -s %{_sysconfdir}/%{name}/db.php %{buildroot}/%{_datadir}/%{name}/include/db.php
    +ln -s %{_localstatedir}/lib/%{name}/rra %{buildroot}/%{_datadir}/%{name}/
    +ln -s %{_localstatedir}/lib/%{name}/scripts %{buildroot}/%{_datadir}/%{name}/
    +ln -s %{_localstatedir}/log/%{name}/ %{buildroot}/%{_datadir}/%{name}/log
    +
    +%clean
    +rm -rf %{buildroot}
    +
    +%pre
    +%{_sbindir}/useradd -d %{_datadir}/%{name} -r -s /sbin/nologin cacti 2> /dev/null || :
    +
    +%post
    +if [ $1 == 1 ]; then
    +	/sbin/service httpd condrestart > /dev/null 2>&1 || :
    +fi
    +
    +%postun
    +/sbin/service httpd condrestart > /dev/null 2>&1 || :
    +
    +%files
    +%defattr(-,root,root,-)
    +%dir %{_sysconfdir}/%{name}
    +%dir %{_datadir}/%{name}
    +%dir %{_localstatedir}/lib/%{name}
    +%dir %{_localstatedir}/lib/%{name}/scripts
    +%doc docs/ README LICENSE cacti.sql
    +%config(noreplace) %{_sysconfdir}/cron.d/cacti
    +%config(noreplace) %{_sysconfdir}/httpd/conf.d/cacti.conf
    +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
    +%attr(0660,cacti,apache) %config(noreplace) %{_sysconfdir}/%{name}/db.php
    +%{_datadir}/%{name}/*.php
    +%{_datadir}/%{name}/images/
    +%{_datadir}/%{name}/include/
    +%{_datadir}/%{name}/install/
    +%{_datadir}/%{name}/lib/
    +%{_datadir}/%{name}/log
    +%{_datadir}/%{name}/resource/
    +%{_datadir}/%{name}/rra
    +%{_datadir}/%{name}/scripts
    +%{_localstatedir}/lib/%{name}/scripts/*[^p]
    +%attr(-,cacti,apache) %{_localstatedir}/log/%{name}/
    +%attr(-,cacti,root) %{_localstatedir}/lib/%{name}/rra/
    +%attr(0644,root,root) %{_localstatedir}/lib/%{name}/scripts/*php
    +
    +%changelog
    +* Mon Feb 6 2006 Mike McGrath  - 0.8.6h-4
    +- Fixed some scriptlets to always return 0
    +- Fixed extra '/' in logrotate
    +- Added README.Fedora
    +
    +* Wed Jan 14 2006 Mike McGrath  - 0.8.6h-3
    +- Fixed device filter clear issue
    +- Fixed invalid SQL graph generation statement
    +- Fixed php warning for empty set non-existant rrd file
    +- Added MySQL 5.x 'strict mode' compatibility
    +
    +* Mon Jan 09 2006 Mike McGrath  - 0.8.6h-1
    +- MySQL 5.x support
    +- IPv6 support to lib/ping.php
    +- Command line scripts for copying users, reindxing and rebuilding cache
    +- Many Bug fixes
    +
    +* Tue Dec 18 2005 Mike McGrath  - 0.8.6g-7
    +- Separated database configs from config.php
    +- Fixed the 'short_open_tag" syntax error
    +- Fixed graph zoom graph bug
    +- Fixed SNMP auth bug
    +- Re-enables MIB file parsing in poller
    +- Created a Fedora frendly version of the RPM
    +
    +* Wed Sep 7 2005 Ian Berry  - 0.8.6g-1
    +- Updated to release 0.8.6g.
    +
    +* Mon Jul 1 2005 Ian Berry  - 0.8.6f-1
    +- Updated to release 0.8.6f.
    +
    +* Mon Jun 20 2005 Ian Berry  - 0.8.6e-1
    +- Updated to release 0.8.6e.
    +
    +* Wed Apr 26 2005 Ian Berry  - 0.8.6d-1
    +- Updated to release 0.8.6d.
    +
    +* Wed Dec 12 2004 Ian Berry  - 0.8.6c-1
    +- Updated to release 0.8.6c.
    +
    +* Wed Oct 5 2004 Ian Berry  - 0.8.6b-1
    +- Updated to release 0.8.6b.
    +
    +* Sun Oct 3 2004 Ian Berry  - 0.8.6a-1
    +- Updated to release 0.8.6a.
    +
    +* Sat Sep 11 2004 Ian Berry  - 0.8.6-1
    +- Updated to release 0.8.6.
    +- Broke cactid into its own package.
    +
    +* Thu Apr 4 2004 Ian Berry  - 0.8.5a-1
    +- Initial package.
    +
    diff --git a/fix_search_session_clear_issue.patch b/fix_search_session_clear_issue.patch
    new file mode 100644
    index 0000000..d18759d
    --- /dev/null
    +++ b/fix_search_session_clear_issue.patch
    @@ -0,0 +1,27 @@
    +--- 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("Devices", "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");
    diff --git a/fix_sql_syntax_related_to_default_rra_id.patch b/fix_sql_syntax_related_to_default_rra_id.patch
    new file mode 100644
    index 0000000..e7ea792
    --- /dev/null
    +++ b/fix_sql_syntax_related_to_default_rra_id.patch
    @@ -0,0 +1,22 @@
    +--- 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"]);
    + 
    diff --git a/mysql_5x_strict.patch b/mysql_5x_strict.patch
    new file mode 100644
    index 0000000..c174971
    --- /dev/null
    +++ b/mysql_5x_strict.patch
    @@ -0,0 +1,52 @@
    +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"]});
    ++						}
    + 					}
    + 				}
    + 			}
    diff --git a/nth_percentile_empty_return_set_issue.patch b/nth_percentile_empty_return_set_issue.patch
    new file mode 100644
    index 0000000..dbce46e
    --- /dev/null
    +++ b/nth_percentile_empty_return_set_issue.patch
    @@ -0,0 +1,94 @@
    +--- 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