diff --git a/README.md b/README.md index 2d3384cfb2..f32881f8c1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ Pandora FMS is a monitoring software for IT infrastructure management which includes network equipment, Windows and Unix servers, virtual infrastructure and all different kind of applications. It has a large amount of features, making it a new generation software which discovers all the monitoring issues that an organization may need. 
+For community support you can visit our forums at http://forums.pandorafms.org. Visit our community page at http://pandorafms.org and if you need commercial information or/and professional support visit http://pandorafms.com. +

###How to install Pandora FMS diff --git a/extras/Dockerfile b/extras/Dockerfile index 70c172095c..fcd39254fb 100644 --- a/extras/Dockerfile +++ b/extras/Dockerfile @@ -10,7 +10,7 @@ RUN mkdir /docker-entrypoint-initdb.d # File::Copy # Sys::Hostname # Data::Dumper -RUN apt-get update && apt-get install -y perl pwgen git --no-install-recommends && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y perl pwgen git openssh-client --no-install-recommends && rm -rf /var/lib/apt/lists/* # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e3e9e6ddfe..bfbbebba7e 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.1dev-160330 +Version: 6.1dev-160404 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 3ecc00536a..b61927cd9d 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.1dev-160330" +pandora_version="6.1dev-160404" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f6ffbe0dd8..49cdb9f1a6 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.1dev'; -use constant AGENT_BUILD => '160330'; +use constant AGENT_BUILD => '160404'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 4cb802a22e..c5f50a0c9b 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.1dev -%define release 160330 +%define release 160404 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index a949f3fcd5..8bfb6eccf0 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 6.1dev -%define release 160330 +%define release 160404 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index ca6858e55f..2ebb485a6a 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="6.1dev" -PI_BUILD="160330" +PI_BUILD="160404" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 2fee1ea6c9..c260215145 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{160330} +{160404} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 0e47e0252c..44535f03c9 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("6.1dev(Build 160330)") +#define PANDORA_VERSION ("6.1dev(Build 160404)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 60a638bf9d..f23fb32f5b 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(6.1dev(Build 160330))" + VALUE "ProductVersion", "(6.1dev(Build 160404))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 79cfe81c6d..0c3de5a19b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.1dev-160330 +Version: 6.1dev-160404 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 3c51153d93..1cc28be48c 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="6.1dev-160330" +pandora_version="6.1dev-160404" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql index 831efe6859..3fd09188fa 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql @@ -9,3 +9,9 @@ ALTER TABLE talert_templates ADD COLUMN `min_alerts_reset_counter` tinyint(1) DE -- ---------------------------------------------------------------------- ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0; + +-- ---------------------------------------------------------------------- +-- Table `tagente_estado` +-- ---------------------------------------------------------------------- + +ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7b301decf0..8d9456e8b7 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC160330'; +$build_version = 'PC160404'; $pandora_version = 'v6.1dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index f6402da5e5..bf08732ef2 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -893,7 +893,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $config['font_size'], $unit, $ttl, $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu, - $backgroundColor, $dashboard, $vconsole); + $backgroundColor, $dashboard, $vconsole, $agent_module_id); } } elseif ($config['type_module_charts'] === 'line') { diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index a729a043c7..71c277350c 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2240,4 +2240,82 @@ function modules_get_first_contact_date($id_agent_module) { return $first_date; } + +/** + * Get the unknown time status of a module in a period. + * If there is more than 1 days between data, there is some unknown time modules + * + * @param int id_agent_module. + * @param int ending interval timestamp + * @param int interval duration + * + * @return int unknown seconds. + */ +function modules_get_unknown_time ($id_agent_module, $date, $period){ + + // TODO REMOVE THE TIME IN PLANNED DOWNTIME + + if (empty($id_agent_module) || empty($date)) + return false; + + // Set initial conditions + $unknown_seconds = 0; + $datelimit = $date - $period; + $search_in_history_db = db_search_in_history_db($datelimit); + + // Get interval data + $sql = sprintf ('SELECT utimestamp + FROM tagente_datos + WHERE id_agente_modulo = %d + AND utimestamp > %d AND utimestamp <= %d', + $id_agent_module, $datelimit, $date); + $sql .= ' ORDER BY utimestamp ASC'; + $interval_data = db_get_all_rows_sql ($sql, $search_in_history_db); + + $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); + + // All alternatives on first data + if ($previous_data === false && $interval_data === false) { + return false; + } else if($previous_data !== false && $interval_data === false) { + if (($date - $previous_data['utimestamp']) <= SECONDS_1DAY) { + return 0; + } + if (($previous_data['utimestamp'] + SECONDS_1DAY) >= $datelimit) { + return $date - ($previous_data['utimestamp'] + SECONDS_1DAY); + } else { + return $period; + } + } else if ($previous_data === false && $interval_data !== false) { + $first_data = array_shift ($interval_data); + $unknown_seconds += $first_data['utimestamp'] - $datelimit; + array_unshift ($interval_data, $first_data); + } else { + $first_data = array_shift ($interval_data); + if (($previous_data['utimestamp'] + SECONDS_1DAY) >= $first_data['utimestamp']) { + if (($previous_data['utimestamp'] + SECONDS_1DAY) >= $datelimit) { + $unknown_seconds += $previous_data['utimestamp'] + SECONDS_1DAY - $first_data['utimestamp']; + } else { + $unknown_seconds += $first_data['utimestamp'] - $datetime; + } + } + array_unshift ($interval_data, $first_data); + } + + // Put utimestamp like last data + $last_data['utimestamp'] = $date; + array_push ($interval_data, $last_data); + $previous_data = array_shift ($previous_data); + + // Check if all datas have data maximum one day before + foreach ($interval_data as $data) { + $previous_1day = $previous_data['utimestamp'] + SECONDS_1DAY; + if ($previous_1day >= $data['utimestamp']) { + $unknown_period += $previous_1day - $data['utimestamp']; + } + $previous_data = $data; + } + + return $unknown_seconds; +} ?> diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index a89347801d..b6b0136a07 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -3859,11 +3859,11 @@ function reporting_availability($report, $content) { $content['time_from'], $content['time_to']); - $count_checks = modules_get_count_datas( - $item['id_agent_module'], - $report["datetime"] - $content['period'], - $report["datetime"]); - + $item['interval_agent_module'] = modules_get_interval ($item['id_agent_module']); + $unknown_seconds = modules_get_unknown_time ($item['id_agent_module'], $report["datetime"], $content['period']); + if ($unknown_seconds !== false) { + $count_checks = (int)(($content['period'] - $unknown_seconds)/$item['interval_agent_module']); + } if ($sla_value === false) { $row['checks'] = __('Unknown'); @@ -3887,11 +3887,13 @@ function reporting_availability($report, $content) { $row['failed'] = format_numeric($percent_fail * $count_checks / 100, 0); - + $row['poling_time'] = "-"; + if ($percent_ok > 0) { $row['poling_time'] = human_time_description_raw( ($percent_ok * $count_checks / 100) * modules_get_interval($item['id_agent_module']), true); + } $row['time_unavaliable'] = "-"; if ($percent_fail > 0) { diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 12b249d036..c026abb795 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -218,7 +218,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key = '', $force_integer = false, $series_suffix_str = '', $menu = true, $backgroundColor = 'white', - $dashboard = false, $vconsole = false) { + $dashboard = false, $vconsole = false, $agent_module_id = 0) { setup_watermark($water_mark, $water_mark_file, $water_mark_url); @@ -257,7 +257,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $series_suffix_str, $menu, $backgroundColor, - $dashboard); + $dashboard, + false, + $agent_module_id); } else { if ($vconsole) { @@ -281,7 +283,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $menu, $backgroundColor, $dashboard, - $vconsole); + $vconsole, + $agent_module_id); } else { $graph = array(); @@ -316,7 +319,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white', - $dashboard = false, $vconsole = false) { + $dashboard = false, $vconsole = false, $agent_module_id) { setup_watermark($water_mark, $water_mark_file, $water_mark_url); @@ -368,7 +371,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, true, $backgroundColor, $dashboard, - $vconsole); + $vconsole, + $agent_module_id); } else { //Stack the data diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 45283b24a2..02b41961f3 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -804,7 +804,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, colors, type, serie_types, water_mark, width, max_x, homeurl, unit, font_size, menu, events, event_ids, legend_events, alerts, alert_ids, legend_alerts, yellow_threshold, red_threshold, - force_integer, separator, separator2, series_suffix_str, vconsole) { + force_integer, separator, separator2, + yellow_up, red_up, yellow_inverse, red_inverse, + series_suffix_str, vconsole) { var threshold = true; var thresholded = false; @@ -861,14 +863,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, for (i = 0; i < values.length; i++) { var serie = values[i].split(separator); var aux = new Array(); - var critical_min = new Array(); - var warning_min = new Array(); $.each(serie, function(i, v) { aux.push([i, v]); - if (threshold) { - critical_min.push([i,red_threshold]); - warning_min.push([i,yellow_threshold]); - } }); switch (serie_types[i]) { @@ -961,21 +957,77 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, var threshold_data = new Array(); if (threshold) { - // Warning and critical treshold - threshold_data.push({ - id: 'critical_min', - data: critical_min, - label: null, - color: critical, - lines: { show: true, fill: false, lineWidth:3} - }); - threshold_data.push({ - id: 'warning_min', - data: warning_min, - label: null, - color: warning, - lines: { show: true, fill: false, lineWidth:3} - }); + // Warning interval + if (yellow_inverse) { + threshold_data.push({ // barWidth will be correct on draw time + id: 'warning_up', + data: [[max_x, yellow_up]], + label: null, + color: warning, + bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true} + }); + threshold_data.push({ // barWidth will be correct on draw time + id: 'warning_down', + data: [[max_x, 0]], + label: null, + color: warning, + bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true} + }); + } else { + if (yellow_up == 0) { + threshold_data.push({ // barWidth will be correct on draw time + id: 'warning_up', + data: [[max_x, yellow_threshold]], + label: null, + color: warning, + bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true} + }); + } else { + threshold_data.push({ + id: 'warning_normal', + data: [[max_x, yellow_threshold]], + label: null, + color: warning, + bars: {show: true, align: "left", barWidth: (yellow_up - yellow_threshold), lineWidth: 0, horizontal: true} + }); + } + } + // Critical interval + if (red_inverse) { + threshold_data.push({ // barWidth will be correct on draw time + id: 'critical_up', + data: [[max_x, red_up]], + label: null, + color: critical, + bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true} + }); + threshold_data.push({ // barWidth will be correct on draw time + id: 'critical_down', + data: [[max_x, 0]], + label: null, + color: critical, + bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true} + }); + } else { + if (red_up == 0) { + threshold_data.push({ // barWidth will be correct on draw time + id: 'critical_up', + data: [[max_x, red_threshold]], + label: null, + color: critical, + bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true} + }); + } else { + threshold_data.push({ + id: 'critical_normal', + data: [[max_x, red_threshold]], + label: null, + color: critical, + bars: {show: true, align: "left", barWidth: (red_up - red_threshold), lineWidth: 0, horizontal: true} + }); + } + } + } // The first execution, the graph data is the base data @@ -1082,7 +1134,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, new_steps = parseInt(factor * steps); - plot = $.plot($('#' + graph_id), datas, + plot = $.plot($('#' + graph_id), data_base, $.extend(true, {}, options, { xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to}, xaxes: [ { @@ -1092,6 +1144,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, } ], legend: { show: false } })); + if (thresholded) { + var zoom_data_threshold = new Array (); + + zoom_data_threshold = add_threshold (data_base, threshold_data, plot.getAxes().yaxis.min, plot.getAxes().yaxis.max, + yellow_threshold, red_threshold, yellow_up, red_up); + plot.setData(zoom_data_threshold); + plot.draw(); + } + $('#menu_cancelzoom_' + graph_id) .attr('src', homeurl + '/images/zoom_cross_grey.png'); @@ -1535,23 +1596,22 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, datas = new Array(); if (thresholded) { - thresholded = false; - } - else { - $.each(threshold_data, function() { - datas.push(this); + $.each(data_base, function() { + // Prepared to turning series + //if(showed[this.id.split('_')[1]]) { + datas.push(this); + //} }); + thresholded = false; + } else { + //pocoyo + datas = add_threshold (data_base, threshold_data, plot.getAxes().yaxis.min, plot.getAxes().yaxis.max, + yellow_threshold, red_threshold, yellow_up, red_up); thresholded = true; } - $.each(data_base, function() { - // Prepared to turning series - //if(showed[this.id.split('_')[1]]) { - datas.push(this); - //} - }); - - plot = $.plot($('#' + graph_id), datas, options); + plot.setData(datas); + plot.draw(); plot.setSelection(currentRanges); }); @@ -1568,6 +1628,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, .attr('src', homeurl + '/images/zoom_cross.disabled.png'); overview.clearSelection(); currentRanges = null; + + thresholded = false; }); // Adjust the menu image on top of the plot @@ -1735,3 +1797,51 @@ function number_format(number, force_integer, unit) { return number + ' ' + shorts[pos] + unit; } +function add_threshold (data_base, threshold_data, y_min, y_max, yellow_threshold, + red_threshold, yellow_up, red_up) { + + var datas = new Array (); + + $.each(data_base, function() { + // Prepared to turning series + //if(showed[this.id.split('_')[1]]) { + datas.push(this); + //} + }); + + // Resize the warning and critical interval + $.each(threshold_data, function() { + if (/_up/.test(this.id)){ + this.bars.barWidth = y_max - this.data[0][1]; + } + if (/_down/.test(this.id)){ + var end; + if (/critical/.test(this.id)) { + end = red_threshold; + } else { + end = yellow_threshold; + } + this.bars.barWidth = end - y_min; + this.data[0][1] = y_min; + } + if (/_normal/.test(this.id)){ + var end; + if (/critical/.test(this.id)) { + end = red_up; + } else { + end = yellow_up; + } + if (this.data[0][1] < y_min) { + this.bars.barWidth = end - y_min; + this.data[0][1] = y_min; + end = this.bars.barWidth + this.data[0][1]; + } + if (end > y_max) { + this.bars.barWidth = y_max - this.data[0][1]; + } + } + datas.push(this); + }); + + return datas; +} diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index b3dbb11096..f618aba3b9 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -94,7 +94,7 @@ function flot_area_stacked_graph($chart_data, $width, $height, $color, $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, - $background_color = 'white', $dashboard = false, $vconsole = false) { + $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) { global $config; @@ -102,7 +102,7 @@ function flot_area_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_stacked', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, - $menu, $background_color, $dashboard, $vconsole); + $menu, $background_color, $dashboard, $vconsole, $agent_module_id); } function flot_area_simple_graph($chart_data, $width, $height, $color, @@ -110,7 +110,7 @@ function flot_area_simple_graph($chart_data, $width, $height, $color, $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, - $background_color = 'white', $dashboard = false, $vconsole = false) { + $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) { global $config; @@ -118,7 +118,7 @@ function flot_area_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_simple', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, - $menu, $background_color, $dashboard, $vconsole); + $menu, $background_color, $dashboard, $vconsole, $agent_module_id); } function flot_line_stacked_graph($chart_data, $width, $height, $color, @@ -126,7 +126,7 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color, $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, - $background_color = 'white', $dashboard = false, $vconsole = false) { + $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) { global $config; @@ -134,7 +134,7 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'line_stacked', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, - $menu, $background_color, $dashboard, $vconsole); + $menu, $background_color, $dashboard, $vconsole, $agent_module_id); } function flot_line_simple_graph($chart_data, $width, $height, $color, @@ -142,7 +142,7 @@ function flot_line_simple_graph($chart_data, $width, $height, $color, $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, - $background_color = 'white', $dashboard = false, $vconsole = false) { + $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) { global $config; @@ -157,7 +157,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $type, $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str = '', $menu = true, - $background_color = 'white', $dashboard = false, $vconsole = false) { + $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) { global $config; @@ -189,9 +189,25 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $return = "
"; // Set some containers to legend, graph, timestamp tooltip, etc. $return .= "

