[packages/cacti] - mostly updated; one patch left + testing; new config variable path_cactilog

arekm arekm at pld-linux.org
Thu Aug 31 09:16:03 CEST 2017


commit 81fd7803d323a1a377b5c91bb55659e37820f3a3
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Aug 31 09:15:50 2017 +0200

    - mostly updated; one patch left + testing; new config variable path_cactilog

 cacti-adodb.patch                 |  11 ---
 cacti-config.patch                | 142 +++++++++-----------------------------
 cacti-ioerror.patch               |  17 ++---
 cacti-linux_memory.patch          |  12 ++--
 cacti-log-verbosity.patch         |  12 ++--
 cacti-ss_disk-array-indices.patch |  17 +++--
 cacti-webroot.patch               |  10 +--
 cacti.spec                        |  21 +++---
 mysql-socket.patch                |  38 ----------
 9 files changed, 80 insertions(+), 200 deletions(-)
---
diff --git a/cacti.spec b/cacti.spec
index 47a4016..6228773 100644
--- a/cacti.spec
+++ b/cacti.spec
@@ -4,20 +4,20 @@
 Summary:	Cacti is a PHP frontend for rrdtool
 Summary(pl.UTF-8):	Cacti - frontend w PHP do rrdtoola
 Name:		cacti
-Version:	0.8.8h
-Release:	1
+Version:	1.1.20
+Release:	0.1
 License:	GPL v2
 Group:		Applications/WWW
 Source0:	http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
-# Source0-md5:	e5a2eb9e1b187a92284f46e7d4cd6505
+# Source0-md5:	7d06d9a31f02f69b994f50aff2a40aa4
 Source2:	%{name}.crontab
 Source3:	%{name}-apache.conf
 Source4:	%{name}-lighttpd.conf
 Source5:	%{name}-rrdpath.sql
 Source7:	%{name}.logrotate
-Patch0:		mysql-socket.patch
+
 Patch1:		%{name}-config.patch
-Patch2:		%{name}-adodb.patch
+
 Patch3:		%{name}-ioerror.patch
 Patch4:		%{name}-webroot.patch
 Patch5:		%{name}-linux_memory.patch
@@ -31,7 +31,6 @@ BuildRequires:	sed >= 4.0
 Requires(postun):	/usr/sbin/userdel
 Requires(pre):	/bin/id
 Requires(pre):	/usr/sbin/useradd
-Requires:	adodb >= 4.67-1.17
 Requires:	cacti-plugin-boost >= 5.0
 Requires:	crondaemon
 Requires:	group(http)
@@ -133,22 +132,21 @@ Dokumentacja do Cacti w formacie HTML.
 %patch100 -p1
 %endif
 
-%patch0 -p1
 %patch1 -p1
-%patch2 -p1
+
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
-%patch8 -p1
+# ?
+# %patch8 -p1
 
 mkdir -p sql
 mv *.sql sql
 # you should run this sql if your database contains path to %{_datadir}...
 cp -p %{SOURCE5} sql
 
-%{__rm} -r lib/adodb
 %{__rm} log/.htaccess
 %{__rm} cli/.htaccess
 %{__rm} rra/.htaccess
@@ -182,6 +180,7 @@ cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html
 mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller}
 
 cp -a log $RPM_BUILD_ROOT/var/log/%{name}
+:> $RPM_BUILD_ROOT/var/log/%{name}/%{name}.log
 install -d $RPM_BUILD_ROOT/var/log/archive/%{name}
 cp -a rra $RPM_BUILD_ROOT/var/lib/%{name}
 
@@ -242,7 +241,7 @@ fi
 
 %files
 %defattr(644,root,root,755)
-%doc docs/CHANGELOG docs/CONTRIB docs/README docs/txt/manual.txt
+%doc README.md docs/CHANGELOG docs/txt/manual.txt
 %dir %attr(750,root,http) %{_sysconfdir}
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
diff --git a/cacti-adodb.patch b/cacti-adodb.patch
deleted file mode 100644
index 4103145..0000000
--- a/cacti-adodb.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- cacti-0.8.7h/include/global.php	2011-10-12 20:39:56.873975023 +0200
-+++ cacti-0.8.7h/include/global.php	2011-11-01 23:52:55.343710747 +0200
-@@ -200,7 +200,7 @@
- }
- 
- /* include base modules */
--include_once($config["library_path"] . "/adodb/adodb.inc.php");
-+require_once '/usr/share/php/adodb/adodb.inc.php';
- include_once($config["library_path"] . "/database.php");
- 
- /* connect to the database server */
diff --git a/cacti-config.patch b/cacti-config.patch
index 739c7f7..15d2562 100644
--- a/cacti-config.patch
+++ b/cacti-config.patch
@@ -1,124 +1,46 @@
 --- cacti-0.8.7b/include/global.php	2008-10-05 04:38:29.740276226 +0300
 +++ cacti-0.8.7g/include/global.php	2010-12-13 12:10:44.312310245 +0200
