From 889ea4c5fdcc3e1e237e01c2e8f9b6bc89338076 Mon Sep 17 00:00:00 2001 From: cigamit Date: Sat, 18 Nov 2017 09:54:38 -0600 Subject: [PATCH 1/6] Resolving Issue #1088 Remote Data collector polling has no timeout setting --- docs/CHANGELOG | 1 + lib/functions.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG b/docs/CHANGELOG index ddda99d5db..686eb5721e 100644 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -20,6 +20,7 @@ Cacti CHANGELOG -issue#1079: Undefined index in lib/snmpagent.php -issue#1085: Undefined function html_log_input_error in debug -issue#1087: add_device.php --proxy option does not work with non-snmp devices +-issue#1088: Set timeout for remote data collector context options -issue: Minor performance increase in boost process -issue: Poller output not empty not processed correctly on Log tab -feature: Add a timeout to the remote agent for realtime graphs diff --git a/lib/functions.php b/lib/functions.php index d8f4151e1f..10f69e8a4a 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -4527,9 +4527,10 @@ function get_url_type() { * * @returns - an array of stream context options or false */ function get_default_contextoption($protocol = false, $options = false) { - $fgc_contextoption = false; + $timeout = read_config_option('script_timeout'); + if (!$protocol) { $protocol = get_url_type(); } @@ -4544,11 +4545,22 @@ function get_default_contextoption($protocol = false, $options = false) { ); } + if ($protocol == 'https') { + $fgc_contextoption['https'] = array( + 'timeout' => $timeout + ); + } elseif ($protocol == 'http') { + $fgc_contextoption['http'] = array( + 'timeout' => $timeout + ); + } + if (is_array($options)) { $fgc_contextoption = array_replace_recursive($fgc_contextoption, $options); } $fgc_contextoption = api_plugin_hook_function('fgc_contextoption', $fgc_contextoption); + return $fgc_contextoption; } From 7a47e7d4702fb8073fc2fbbc824ce1e5a2e0a97e Mon Sep 17 00:00:00 2001 From: cigamit Date: Sat, 18 Nov 2017 09:55:31 -0600 Subject: [PATCH 2/6] Correct minor WC3 Validation issue in graph preview filter --- lib/html_graph.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/html_graph.php b/lib/html_graph.php index 2fd6c2f1e6..ed552437e4 100644 --- a/lib/html_graph.php +++ b/lib/html_graph.php @@ -309,6 +309,8 @@ function html_graph_preview_filter($page, $action, $devices_where = '', $templat + +