"; + + + // Get other required module datas to draw warning and critical + if ($agent_module_id == 0) { + $yellow_up = 0; + $red_up = 0; + $yellow_inverse = false; + $red_inverse = false; + } else { + $module_data = db_get_row_sql ('SELECT * FROM tagente_modulo WHERE id_agente_modulo = ' . $agent_module_id); + $yellow_up = $module_data['max_warning']; + $red_up = $module_data['max_critical']; + $yellow_inverse = !($module_data['warning_inverse'] == 0); + $red_inverse = !($module_data['critical_inverse'] == 0); + } + if ($menu) { $threshold = false; - if ($yellow_threshold != 0 || $red_threshold != 0) { + if ($yellow_threshold != $yellow_up || $red_threshold != $red_up) { $threshold = true; } @@ -426,6 +442,10 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, "$force_integer, \n" . "'$separator', \n" . "'$separator2', \n" . + "'$yellow_up', \n" . + "'$red_up', \n" . + "'$yellow_inverse', \n" . + "'$red_inverse', \n" . "'$series_suffix_str', '$vconsole');"; $return .= "\n//]]>"; diff --git a/pandora_console/include/graphs/pChart/pDraw.class.php b/pandora_console/include/graphs/pChart/pDraw.class.php index 814f4ec824..300d2f49ba 100755 --- a/pandora_console/include/graphs/pChart/pDraw.class.php +++ b/pandora_console/include/graphs/pChart/pDraw.class.php @@ -2556,6 +2556,7 @@ if (floor($Value2) == 0) { return(0); } if (is_infinite($Value2)) { return(0); } if ($Value2 == 0.0) { return(0); } + if ($Value1 > $Value2) { return(0); } if ($this->mod_check($Value1, $Value2)) { return(0); } if (floor($Value2) != 0) { return($Value1 % $Value2); } diff --git a/pandora_console/install.php b/pandora_console/install.php index e448a26dba..87d1775152 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
/dev/null 2>&1 fi - + echo "Stopping Tentacle Server" rc_status -v fi