]> git.pld-linux.org Git - packages/cacti.git/commitdiff
- mostly updated; one patch left + testing; new config variable path_cactilog
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 31 Aug 2017 07:15:50 +0000 (09:15 +0200)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 31 Aug 2017 07:15:50 +0000 (09:15 +0200)
cacti-adodb.patch [deleted file]
cacti-config.patch
cacti-ioerror.patch
cacti-linux_memory.patch
cacti-log-verbosity.patch
cacti-ss_disk-array-indices.patch
cacti-webroot.patch
cacti.spec
mysql-socket.patch [deleted file]

diff --git a/cacti-adodb.patch b/cacti-adodb.patch
deleted file mode 100644 (file)
index 4103145..0000000
+++ /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 */
index 739c7f771df7b4459e0c3fa800bb70b8cae5a0ff..15d2562ef7d50ea3fd7c9fa7f3d4f089be9096bc 100644 (file)
 --- 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');
+
index eb6c9fe07a1fbc35c6713578b80d8b5ebc6cb1b0..e28197909edf69a20dceba755ec26ac7fbd9040b 100644 (file)
@@ -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;
+
index 721d8c142968fb7299761e03de3e942587910270..613b5b2d96019b8a611ab9ea3a61f3efd78c167b 100644 (file)
@@ -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;
+
index 3a25765f23643f71e69e2f969cef3b4f8960928b..b3478ff53e3993a8acf7f36ef63d93fc543ec576 100644 (file)
@@ -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));
 
index 17484c2892c0083629e8faf4a4308dde683c2a77..8806e3e7ec6a39801b1cbd23fea54a08ea08fe9c 100644 (file)
@@ -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";
 
index 2187a133c471d13221c555c3115c86ee05e4bb20..4221877e7f79424e44a4775016fce6a31ce47275 100644 (file)
@@ -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');
+
index 47a40161c9b7d082f748735d3f5efaaa3a3f6ff1..622877399cde8beeb86e071ee223e1de2ff155f0 100644 (file)
@@ -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/mysql-socket.patch b/mysql-socket.patch
deleted file mode 100644 (file)
index 1e373d4..0000000
+++ /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;
-       }
This page took 0.115225 seconds and 4 git commands to generate.