diff --git a/.gitignore b/.gitignore index 0d21049..7a20db1 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ /cacti-1.1.36.tar.gz /cacti-1.1.37.tar.gz /cacti-1.1.38.tar.gz +/cacti-1.2.0.tar.gz diff --git a/cacti-cmd.patch b/cacti-cmd.patch deleted file mode 100644 index 793d146..0000000 --- a/cacti-cmd.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- cacti-1.1.38/cmd.php.orig 2018-04-15 23:13:47.000000000 +0200 -+++ cacti-1.1.38/cmd.php 2018-07-25 15:08:18.846078292 +0200 -@@ -104,6 +104,25 @@ function open_snmp_session($host_id, &$i - } - } - -+function get_max_column_width() { -+ $pcol_data = db_fetch_row("SHOW COLUMNS FROM poller_output WHERE Field='output'"); -+ $bcol_data = db_fetch_row("SHOW COLUMNS FROM poller_output_boost WHERE Field='output'"); -+ -+ if (isset($pcol_data['Type'])) { -+ $pcol = $pcol_data['Type']; -+ $data = explode('(', $pcol); -+ $pmax = trim($data[1], ')'); -+ } -+ -+ if (sizeof($bcol_data)) { -+ $bcol = $bcol_data['Type']; -+ $data = explode('(', $bcol); -+ $bmax = trim($data[1], ')'); -+ } -+ -+ return min($pmax, $bmax); -+} -+ - function display_version() { - $version = get_cacti_version(); - echo "Cacti Legacy Host Data Collector, Version $version, " . COPYRIGHT_YEARS . "\n"; -@@ -159,6 +178,7 @@ $debug = false; - $mibs = false; - $mode = 'online'; - $poller_id = $config['poller_id']; -+$maxwidth = get_max_column_width(); - - if (sizeof($parms)) { - foreach($parms as $parameter) { -@@ -410,6 +430,7 @@ if ((sizeof($polling_items) > 0) && (rea - $output_array = array(); - $output_count = 0; - $error_ds = array(); -+ $width_dses = array(); - - /* create new ping socket for host pinging */ - $ping = new Net_Ping; -@@ -502,10 +523,8 @@ if ((sizeof($polling_items) > 0) && (rea - case POLLER_ACTION_SNMP: /* snmp */ - open_snmp_session($host_id, $item); - -- - if (isset($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']])) { -- $sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']]->quick_print = true; -- $output = cacti_snmp_session_get($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']], $index_item['arg1'], true); -+ $output = cacti_snmp_session_get($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']], $index_item['arg1']); - } else { - $output = 'U'; - } -@@ -729,6 +748,11 @@ if ((sizeof($polling_items) > 0) && (rea - } /* End Switch */ - - if (isset($output)) { -+ if (read_config_option('poller_debug') == 'on' && strlen($output) > $maxwidth) { -+ $width_dses[] = $data_source; -+ $width_errors++; -+ } -+ - /* insert a U in place of the actual value if the snmp agent restarts */ - if (($set_spike_kill) && (!substr_count($output, ':'))) { - $output_array[] = sprintf('(%d, %s, %s, "U")', $item['local_data_id'], db_qstr($item['rrd_name']), db_qstr($host_update_time)); -@@ -742,7 +766,8 @@ if ((sizeof($polling_items) > 0) && (rea - (local_data_id, rrd_name, time, output) - VALUES ' . implode(', ', $output_array)); - -- if (read_config_option('boost_redirect') == 'on') { -+ if (read_config_option('boost_redirect') == 'on' -+ && read_config_option('boost_rrd_update_enable') == 'on') { - db_execute('INSERT IGNORE INTO poller_output_boost - (local_data_id, rrd_name, time, output) - VALUES ' . implode(', ', $output_array)); -@@ -768,6 +793,10 @@ if ((sizeof($polling_items) > 0) && (rea - cacti_log('WARNING: Invalid Response(s), Errors[' . sizeof($error_ds) . '] Device[' . $last_host . '] Thread[1] DS[' . implode(', ', $error_ds) . ']', false, 'POLLER'); - } - -+ if (sizeof($width_dses)) { -+ cacti_log('WARNING: Long Responses Errors[' . sizeof($width_dses) . '] DS[' . implode(', ', $width_dses) . ']', false, 'POLLER'); -+ } -+ - if ($output_count > 0) { - db_execute('INSERT IGNORE INTO poller_output - (local_data_id, rrd_name, time, output) diff --git a/cacti.README.fedora b/cacti.README.fedora index e68c047..040be08 100644 --- a/cacti.README.fedora +++ b/cacti.README.fedora @@ -4,6 +4,9 @@ In order for Cacti to function properly, please edit the following files: /etc/cron.d/cacti /etc/httpd/conf.d/cacti.conf +Important: +We recommend that you turnoff SELinux with setenforce 0 during the installation of cacti. + The installation procedure, briefly summarized: 1) Create the cacti MySQL database: @@ -39,4 +42,4 @@ Cacti's install procedure is not fully compatible with mod_security. If you use mod_security, please uncomment the SecRuleRemoveById lines in /etc/http/conf.d/cacti.conf. -Cacti should work with SELinux. If you cannot get it to work, please file a bug. \ No newline at end of file +Cacti should work with SELinux. If you cannot get it to work, please file a bug. diff --git a/cacti.spec b/cacti.spec index e5366b5..59b7ad3 100644 --- a/cacti.spec +++ b/cacti.spec @@ -1,6 +1,8 @@ +%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} + Name: cacti -Version: 1.1.38 -Release: 4%{?dist} +Version: 1.2.0 +Release: 1%{?dist} Summary: An rrd based graphing tool License: GPLv2+ URL: https://www.cacti.net/ @@ -9,7 +11,14 @@ Source1: cacti-httpd.conf Source2: cacti.logrotate Source3: cacti.README.fedora Source4: %{name}.cron -Patch0: cacti-cmd.patch +Source5: cacti.nginx + +BuildArch: noarch + +Requires: httpd-filesystem +Requires: nginx-filesystem +Requires: php(httpd) +Suggests: httpd # Requires PHP 5.4+ Requires: php(language) >= 5.4 @@ -49,18 +58,10 @@ Requires: rrdtool Requires: net-snmp, net-snmp-utils Requires: crontabs -Requires(pre): shadow-utils -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -Buildrequires: systemd -Provides: bundled(js-jquery) = 3.1.0 -BuildArch: noarch - -# This macro was added in Fedora 20. Use the old version if it's undefined -# on older Fedoras and RHELs. -# https://fedoraproject.org/wiki/Changes/UnversionedDocdirs -%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} +# Bundled JS library +Provides: bundled(js-jquery) = 3.3.1 +Provides: bundled(js-storage) = 1.0.4 +Provides: bundled(js-tree) = 3.3.7 %description Cacti is a complete frontend to RRDTool. It stores all of the @@ -72,7 +73,6 @@ driven. %autosetup %build -# cacti's build is a noop %install %{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name} @@ -82,6 +82,7 @@ driven. %{__install} -d -m 0755 cli/ %{buildroot}/%{_localstatedir}/lib/%{name}/cli %{__install} -d -m 0775 log/ %{buildroot}/%{_localstatedir}/log/%{name}/ touch %{buildroot}/%{_localstatedir}/log/%{name}/%{name}.log +touch %{buildroot}/%{_localstatedir}/log/%{name}/%{name}_stderr.log %{__install} -d -m 0755 rra/ %{buildroot}/%{_localstatedir}/lib/%{name}/rra/ %{__install} -d -m 0755 scripts/ %{buildroot}/%{_localstatedir}/lib/%{name}/scripts/ %{__mv} *.php %{buildroot}/%{_datadir}/%{name}/ @@ -90,7 +91,8 @@ touch %{buildroot}/%{_localstatedir}/log/%{name}/%{name}.log %{__mv} rra/ %{buildroot}/%{_localstatedir}/lib/%{name}/ %{__mv} scripts/ %{buildroot}/%{_localstatedir}/lib/%{name}/ %{__install} -p -D -m 0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/cron.d/%{name} -%{__install} -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/cacti.conf +%{__install} -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/%{name}.conf +%{__install} -D -m 0644 %{SOURCE5} %{buildroot}/%{_sysconfdir}/nginx/default.d/%{name}.conf %{__install} -D -m 0644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/logrotate.d/cacti # The su parameter will trip up older logrotate versions. @@ -123,13 +125,6 @@ chown root:apache %{_sysconfdir}/%{name}/db.php sed -i -e 's/\tcacti\t/\tapache\t/' %{_sysconfdir}/cron.d/%{name} -if [ $1 -eq 1 ] ; then - %systemd_postun_with_restart httpd.service -fi - -%postun -%systemd_postun_with_restart httpd.service - %files %doc docs/ README.md cacti.sql %license LICENSE @@ -140,8 +135,10 @@ fi %dir %attr(-,apache,apache) %{_localstatedir}/lib/%{name}/scripts %dir %attr(-,apache,apache) %{_localstatedir}/log/%{name}/ %config(noreplace) %attr(-,apache,apache) %{_localstatedir}/log/%{name}/%{name}.log +%config(noreplace) %attr(-,apache,apache) %{_localstatedir}/log/%{name}/%{name}_stderr.log %config(noreplace) %{_sysconfdir}/cron.d/cacti -%config(noreplace) %{_sysconfdir}/httpd/conf.d/cacti.conf +%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf +%config(noreplace) %{_sysconfdir}/nginx/default.d/%{name}.conf %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %attr(0640,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/db.php %{_datadir}/%{name}/*.php @@ -169,6 +166,10 @@ fi %attr(-,root,root) %{_localstatedir}/lib/%{name}/lib %changelog +* Thu Jan 03 2019 Morten Stevens - 1.2.0-1 +- Update to 1.2.0 +- Provide nginx support + * Mon Dec 03 2018 Morten Stevens - 1.1.38-4 - Spec file improvements - Updated logrotation settings diff --git a/sources b/sources index d858c95..b8c65c3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cacti-1.1.38.tar.gz) = 1f91156416a9988fa149f9b8fc9fc7df904e4cf6d9a19a62d06c7de1ded99ddaec2f5b5f1a21b0effc4dee7b9c1d1911ca5aaa6113b57edc7e2f42b7969343b5 +SHA512 (cacti-1.2.0.tar.gz) = 8010f7c486d17f49983880551fa15acbda32078f4ac1d3be032a8e5c587bef70ceae8a34bb49fd2d1db13a1ad48674695ab53fa6fe858fa7e96dd64a03a8db17