Fix for upstream issue 1634 (cmd.php)
This commit is contained in:
parent
3414bddb02
commit
7890d92470
89
cacti-cmd.patch
Normal file
89
cacti-cmd.patch
Normal file
@ -0,0 +1,89 @@
|
||||
--- 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)
|
@ -1,6 +1,6 @@
|
||||
Name: cacti
|
||||
Version: 1.1.38
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: An rrd based graphing tool
|
||||
License: GPLv2+
|
||||
URL: http://www.cacti.net/
|
||||
@ -9,6 +9,7 @@ Source1: cacti-httpd.conf
|
||||
Source2: cacti.logrotate
|
||||
Source3: cacti.README.fedora
|
||||
Source4: %{name}.cron
|
||||
Patch0: cacti-cmd.patch
|
||||
|
||||
# Requires PHP 5.4+
|
||||
Requires: php(language) >= 5.4
|
||||
@ -68,7 +69,7 @@ data in a MySQL database. The frontend is completely PHP
|
||||
driven.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
# cacti's build is a noop
|
||||
@ -162,6 +163,9 @@ fi
|
||||
%attr(-,root,root) %{_localstatedir}/lib/%{name}/lib
|
||||
|
||||
%changelog
|
||||
* Wed Jul 25 2018 Morten Stevens <mstevens@fedoraproject.org> - 1.1.38-3
|
||||
- Fix for https://github.com/Cacti/cacti/issues/1634
|
||||
|
||||
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.38-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user