-@@ -42,7 +42,7 @@
- $cacti_session_name = "Cacti";
+@@ -65,7 +65,7 @@ $url_path = '/cacti/';
+ ini_set('max_input_vars', '5000');
  
  /* Include configuration */
--include(dirname(__FILE__) . "/config.php");
+-include(dirname(__FILE__) . '/config.php');
 +require '/etc/webapps/cacti/config.php';
  
- if (isset($config["cacti_version"])) {
- 	die("Invalid include/config.php file detected.");
-@@ -101,7 +101,8 @@
- $config["base_path"] = strtr(ereg_replace("(.*)[\/\\]include", "\\1", dirname(__FILE__)), "\\", "/");
- $config["library_path"] = ereg_replace("(.*[\/\\])include", "\\1lib", dirname(__FILE__));
- $config["include_path"] = dirname(__FILE__);
--$config["rra_path"] = $config["base_path"] . '/rra';
+ if (isset($config['cacti_version'])) {
+ 	die('Invalid include/config.php file detected.');
+@@ -139,7 +139,8 @@ if ($config['cacti_server_os'] == 'win32
+ 	$config['library_path'] = preg_replace("/(.*[\/])include/", "\\1lib", dirname(__FILE__));
+ }
+ $config['include_path'] = dirname(__FILE__);
+-$config['rra_path'] = $config['base_path'] . '/rra';
 +$config["rra_path"] = '/var/lib/cacti/rra';
-+$config["log_path"] = '/var/log/cacti';
++$config["path_cactilog"] = '/var/log/cacti/cacti.log';
  
- /* colors */
- $colors["dark_outline"] = "454E53";
+ /* for multiple pollers, we need to know this location */
+ if (!isset($scripts_path)) {
 --- cacti-0.8.7g/include/config.php~	2010-12-13 12:15:08.000000000 +0200
 +++ cacti-0.8.7g/include/config.php	2010-12-13 12:16:09.275611204 +0200
-@@ -26,8 +26,8 @@
- $database_type = "mysql";
- $database_default = "cacti";
- $database_hostname = "localhost";
--$database_username = "cactiuser";
--$database_password = "cactiuser";
-+$database_username = "mysql";
-+$database_password = "";
- $database_port = "3306";
- 
- /* load up old style plugins here */
-@@ -34,4 +34,6 @@
- /* Default session name - Session name must contain alpha characters */
- #$cacti_session_name = "Cacti";
- 
-+$url_path = '/cacti/';
-+
- ?>
---- cacti-0.8.7b/include/global_settings.php~	2008-10-05 04:29:33.121404239 +0300
-+++ cacti-0.8.7b/include/global_settings.php	2008-10-05 04:41:11.807395633 +0300
-@@ -96,7 +96,7 @@
- 			"friendly_name" => "Cacti Log File Path",
- 			"description" => "The path to your Cacti log file (if blank, defaults to <path_cacti>/log/cacti.log)",
- 			"method" => "filepath",
--			"default" => $config["base_path"] . "/log/cacti.log",
-+			"default" => $config["log_path"] . "/cacti.log",
- 			"max_length" => "255"
- 			),
- 		"pollerpaths_header" => array(
---- cacti-0.8.7b/install/index.php~	2008-10-05 04:29:33.113733438 +0300
-+++ cacti-0.8.7b/install/index.php	2008-10-05 04:41:37.276839747 +0300
-@@ -244,7 +244,7 @@
- if (config_value_exists("path_cactilog")) {
- 	$input["path_cactilog"]["default"] = read_config_option("path_cactilog");
- } else {
--	$input["path_cactilog"]["default"] = $config["base_path"] . "/log/cacti.log";
-+	$input["path_cactilog"]["default"] = $config["log_path"] . "/cacti.log";
- }
- 
- /* SNMP Version */
---- cacti-0.8.7b/lib/functions.php~	2008-10-05 04:29:33.124737562 +0300
-+++ cacti-0.8.7b/lib/functions.php	2008-10-05 04:42:05.046758504 +0300
-@@ -367,7 +367,7 @@
- 	/* Log to Logfile */
- 	if ((($logdestination == 1) || ($logdestination == 2)) && (read_config_option("log_verbosity") != POLLER_VERBOSITY_NONE)) {
- 		if ($logfile == "") {
--			$logfile = $config["base_path"] . "/log/cacti.log";
-+			$logfile = $config["log_path"] . "/cacti.log";
- 		}
- 
- 		/* echo the data to the log (append) */
---- cacti-0.8.8/utilities.php~	2012-10-29 22:14:05.000000000 +0200
-+++ cacti-0.8.8/utilities.php	2012-10-29 22:15:05.781005237 +0200
-@@ -773,12 +773,12 @@ function utilities_clear_user_log() {
+@@ -27,8 +27,8 @@
+ $database_type     = 'mysql';
+ $database_default  = 'cacti';
+ $database_hostname = 'localhost';
+-$database_username = 'cactiuser';
+-$database_password = 'cactiuser';
++$database_username = 'mysql';
++$database_password = '';
+ $database_port     = '3306';
+ $database_ssl      = false;
+ 
+--- cacti/poller.php~	2017-08-28 05:48:36.000000000 +0200
++++ cacti/poller.php	2017-08-31 08:39:19.780902180 +0200
+@@ -61,7 +61,7 @@ if (!isset($_SERVER['argv'][0]) || isset
  }
  
- function utilities_view_logfile() {
--	global $log_tail_lines, $page_refresh_interval, $refresh;
-+	global $log_tail_lines, $page_refresh_interval, $refresh, $config;
- 
- 	$logfile = read_config_option("path_cactilog");
- 
- 	if ($logfile == "") {
--		$logfile = "./log/rrd.log";
-+		$logfile = $config['log_path']. "/rrd.log";
- 	}
- 
- 	/* helps determine output color */
-@@ -1014,6 +1014,7 @@ function utilities_view_logfile() {
- }
- 
- function utilities_clear_logfile() {
-+	global $config;
- 	load_current_session_value("refresh", "sess_logfile_refresh", read_config_option("log_refresh_interval"));
- 
- 	$refresh["seconds"] = get_request_var_request("refresh");
-@@ -870,7 +870,7 @@
- 	$logfile = read_config_option("path_cactilog");
- 
- 	if ($logfile == "") {
--		$logfile = "./log/cacti.log";
-+		$logfile = $config['log_path']."/cacti.log";
- 	}
- 
- 	html_start_box("<strong>Clear Cacti Log File</strong>", "100%", $colors["header"], "1", "center", "");
---- cacti/poller.php~	2008-10-05 05:08:10.000000000 +0300
-+++ cacti/poller.php	2008-10-05 05:11:11.327705168 +0300
-@@ -1,3 +1,4 @@
-+#!/usr/bin/php
- <?php
- /*
-  +-------------------------------------------------------------------------+
-@@ -32,7 +32,7 @@
- $no_http_headers = true;
- 
  /* start initialization section */
--include(dirname(__FILE__) . "/include/global.php");
+-include(dirname(__FILE__) . '/include/global.php');
 +require "/usr/share/cacti/include/global.php";
- include_once($config["base_path"] . "/lib/poller.php");
- include_once($config["base_path"] . "/lib/data_query.php");
- include_once($config["base_path"] . "/lib/graph_export.php");
+ include_once($config['base_path'] . '/lib/poller.php');
+ include_once($config['base_path'] . '/lib/data_query.php');
+ include_once($config['base_path'] . '/lib/rrd.php');
+
diff --git a/cacti-ioerror.patch b/cacti-ioerror.patch
index eb6c9fe..e281979 100644
--- a/cacti-ioerror.patch
+++ b/cacti-ioerror.patch
@@ -1,12 +1,13 @@
 --- cacti/lib/functions.php~	2008-10-05 06:16:11.000000000 +0300
 +++ cacti/lib/functions.php	2008-10-05 06:16:13.069722888 +0300
-@@ -437,6 +437,9 @@
+@@ -690,6 +690,9 @@ function tail_file($file_name, $number_o
+ 	$filter = strtolower($filter);
  
- 	if (file_exists($file_name)) {
- 		$fp = fopen($file_name, "r");
-+		if (!$fp) {
-+			return $file_array;
-+		}
+ 	$fp = fopen($file_name, 'r');
++	if (!$fp) {
++		return array();
++	}
  
- 		/* reset back the number of bytes */
- 		if ($number_of_lines > 0) {
+ 	/* Count all lines in the logfile */
+ 	$total_rows = 0;
+
diff --git a/cacti-linux_memory.patch b/cacti-linux_memory.patch
index 721d8c1..613b5b2 100644
--- a/cacti-linux_memory.patch
+++ b/cacti-linux_memory.patch
@@ -1,10 +1,12 @@
 --- cacti-0.8.7b/scripts/linux_memory.pl~	2008-02-12 02:57:48.000000000 +0200
 +++ cacti-0.8.7b/scripts/linux_memory.pl	2008-10-05 17:06:04.399773770 +0300
-@@ -1,6 +1,6 @@
- #!/usr/bin/perl
+@@ -6,7 +6,7 @@ $path = $ENV{'PATH'};
+ $val1 = $ARGV[0];
+ ($val1) = $val1 =~ /^([\w.:]+)$/;
  
--open(PROCESS, "cat /proc/meminfo | grep -w $ARGV[0] |");
+-open(PROCESS, "cat /proc/meminfo | grep -w $val1 |");
 +open(PROCESS, "grep $ARGV[0] < /proc/meminfo |");
  foreach (<PROCESS>) {
- 	if ($_ =~ /($ARGV[0].*\s)(.*[0-9])( kB)/) {
- 		print $2;
+   if ($_ =~ /($ARGV[0].*\s)(.*[0-9])( kB)/) {
+    print $2;
+
diff --git a/cacti-log-verbosity.patch b/cacti-log-verbosity.patch
index 3a25765..b3478ff 100644
--- a/cacti-log-verbosity.patch
+++ b/cacti-log-verbosity.patch
@@ -1,13 +1,13 @@
 --- cacti-0.8.7b/poller.php~	2008-10-05 16:58:33.000000000 +0300
 +++ cacti-0.8.7b/poller.php	2008-10-05 17:45:53.825952709 +0300
-@@ -446,7 +446,8 @@
- 		$num_polling_items,
- 		$rrds_processed);
+@@ -665,7 +665,8 @@ function log_cacti_stats($loop_start, $m
+ 	);
  
--	cacti_log("STATS: " . $cacti_stats , true, "SYSTEM");
+ 	$cacti_stats = vsprintf('Time:%01.4f Method:%s Processes:%s Threads:%s Hosts:%s HostsPerProcess:%s DataSources:%s RRDsProcessed:%s', $perf_data);
+-	cacti_log('STATS: ' . $cacti_stats , true, 'SYSTEM');
 +	if (read_config_option('log_verbosity') > POLLER_VERBOSITY_NONE)
-+		cacti_log("STATS: " . $cacti_stats ,true,"SYSTEM");
++		cacti_log('STATS: ' . $cacti_stats , true, 'SYSTEM');
  
  	/* insert poller stats into the settings table */
- 	db_execute("REPLACE INTO settings (name,value) VALUES ('stats_poller','$cacti_stats')");
+ 	db_execute_prepared('REPLACE INTO settings (name, value) VALUES ("stats_poller",?)', array($cacti_stats));
 
diff --git a/cacti-ss_disk-array-indices.patch b/cacti-ss_disk-array-indices.patch
index 17484c2..8806e3e 100644
--- a/cacti-ss_disk-array-indices.patch
+++ b/cacti-ss_disk-array-indices.patch
@@ -1,15 +1,20 @@
 --- ./scripts/ss_host_disk.php	2008-10-05 18:19:17.656634044 +0300
 +++ ./scripts/ss_host_disk.php	2008-10-07 11:07:10.120905407 +0300
-@@ -69,7 +69,11 @@
- 		$arg = $arg1;
- 
- 		$arr_index = ss_host_disk_reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER));
+@@ -86,12 +86,16 @@ function ss_host_disk($hostname, $host_i
+ 				$snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol,
+ 				$snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER)
+ 			);
 +		if (empty($arr_index))
 +			return;
- 		$arr = ss_host_disk_reindex(cacti_snmp_walk($hostname, $snmp_community, $oids[$arg], $snmp_version, $snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER));
+ 
+ 		$arr = ss_host_disk_reindex(
+ 			cacti_snmp_walk($hostname, $snmp_community, $oids[$arg], $snmp_version, $snmp_auth_username,
+ 				$snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol,
+ 				$snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER)
+ 			);
 +		if (empty($arr))
 +			return; // we likely already got error already earlier, like "Timeout: No Response from localhost:161"
  
  		for ($i=0;($i<sizeof($arr_index));$i++) {
- 			print $arr_index[$i] . "!" . $arr[$i] . "\n";
+ 			print $arr_index[$i] . '!' . $arr[$i] . "\n";
 
diff --git a/cacti-webroot.patch b/cacti-webroot.patch
index 2187a13..4221877 100644
--- a/cacti-webroot.patch
+++ b/cacti-webroot.patch
@@ -1,13 +1,13 @@
 --- /poller.php~	2008-10-05 16:54:15.000000000 +0300
 +++ /poller.php	2008-10-05 16:57:05.946911539 +0300
-@@ -181,7 +181,9 @@
- 	$last_host           = 0;
+@@ -320,7 +320,8 @@ while ($poller_runs_completed < $poller_
+ 	$last_host         = 0;
  
  	/* update web paths for the poller */
--	db_execute("REPLACE INTO settings (name,value) VALUES ('path_webroot','" . addslashes(($config["cacti_server_os"] == "win32") ? strtr(strtolower(substr(dirname(__FILE__), 0, 1)) . substr(dirname(__FILE__), 1),"\\", "/") : dirname(__FILE__)) . "')");
-+//	$path_webroot = ($config["cacti_server_os"] == "win32") ? strtr(strtolower(substr(dirname(__FILE__), 0, 1)) . substr(dirname(__FILE__), 1),"\\", "/") : dirname(__FILE__);
+-	db_execute("REPLACE INTO settings (name, value) VALUES ('path_webroot','" . addslashes(($config['cacti_server_os'] == 'win32') ? strtr(strtolower(substr(dirname(__FILE__), 0, 1)) . substr(dirname(__FILE__), 1),"\\", '/') : dirname(__FILE__)) . "')");
 +	$path_webroot = $config['base_path'];
 +	db_execute("REPLACE INTO settings (name,value) VALUES ('path_webroot','" .  addslashes($path_webroot) . "')");
  
  	/* obtain some defaults from the database */
- 	$poller      = read_config_option("poller_type");
+ 	$poller_type = read_config_option('poller_type');
+
diff --git a/mysql-socket.patch b/mysql-socket.patch
deleted file mode 100644
index 1e373d4..0000000
--- a/mysql-socket.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-allow using socket to connect to mysql
-
-split the socket from port if hostname contains colon
-this also allows $port to be just path to socket (not-numeric)
-
-localhost:/tmp/sock inspired by:
-http://bugs.cacti.net/view.php?id=425
-
-note: this socket works for mysqli driver only:
-http://phplens.com/lens/adodb/docs-adodb.htm
-
-
---- cacti-0.8.7i-PIA-3.1/lib/database.php~	2011-12-12 03:56:06.000000000 +0200
-+++ cacti-0.8.7i-PIA-3.1/lib/database.php	2012-01-24 11:18:39.563094454 +0200
-@@ -34,6 +34,11 @@
- function db_connect_real($host, $user, $pass, $db_name, $db_type, $port = "3306", $db_ssl = false, $retries = 20) {
- 	global $cnn_id;
- 
-+	// convert hostname:port to hostname and port
-+	if (strchr($host, ':')) {
-+		list($host, $port) = explode(':', $host, 2);
-+	}
-+
- 	$i = 0;
- 	$dsn = "$db_type://" . rawurlencode($user) . ":" . rawurlencode($pass) . "@" . rawurlencode($host) . "/" . rawurlencode($db_name) . "?persist";
- 
-@@ -43,7 +48,10 @@
- 		$dsn .= "&clientflags=" . MYSQLI_CLIENT_SSL;
- 	}
- 
--	if ($port != "3306") {
-+	// socket supported for mysqli only, not mysql
-+	if ($port && !is_numeric($port)) {
-+		$dsn .= "&socket=" . $port;
-+	} elseif ($port != "3306") {
- 		$dsn .= "&port=" . $port;
- 	}
- 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/cacti.git/commitdiff/81fd7803d323a1a377b5c91bb55659e37820f3a3



More information about the pld-cvs-commit mailing list