From b912834ce7d460ce9bdc6a0cf3dfd814b3e2eec5 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 12 Apr 2017 15:00:09 +0200 Subject: [PATCH 01/82] Added the new item to item editor builder and to html view --- .../reporting_builder.item_editor.php | 16 +++++ .../include/functions_reporting.php | 65 ++++++++++++++++++ .../include/functions_reporting_html.php | 66 +++++++++++++++++++ pandora_console/include/functions_reports.php | 3 +- 4 files changed, 149 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 2e974b85fe..900cf4b475 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -144,6 +144,7 @@ switch ($action) { case 'network_interfaces_report': case 'availability': case 'event_report_log': + case 'increment': case 'availability_graph': case 'agent_module': $get_data_editor = true; @@ -272,6 +273,13 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); break; + case 'increment': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'SLA_services': $description = $item['description']; $period = $item['period']; @@ -578,6 +586,7 @@ switch ($action) { case 'MTTR': case 'simple_baseline_graph': case 'event_report_log': + case 'increment': $label = (isset($style['label'])) ? $style['label'] : ''; break; default: @@ -2646,6 +2655,13 @@ function chooseType() { $("#agents_row").show(); $("#row_source").show(); break; + + case 'increment': + $("#row_description").show(); + $("#row_agent").show(); + $("#row_module").show(); + $("#row_period").show(); + break; case 'simple_graph': $("#row_time_compare_overlapped").show(); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3d05c2099f..1a649d63ab 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -171,6 +171,12 @@ function reporting_make_reporting_data($report = null, $id_report, $report, $content); break; + case 'increment': + $report['contents'][] = + reporting_increment( + $report, + $content); + break; case 'general': $report['contents'][] = reporting_general( @@ -5464,6 +5470,65 @@ function reporting_availability_graph($report, $content, $pdf=false) { return reporting_check_structure_content($return); } +/** + * reporting_increment + * + * Generates a structure the report. + * + */ +function reporting_increment ($report, $content) { + global $config; + + $return = array(); + $return['type'] = 'increment'; + if (empty($content['name'])) { + $content['name'] = __('Increment'); + } + + $return['title'] = $content['name']; + $return["description"] = $content["description"]; + $return["id_agent_module"] = $content["id_agent_module"]; + $return["id_agent"] = $content["id_agent"]; + + $id_agent_module = $content['id_agent_module']; + $period = (int)$content['period']; + + $return["from"] = time() - $period; + $return["to"] = time(); + + $return["data"] = array(); + + $old_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' + AND utimestamp <= ' . (time() - $period) . ' ORDER BY utimestamp DESC'); + + $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' ORDER BY utimestamp DESC'); + + if (is_numeric($old_data) && is_numeric($last_data)) { + $return["data"]['old'] = $old_data; + $return["data"]['now'] = $last_data; + $increment = $old_data - $last_data; + + if ($increment < 0) { + $return["data"]['inc'] = 'positive'; + $return["data"]["inc_data"] = $last_data - $old_data; + } + else if ($increment == 0) { + $return["data"]['inc'] = 'neutral'; + $return["data"]["inc_data"] = 0; + } + else { + $return["data"]['inc'] = 'negative'; + $return["data"]["inc_data"] = $old_data - $last_data; + } + } + else { + $return["data"]['message'] = __('The monitor type is not numeric'); + $return["data"]['error'] = true; + } + + return reporting_check_structure_content($return); +} + /** * reporting_general * diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index f6acad7fbe..1cf64b4342 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -208,6 +208,9 @@ function reporting_html_print_report($report, $mini = false, $report_info = 1) { case 'avg_value': reporting_html_avg_value($table, $item, $mini); break; + case 'increment': + reporting_html_increment($table, $item); + break; case 'min_value': reporting_html_min_value($table, $item, $mini); break; @@ -2213,6 +2216,69 @@ function reporting_html_value(&$table, $item, $mini, $only_value = false, $check $table->data['data']['cell'] .= '

'; } +function reporting_html_increment(&$table, $item) { + global $config; + + if (isset($item["data"]['error'])) { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = $item["data"]['message']; + } + else { + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->data = array (); + + $table1->head = array (); + $table1->head[0] = __('Agent'); + $table1->head[1] = __('Module'); + $table1->head[2] = __('From'); + $table1->head[3] = __('To'); + $table1->head[4] = __('From data'); + $table1->head[5] = __('To data'); + $table1->head[6] = __('Increment'); + + $table1->headstyle = array(); + $table1->headstyle[0] = 'text-align: left'; + $table1->headstyle[1] = 'text-align: left'; + $table1->headstyle[2] = 'text-align: left'; + $table1->headstyle[3] = 'text-align: left'; + $table1->headstyle[4] = 'text-align: right'; + $table1->headstyle[5] = 'text-align: right'; + $table1->headstyle[6] = 'text-align: right'; + + $table1->style[0] = 'text-align: left'; + $table1->style[1] = 'text-align: left'; + $table1->style[2] = 'text-align: left'; + $table1->style[3] = 'text-align: left'; + $table1->style[4] = 'text-align: right'; + $table1->style[5] = 'text-align: right'; + $table1->style[6] = 'text-align: right'; + + $table1_row = array(); + $table1_row[0] = agents_get_alias($item['id_agent']); + $table1_row[1] = modules_get_agentmodule_name($item['id_agent_module']); + $table1_row[2] = date("F j, Y, g:i a", $item['from']); + $table1_row[3] = date("F j, Y, g:i a", $item['to']); + $table1_row[4] = $item["data"]['old']; + $table1_row[5] = $item["data"]['now']; + if ($item["data"]['inc'] == 'negative') { + $table1_row[6] = __('Negative increase: ') . $item["data"]["inc_data"]; + } + else if ($item["data"]['inc'] == 'positive') { + $table1_row[6] = __('Positive increase: ') . $item["data"]["inc_data"]; + } + else { + $table1_row[6] = __('Neutral increase: ') . $item["data"]["inc_data"]; + } + + $table1->data[] = $table1_row; + + $data = array(); + $data[0] = html_print_table($table1, true); + array_push ($table->data, $data); + } +} + function reporting_html_url(&$table, $item, $key) { $table->colspan['data']['cell'] = 3; $table->cellstyle['data']['cell'] = 'text-align: left;'; diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 9282be345b..dfa3d3d490 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -574,7 +574,8 @@ function reports_get_report_types ($template = false, $not_editor = false) { 'name' => __('Summatory')); $types['historical_data'] = array('optgroup' => __('Modules'), 'name' => __('Historical Data')); - + $types['increment'] = array('optgroup' => __('Modules'), + 'name' => __('Increment')); $types['general'] = array('optgroup' => __('Grouped'), From cc1ab47a65cc5815427d327b6727f138782d198b Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 12 Apr 2017 15:53:36 +0200 Subject: [PATCH 02/82] Added fixes to new report item --- pandora_console/include/functions_reporting.php | 6 +++++- pandora_console/include/functions_reporting_html.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 1a649d63ab..2d230792d3 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -5503,7 +5503,11 @@ function reporting_increment ($report, $content) { $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' ORDER BY utimestamp DESC'); - if (is_numeric($old_data) && is_numeric($last_data)) { + if ($old_data === false || $last_data === false) { + $return["data"]['message'] = __('The monitor have no data in this range of dates or monitor type is not numeric'); + $return["data"]['error'] = true; + } + else if (is_numeric($old_data) && is_numeric($last_data)) { $return["data"]['old'] = $old_data; $return["data"]['now'] = $last_data; $increment = $old_data - $last_data; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 1cf64b4342..6522a0b63a 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2257,8 +2257,8 @@ function reporting_html_increment(&$table, $item) { $table1_row = array(); $table1_row[0] = agents_get_alias($item['id_agent']); $table1_row[1] = modules_get_agentmodule_name($item['id_agent_module']); - $table1_row[2] = date("F j, Y, g:i a", $item['from']); - $table1_row[3] = date("F j, Y, g:i a", $item['to']); + $table1_row[2] = date("F j, Y, G:i", $item['from']); + $table1_row[3] = date("F j, Y, G:i", $item['to']); $table1_row[4] = $item["data"]['old']; $table1_row[5] = $item["data"]['now']; if ($item["data"]['inc'] == 'negative') { From d499cc1b84ba70fb5fc0a1e88db7124590e9d665 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 12 Apr 2017 17:12:16 +0200 Subject: [PATCH 03/82] Added modification to new report item in meta --- .../include/functions_reporting.php | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 2d230792d3..98438030ef 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -5498,10 +5498,42 @@ function reporting_increment ($report, $content) { $return["data"] = array(); - $old_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' + if (defined('METACONSOLE')) { + $sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' + AND utimestamp <= ' . (time() - $period) . ' ORDER BY utimestamp DESC'; + $sql2 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' ORDER BY utimestamp DESC'; + + $servers = db_get_all_rows_sql ('SELECT * + FROM tmetaconsole_setup + WHERE disabled = 0'); + + if ($servers === false) + $servers = array(); + + $result = array(); + $count_modules = 0; + foreach ($servers as $server) { + // If connection was good then retrieve all data server + if (metaconsole_connect($server) == NOERR) + $connection = true; + else + $connection = false; + + $old_data = db_get_value_sql ($sql1); + + $last_data = db_get_value_sql ($sql2); + } + } + else { + $old_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' AND utimestamp <= ' . (time() - $period) . ' ORDER BY utimestamp DESC'); - $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' ORDER BY utimestamp DESC'); + $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' ORDER BY utimestamp DESC'); + } + + if (!defined('METACONSOLE')) { + + } if ($old_data === false || $last_data === false) { $return["data"]['message'] = __('The monitor have no data in this range of dates or monitor type is not numeric'); From 74308ae42b1f729c156396702c22a1a6e5c4a25c Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 17 Oct 2017 16:58:05 +0200 Subject: [PATCH 04/82] Created Safe operation mode --- pandora_console/extras/mr/9.sql | 5 + .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../godmode/agentes/agent_manager.php | 120 ++++++++++++------ .../godmode/agentes/configurar_agente.php | 12 +- pandora_console/pandoradb.sql | 1 + 5 files changed, 94 insertions(+), 45 deletions(-) create mode 100644 pandora_console/extras/mr/9.sql diff --git a/pandora_console/extras/mr/9.sql b/pandora_console/extras/mr/9.sql new file mode 100644 index 0000000000..055b7b36b3 --- /dev/null +++ b/pandora_console/extras/mr/9.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 4e31057a89..190dfd1b7d 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1218,6 +1218,7 @@ ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0; ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0'; ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default ''); ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0'; +ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; UPDATE tagente SET tagente.alias = tagente.nombre; -- --------------------------------------------------------------------- diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index efee6dc435..42e71093ab 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -252,25 +252,6 @@ foreach ($modules as $m) { $modules_values[$m['id_module']] = $m['name']; } -$table->data[3][0] = __('Parent'); -$params = array(); -$params['return'] = true; -$params['show_helptip'] = true; -$params['input_name'] = 'id_parent'; -$params['print_hidden_input_idagent'] = true; -$params['hidden_input_idagent_name'] = 'id_agent_parent'; -$params['hidden_input_idagent_value'] = $id_parent; -$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); -$params['selectbox_id'] = 'cascade_protection_module'; -$params['javascript_is_function_select'] = true; -$params['cascade_protection'] = true; - -$table->data[3][1] = ui_print_agent_autocomplete_input($params); - -$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true); - -$table->data[3][1] .= "  " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true); - $table->data[4][0] = __('Group'); $table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true); $table->data[4][1] .= ' '; @@ -320,52 +301,87 @@ $table->class = "databox filters"; $table->head = array (); $table->style = array (); $table->style[0] = 'font-weight: bold; '; -$table->style[2] = 'font-weight: bold;'; +$table->style[4] = 'font-weight: bold;'; $table->data = array (); // Custom ID $table->data[0][0] = __('Custom ID'); $table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$table->data[1][0] = __('Parent'); +$params = array(); +$params['return'] = true; +$params['show_helptip'] = true; +$params['input_name'] = 'id_parent'; +$params['print_hidden_input_idagent'] = true; +$params['hidden_input_idagent_name'] = 'id_agent_parent'; +$params['hidden_input_idagent_value'] = $id_parent; +$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); +$params['selectbox_id'] = 'cascade_protection_module'; +$params['javascript_is_function_select'] = true; +$params['cascade_protection'] = true; + +$table->data[1][1] = ui_print_agent_autocomplete_input($params); +$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true); +$table->data[1][1] .= "  " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true); + +//safe operation mode +if($id_agente){ + $sql_modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo + WHERE id_agente = " . $id_agente); + $safe_mode_modules = array(); + $safe_mode_modules[0] = __('Any'); + foreach ($sql_modules as $m) { + $safe_mode_modules[$m['id_module']] = $m['name']; + } + + $table->data[2][0] = __('Safe operation mode') + . ui_print_help_tip(__('This mode allow Pandora FMS to disable all modules + of this agent while the selected module is on CRITICAL status'), true); + $table->data[2][1] = html_print_checkbox('safe_mode', 1, $safe_mode, true); + $table->data[2][1] .= "  " . __('Module') . " " . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true); +} + + // Learn mode / Normal mode -$table->data[1][0] = __('Module definition') . +$table->data[3][0] = __('Module definition') . ui_print_help_icon("module_definition", true); -$table->data[1][1] = __('Learning mode') . ' ' . +$table->data[3][1] = __('Learning mode') . ' ' . html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); -$table->data[1][1] .= __('Normal mode') . ' ' . +$table->data[3][1] .= __('Normal mode') . ' ' . html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); -$table->data[1][1] .= __('Autodisable mode') . ' ' . +$table->data[3][1] .= __('Autodisable mode') . ' ' . html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); // Status (Disabled / Enabled) -$table->data[2][0] = __('Status'); -$table->data[2][1] = __('Disabled') . ' ' . +$table->data[4][0] = __('Status'); +$table->data[4][1] = __('Disabled') . ' ' . html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true); -$table->data[2][1] .= __('Active') . ' ' . +$table->data[4][1] .= __('Active') . ' ' . html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); // Remote configuration -$table->data[3][0] = __('Remote configuration'); +$table->data[5][0] = __('Remote configuration'); if (!$new_agent) { - $table->data[3][1] = '' . __('Not available') . ''; + $table->data[5][1] = '' . __('Not available') . ''; if (isset($filename)) { if (file_exists ($filename['md5'])) { - $table->data[3][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); + $table->data[5][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); // Delete remote configuration - $table->data[3][1] .= ''; - $table->data[3][1] .= html_print_image( + $table->data[5][1] .= html_print_image( "images/cross.png", true, array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).''; - $table->data[3][1] .= '' . + $table->data[5][1] .= '' . ui_print_help_tip( __('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true); @@ -373,7 +389,7 @@ if (!$new_agent) { } } else - $table->data[3][1] = '' . __('Not available') . ''; + $table->data[5][1] = '' . __('Not available') . ''; $listIcons = gis_get_array_list_icons(); @@ -411,23 +427,23 @@ $table->data[0][3] = html_print_select($arraySelectIcon, "icon_path", array("id" => "icon_warning", "style" => "display:".$display_icons.";")); if ($config['activate_gis']) { - $table->data[1][2] = __('Ignore new GIS data:'); - $table->data[1][3] = __('Yes') . ' ' . + $table->data[3][2] = __('Ignore new GIS data:'); + $table->data[3][3] = __('Yes') . ' ' . html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); - $table->data[1][3] .= __('No') . ' ' . + $table->data[3][3] .= __('No') . ' ' . html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); } -$table->data[2][2] = __('Url address'); -$table->data[2][3] = html_print_input_text ('url_description', +$table->data[4][2] = __('Url address'); +$table->data[4][3] = html_print_input_text ('url_description', $url_description, '', 45, 255, true); -$table->data[3][2] = __('Quiet'); -$table->data[3][3] = ui_print_help_tip( +$table->data[5][2] = __('Quiet'); +$table->data[5][3] = ui_print_help_tip( __('The agent still runs but the alerts and events will be stop'), true); -$table->data[3][3] .= html_print_checkbox('quiet', 1, $quiet, true); +$table->data[5][3] .= html_print_checkbox('quiet', 1, $quiet, true); ui_toggle(html_print_table ($table, true), __('Advanced options')); unset($table); @@ -582,6 +598,26 @@ ui_require_jquery_file('bgiframe'); $("#cascade_protection_module").attr("disabled", 'disabled'); } }); + + var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); + if (safe_mode_checked) { + $("#safe_mode_module").removeAttr("disabled"); + } + else { + $("#safe_mode_module").attr("disabled", 'disabled'); + } + + $("#checkbox-safe_mode").change(function () { + var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); + + if (safe_mode_checked) { + $("#safe_mode_module").removeAttr("disabled"); + } + else { + $("#safe_mode_module").val(0); + $("#safe_mode_module").attr("disabled", 'disabled'); + } + }); paint_qrcode( " $update_gis_data, 'url_address' => $url_description, 'url_address' => $url_description, - 'quiet' => $quiet); + 'quiet' => $quiet, + 'safe_mode_module' => $safe_mode_module); if ($config['metaconsole_agent_cache'] == 1) { $values['update_module_count'] = 1; // Force an update of the agent cache. @@ -900,6 +904,8 @@ if ($id_agente) { $update_gis_data = $agent["update_gis_data"]; $url_description = $agent["url_address"]; $quiet = $agent["quiet"]; + $safe_mode_module = $agent["safe_mode_module"]; + $safe_mode = ($safe_mode_module) ? 1 : 0; } $update_module = (bool) get_parameter ('update_module'); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0d749db694..9df76cbd34 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `tagente` ( `alias` varchar(600) BINARY NOT NULL default '', `transactional_agent` tinyint(1) NOT NULL default '0', `alias_as_name` tinyint(2) NOT NULL default '0', + `safe_mode_module` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id_agente`), KEY `nombre` (`nombre`(255)), KEY `direccion` (`direccion`), From 405cf9e16c7b67285c6f7381b49e91402508117a Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 17 Oct 2017 17:05:31 +0200 Subject: [PATCH 05/82] Fixed issue --- pandora_console/godmode/agentes/configurar_agente.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 9833285e32..39f3cbba5b 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -166,6 +166,8 @@ if ($create_agent) { $id_os = (int) get_parameter_post ("id_os"); $disabled = (int) get_parameter_post ("disabled"); $custom_id = (string) get_parameter_post ("custom_id",''); + $cascade_protection = (int) get_parameter_post ("cascade_protection", 0); + $cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0); $safe_mode = (int) get_parameter_post ("safe_mode", 0); $safe_mode_module = (int) get_parameter_post ("safe_mode_module", 0); $icon_path = (string) get_parameter_post ("icon_path",''); From 7379243946fd85c50eb854547caa3dcb9db56905 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 25 Oct 2017 18:40:58 +0200 Subject: [PATCH 06/82] Fixed lower than 1 values on gauges --- pandora_console/include/graphs/pandora.d3.js | 26 +++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 95a914104f..79dfceb21d 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -1037,19 +1037,19 @@ function createGauges(data, width, height, font_size, no_data_image, font) { label = label.replace(/(/g,'\('); label = label.replace(/)/g,'\)'); - minimun_warning = Math.round(parseFloat( data[key].min_warning ),2); - maximun_warning = Math.round(parseFloat( data[key].max_warning ),2); - minimun_critical = Math.round(parseFloat( data[key].min_critical ),2); - maximun_critical = Math.round(parseFloat( data[key].max_critical ),2); + minimun_warning = round_with_decimals(parseFloat( data[key].min_warning )); + maximun_warning = round_with_decimals(parseFloat( data[key].max_warning )); + minimun_critical = round_with_decimals(parseFloat( data[key].min_critical )); + maximun_critical = round_with_decimals(parseFloat( data[key].max_critical )); - mininum = Math.round(parseFloat(data[key].min),2); - maxinum = Math.round(parseFloat(data[key].max),2); + mininum = round_with_decimals(parseFloat(data[key].min)); + maxinum = round_with_decimals(parseFloat(data[key].max)); critical_inverse = parseInt(data[key].critical_inverse); warning_inverse = parseInt(data[key].warning_inverse); - valor = Math.round(parseFloat(data[key].value),2); - + valor = round_with_decimals(data[key].value); + if (isNaN(valor)) valor = null; createGauge(nombre, label, valor, mininum, maxinum, @@ -1281,7 +1281,7 @@ function Gauge(placeholderName, configuration, font) { var pointerContainer = this.body.select(".pointerContainer"); - pointerContainer.selectAll("text").text(Math.round(value)); + pointerContainer.selectAll("text").text(round_with_decimals(value)); var pointer = pointerContainer.selectAll("path"); pointer.transition() @@ -1492,4 +1492,12 @@ function print_phases_donut (recipient, phases) { polyline.exit() .remove(); } +} + +function round_with_decimals (value, multiplier = 1) { + if ((value * multiplier) == 0) return 0; + if ((value * multiplier) >= 1) { + return Math.round(value * multiplier) / multiplier; + } + return round_with_decimals (value, multiplier * 10); } \ No newline at end of file From c687e6a97babd16d9fd4bfd66956d08175474b18 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 27 Oct 2017 13:25:17 +0200 Subject: [PATCH 07/82] [Console] Fixed an XSS vulnerability into the 'ui_print_truncate_text' function --- pandora_console/include/functions_ui.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index de10fcaf91..77f3764618 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -94,7 +94,9 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI } } - $text = io_safe_output($text); + $text_html_decoded = io_safe_output($text); + $text_has_entities = $text != $text_html_decoded; + if (mb_strlen($text, "UTF-8") > ($numChars)) { // '/2' because [...] is in the middle of the word. $half_length = intval(($numChars - 3) / 2); @@ -102,14 +104,17 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI // Depending on the strange behavior of mb_strimwidth() itself, // the 3rd parameter is not to be $numChars but the length of // original text (just means 'large enough'). - $truncateText2 = mb_strimwidth($text, - (mb_strlen($text, "UTF-8") - $half_length), - mb_strlen($text, "UTF-8"), "", "UTF-8" ); + $truncateText2 = mb_strimwidth($text_html_decoded, + (mb_strlen($text_html_decoded, "UTF-8") - $half_length), + mb_strlen($text_html_decoded, "UTF-8"), "", "UTF-8" ); - $truncateText = mb_strimwidth($text, 0, - ($numChars - $half_length), "", "UTF-8") . $suffix; + $truncateText = mb_strimwidth($text_html_decoded, 0, + ($numChars - $half_length), "", "UTF-8"); - $truncateText = $truncateText . $truncateText2; + // Recover the html entities to avoid XSS attacks + $truncateText = ($text_has_entities) + ? io_safe_input($truncateText) . $suffix . io_safe_input($truncateText2) + : $truncateText . $suffix . $truncateText2; if ($showTextInTitle) { if ($style === null) { From 64ec82f9d6cea68350fa307747c1b8fbd0bd8ccd Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 30 Oct 2017 16:04:58 +0100 Subject: [PATCH 08/82] [Console] Added a notice to warn the users about the php files uploaded with the files manager --- pandora_console/include/functions_filemanager.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 5e0ef6c718..1297ea50b2 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -720,6 +720,17 @@ function filemanager_file_explorer($real_directory, $relative_directory, $hash = md5($relative_path . $config['dbpass']); $data[1] = ''.$fileinfo['name'].''; } + + // Notice that uploaded php files could be dangerous + if (pathinfo($fileinfo['realpath'], PATHINFO_EXTENSION) == 'php' && + (is_readable($fileinfo['realpath']) || is_executable($fileinfo['realpath']))) { + $error_message = __('This file could be executed by any user'); + $error_message .= '. ' . __('Make sure it can\'t perform dangerous tasks'); + $data[1] = '' + . $data[1] + . ''; + } + $data[2] = ui_print_timestamp ($fileinfo['last_modified'], true, array ('prominent' => true)); if ($fileinfo['is_dir']) { From f608c686b8a4b6d9d361b5cca3a37cc79f85d2ea Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 2 Oct 2017 18:23:26 +0200 Subject: [PATCH 09/82] Graph and table mode for max, min and avg reports an template reports - #654 --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 6 + .../reporting_builder.item_editor.php | 116 ++++- .../godmode/reporting/reporting_builder.php | 18 + pandora_console/include/functions_graph.php | 79 +++- .../include/functions_reporting.php | 435 +++++++++++++++++- pandora_console/pandoradb.sql | 6 + 6 files changed, 629 insertions(+), 31 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 2b9d8c5a5a..d24b80c8b5 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -725,6 +725,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `module_free_text` TEXT, `each_agent` tinyint(1) default 1, `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, + `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', + `lapse` int(11) UNSIGNED NOT NULL default '300', + `visual_format` UNSIGNED NOT NULL tinyint(1) default '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -1270,6 +1273,9 @@ UPDATE treport_custom_sql SET `sql` = 'select t1.alias as agent_n -- --------------------------------------------------------------------- ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0'; +ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300'; +ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0'; -- --------------------------------------------------------------------- -- Table `tmodule_relationship` diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 2651751809..144dd106d3 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -112,6 +112,10 @@ $netflow_filter = 0; $max_values = 0; $resolution = 0; +$lapse_calc = 0; +$lapse = 300; +$visual_format = 0; + //Others $filter_search = ""; @@ -195,12 +199,6 @@ switch ($action) { $name = $item['name']; switch ($type) { - case 'avg_value': - $period = $item['period']; - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - break; case 'event_report_log': $period = $item['period']; $description = $item['description']; @@ -312,6 +310,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'max_value': $description = $item['description']; @@ -319,6 +320,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'min_value': $description = $item['description']; @@ -326,6 +330,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'sumatory': $description = $item['description']; @@ -1580,6 +1587,78 @@ You can of course remove the warnings, that's why we include the source and do n ?> + + + + + + + + + + + + + + + + + + + + + + + + + + '; + html_print_radio_button ('visual_format', 1, '', $visual_format_table,'',!$lapse_calc); + echo (''); + echo __('Graph only').''; + html_print_radio_button ('visual_format', 2, '', $visual_format_graph,'',!$lapse_calc); + echo (''); + echo __('Graph and table').''; + html_print_radio_button ('visual_format', 3, '', $visual_format_both,'',!$lapse_calc); + + ?> + + + + + @@ -2211,6 +2290,19 @@ $(document).ready (function () { } }); + $("#checkbox-lapse_calc").change(function () { + + if($(this).is(":checked")){ + $( "#lapse_select" ).prop( "disabled", false ); + $("[name=visual_format]").prop( "disabled", false ); + } + else{ + $( "#lapse_select" ).prop( "disabled", true ); + $("[name=visual_format]").prop( "disabled", true ); + } + + }); + }); function create_custom_graph() { @@ -2692,6 +2784,9 @@ function chooseType() { $("#row_show_in_two_columns").hide(); $("#row_show_in_same_row").hide(); $("#row_historical_db_check").hide(); + $("#row_lapse_calc").hide(); + $("#row_lapse").hide(); + $("#row_visual_format").hide(); $("#row_show_in_landscape").hide(); $('#row_hide_notinit_agents').hide(); $("#row_module_group").hide(); @@ -2884,6 +2979,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; @@ -2893,6 +2991,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; @@ -2902,6 +3003,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index f2f780b911..e52994b810 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1069,6 +1069,15 @@ switch ($action) { $values['period'] = get_parameter('period'); $good_format = true; break; + case 'min_value': + case 'max_value': + case 'avg_value': + $values['period'] = get_parameter('period'); + $values['lapse_calc'] = get_parameter('lapse_calc'); + $values['lapse'] = get_parameter('lapse'); + $values['visual_format'] = get_parameter('visual_format'); + $good_format = true; + break; default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0); @@ -1404,6 +1413,15 @@ switch ($action) { $values['period'] = get_parameter('period'); $good_format = true; break; + case 'min_value': + case 'max_value': + case 'avg_value': + $values['period'] = get_parameter('period'); + $values['lapse_calc'] = get_parameter('lapse_calc'); + $values['lapse'] = get_parameter('lapse'); + $values['visual_format'] = get_parameter('visual_format'); + $good_format = true; + break; default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 5d33c49a01..c999674f3c 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -232,8 +232,8 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i $projection, $avg_only = false, $uncompressed_module = false, $show_events = false, $show_alerts = false, $show_unknown = false, $baseline = false, $baseline_data = array(), $events = array(), $series_suffix = '', $start_unknown = false, - $percentil = null, $fullscale = false) { - + $percentil = null, $fullscale = false, $force_interval = false,$time_interval = 300, + $max_only = 0, $min_only = 0) { global $config; global $chart_extra_data; global $series_type; @@ -413,10 +413,17 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i } if ($count > 0) { + if ($avg_only) { $chart[$timestamp]['sum'.$series_suffix] = $total; } - else { + else if($max_only){ + $chart[$timestamp]['max'.$series_suffix] = $interval_max; + } + else if($min_only){ + $chart[$timestamp]['min'.$series_suffix] = $interval_min; + } + else{ $chart[$timestamp]['max'.$series_suffix] = $interval_max; $chart[$timestamp]['sum'.$series_suffix] = $total; $chart[$timestamp]['min'.$series_suffix] = $interval_min; @@ -428,7 +435,13 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i if ($avg_only) { $chart[$timestamp]['sum'.$series_suffix] = 0; } - else { + else if($max_only){ + $chart[$timestamp]['max'.$series_suffix] = 0; + } + else if($min_only){ + $chart[$timestamp]['min'.$series_suffix] = 0; + } + else{ $chart[$timestamp]['max'.$series_suffix] = 0; $chart[$timestamp]['sum'.$series_suffix] = 0; $chart[$timestamp]['min'.$series_suffix] = 0; @@ -438,6 +451,12 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i if ($avg_only) { $chart[$timestamp]['sum'.$series_suffix] = $last_known; } + else if ($max_only) { + $chart[$timestamp]['max'.$series_suffix] = $last_known; + } + else if ($min_only) { + $chart[$timestamp]['min'.$series_suffix] = $last_known; + } else { $chart[$timestamp]['max'.$series_suffix] = $last_known; $chart[$timestamp]['sum'.$series_suffix] = $last_known; @@ -502,8 +521,9 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $baseline = 0, $return_data = 0, $show_title = true, $projection = false, $adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '', $show_unknown = false, $percentil = null, $dashboard = false, $vconsole = false, - $type_graph='area', $fullscale = false, $flash_chart = false) { - + $type_graph='area', $fullscale = false, $flash_chart = false, $force_interval = false,$time_interval = 300, + $max_only = 0, $min_only = 0) { + global $config; global $chart; global $color; @@ -529,8 +549,23 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, if ($date == 0) $date = get_system_time(); $datelimit = $date - $period; $search_in_history_db = db_search_in_history_db($datelimit); - $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); + + + + if($force_interval){ + $resolution = $period/$time_interval; + } + else{ + $resolution = $config['graph_res'] * 50; //Number of points of the graph + } + + if($force_interval){ + $interval = $time_interval; + } + else{ + $interval = (int) ($period / $resolution); + } + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = agents_get_agent_id ($agent_name); $module_name = modules_get_agentmodule_name ($agent_module_id); @@ -718,7 +753,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $projection, $avg_only, $uncompressed_module, $show_events, $show_alerts, $show_unknown, $baseline, $baseline_data, $events, $series_suffix, $start_unknown, - $percentil, $fullscale); + $percentil, $fullscale, $force_interval, $time_interval, + $max_only, $min_only); } // Return chart data and don't draw @@ -843,6 +879,19 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $legend['percentil'.$series_suffix] = __('Percentile %dÂș', $percentil) .$series_suffix_str . " (" . $percentil_value . " " . $unit . ") "; $chart_extra_data['legend_percentil'] = $legend['percentil'.$series_suffix_str]; } + + if($force_interval){ + $legend = array(); + if($avg_only){ + $legend['sum'.$series_suffix] = __('Avg'); + } + elseif ($max_only) { + $legend['min'.$series_suffix] = __('Max'); + } + elseif ($min_only) { + $legend['max'.$series_suffix] = __('Min'); + } + } } function grafico_modulo_sparse ($agent_module_id, $period, $show_events, @@ -853,8 +902,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $adapt_key = '', $compare = false, $show_unknown = false, $menu = true, $backgroundColor = 'white', $percentil = null, $dashboard = false, $vconsole = false, $type_graph = 'area', $fullscale = false, - $id_widget_dashboard = false) { - + $id_widget_dashboard = false,$force_interval = 0,$time_interval = 300, + $max_only = 0, $min_only = 0) { + + global $config; global $graphic_type; @@ -884,7 +935,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $return_data, $show_title, $projection, $adapt_key, $compare, $series_suffix, $series_suffix_str, $show_unknown, $percentil, $dashboard, $vconsole,$type_graph, - $fullscale, $flash_chart); + $fullscale, $flash_chart,$force_interval,$time_interval,$max_only,$min_only); switch ($compare) { case 'separated': @@ -917,7 +968,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $show_alerts, $avg_only, $date, $unit, $baseline, $return_data, $show_title, $projection, $adapt_key, $compare, '', '', $show_unknown, - $percentil, $dashboard, $vconsole, $type_graph, $fullscale, $flash_chart); + $percentil, $dashboard, $vconsole, $type_graph, $fullscale,$flash_chart, + $force_interval,$time_interval,$max_only,$min_only); + if ($return_data) { return $data_returned; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 72ab847d48..a46f907ff3 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -190,6 +190,9 @@ function reporting_make_reporting_data($report = null, $id_report, $items_label['id_agent_module'] = $content['id_agent_module']; $items_label['modules'] = $modules_to_macro; $items_label['agents'] = $agents_to_macro; + $items_label['visual_format'] = $visual_format; + $metaconsole_on = is_metaconsole(); + $server_name = $content['server_name']; //Metaconsole connection if ($metaconsole_on && $server_name != '') { @@ -290,19 +293,19 @@ function reporting_make_reporting_data($report = null, $id_report, $report['contents'][] = reporting_value( $report, $content, - 'max'); + 'max',$pdf); break; case 'avg_value': $report['contents'][] = reporting_value( $report, $content, - 'avg'); + 'avg',$pdf); break; case 'min_value': $report['contents'][] = reporting_value( $report, $content, - 'min'); + 'min',$pdf); break; case 'sumatory': $report['contents'][] = reporting_value( @@ -3752,7 +3755,7 @@ function reporting_agent_configuration($report, $content) { return reporting_check_structure_content($return); } -function reporting_value($report, $content, $type) { +function reporting_value($report, $content, $type,$pdf) { global $config; $return = array(); @@ -3837,8 +3840,17 @@ function reporting_value($report, $content, $type) { $return['agent_name'] = $agent_name; $return['module_name'] = $module_name; + html_debug($pdf,true); + html_debug($only_image,true); + + if($pdf){ + $only_image = 1; + } + switch ($type) { case 'max': + if($content['lapse_calc'] == 0){ + $value = reporting_get_agentmodule_data_max( $content['id_agent_module'], $content['period'], $report["datetime"]); if (!$config['simple_module_value']) { @@ -3847,18 +3859,286 @@ function reporting_value($report, $content, $type) { else { $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; } - break; + + } + else{ + + $value = ' + + + + + + + + + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Maximum").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_max( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + + } + + $value .= ' +
+ '; + + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $value .= + grafico_modulo_sparse( + $content['id_agent_module'], + $content['period'], + false, + 600, + 300, + '', + '', + false, + 0, + true, + $report["datetime"], + '', + 0, + 0, + true, + $only_image, + ui_get_full_url(false, false, false, false), + 2, + false, + '', + $time_compare_overlapped, + true, + true, + 'white', + ($content['style']['percentil'] == 1) ? $config['percentil'] : null, + false, + false, + $config['type_module_charts'], + false, + false, + $content['lapse_calc'], + $content['lapse'], + 1); + } + + $value .= ' + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } + else{ + $value .= 'N/A'; + } + + } + + $value .='
+ '.__("Lapse").' + + '.__("Maximum").' +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if($i>$time_begin['utimestamp']){ + $value .= format_for_graph(reporting_get_agentmodule_data_min( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; + } + + $value .= ' + +
'; + + $formated_value = $value; + } + + break; case 'min': - $value = reporting_get_agentmodule_data_min( - $content['id_agent_module'], $content['period'], $report["datetime"]); - if (!$config['simple_module_value']) { + if($content['lapse_calc'] == 0){ + $value = reporting_get_agentmodule_data_min( + $content['id_agent_module'], $content['period'], $report["datetime"]); + + if (!$config['simple_module_value']) { + $formated_value = $value; + } + else { + $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; + } + + } + else{ + + $value = ' + + + + + + + + + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Minimum").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_min( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + + } + + $value .= ' +
+ '; + + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $value .= + grafico_modulo_sparse( + $content['id_agent_module'], + $content['period'], + false, + 600, + 300, + '', + '', + false, + 0, + true, + $report["datetime"], + '', + 0, + 0, + true, + $only_image, + ui_get_full_url(false, false, false, false), + 2, + false, + '', + $time_compare_overlapped, + true, + true, + 'white', + ($content['style']['percentil'] == 1) ? $config['percentil'] : null, + false, + false, + $config['type_module_charts'], + false, + false, + $content['lapse_calc'], + $content['lapse'], + 0, + 1); + } + + $value .= ' + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } + else{ + $value .= 'N/A'; + } + + } + + $value .='
+ '.__("Lapse").' + + '.__("Minimum").' +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if($i>$time_begin['utimestamp']){ + $value .= format_for_graph(reporting_get_agentmodule_data_min( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; + } + + $value .= ' + +
'; + $formated_value = $value; } - else { - $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; - } + break; case 'avg': + if($content['lapse_calc'] == 0){ $value = reporting_get_agentmodule_data_average( $content['id_agent_module'], $content['period'], $report["datetime"]); if (!$config['simple_module_value']) { @@ -3867,7 +4147,138 @@ function reporting_value($report, $content, $type) { else { $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; } - break; + } + else{ + $value = ' + + + + + + + + + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Average").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_average( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + + } + + $value .= ' +
+ '; + + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $value .= + grafico_modulo_sparse( + $content['id_agent_module'], + $content['period'], + false, + 600, + 300, + '', + '', + false, + 1, + true, + $report["datetime"], + '', + 0, + 0, + true, + $only_image, + ui_get_full_url(false, false, false, false), + 2, + false, + '', + $time_compare_overlapped, + true, + true, + 'white', + ($content['style']['percentil'] == 1) ? $config['percentil'] : null, + false, + false, + $config['type_module_charts'], + false, + false, + $content['lapse_calc'], + $content['lapse'] + ); + } + + $value .= ' + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } + else{ + $value .= 'N/A'; + } + + } + + $value .='
+ '.__("Lapse").' + + '.__("Average").' +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if($i>$time_begin['utimestamp']){ + $value .= format_for_graph(reporting_get_agentmodule_data_average( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; + } + + $value .= ' + +
'; + + $formated_value = $value; + + } + break; + case 'sum': $value = reporting_get_agentmodule_data_sum( $content['id_agent_module'], $content['period'], $report["datetime"]); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 3004f0ed1e..a556554581 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1270,6 +1270,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `id_module_group` INT (10) unsigned NOT NULL DEFAULT 0, `server_name` text, `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, + `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', + `lapse` int(11) UNSIGNED NOT NULL default '300', + `visual_format` UNSIGNED NOT NULL tinyint(1) default '0', PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -2727,6 +2730,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `module_free_text` TEXT, `each_agent` tinyint(1) default 1, `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, + `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', + `lapse` int(11) UNSIGNED NOT NULL default '300', + `visual_format` UNSIGNED NOT NULL tinyint(1) default '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 2da1e57dc180d15a8a7f69ff7925485fff2d2ad1 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 30 Oct 2017 16:30:51 +0100 Subject: [PATCH 10/82] Change pandora migrate and add mr8 changes - #654 Conflicts: pandora_console/extras/mr/8.sql --- pandora_console/extras/mr/8.sql | 6 ++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/extras/mr/8.sql b/pandora_console/extras/mr/8.sql index 977f7989fd..591574e07b 100644 --- a/pandora_console/extras/mr/8.sql +++ b/pandora_console/extras/mr/8.sql @@ -1,3 +1,9 @@ START TRANSACTION; ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30'; +ALTER TABLE treport_content ADD COLUMN lapse_calc tinyint(1) default '0'; +ALTER TABLE treport_content ADD COLUMN lapse int(11) default '300'; +ALTER TABLE treport_content ADD COLUMN visual_format tinyint(1) default '0'; +ALTER TABLE treport_content_template ADD COLUMN lapse_calc tinyint(1) default '0'; +ALTER TABLE treport_content_template ADD COLUMN lapse int(11) default '300'; +ALTER TABLE treport_content_template ADD COLUMN visual_format tinyint(1) default '0'; COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index d24b80c8b5..a7f25b24b9 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -727,7 +727,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', `lapse` int(11) UNSIGNED NOT NULL default '300', - `visual_format` UNSIGNED NOT NULL tinyint(1) default '0', + `visual_format` tinyint(1) UNSIGNED NOT NULL default '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 96b3ebc67a5044d9ba79a5da785d35d1f865aecf Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 30 Oct 2017 17:01:44 +0100 Subject: [PATCH 11/82] Change pandoradb treport_content_template and treport_content fields - #654 --- pandora_console/pandoradb.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index a556554581..81175e4b39 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1272,7 +1272,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', `lapse` int(11) UNSIGNED NOT NULL default '300', - `visual_format` UNSIGNED NOT NULL tinyint(1) default '0', + `visual_format` tinyint(1) UNSIGNED NOT NULL default '0', PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -2732,7 +2732,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', `lapse` int(11) UNSIGNED NOT NULL default '300', - `visual_format` UNSIGNED NOT NULL tinyint(1) default '0', + `visual_format` tinyint(1) UNSIGNED NOT NULL default '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 849eba10d454c6f6a5ab323610c5fd5498414cd8 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 30 Oct 2017 18:03:09 +0100 Subject: [PATCH 12/82] [Console] Fixed a vulnerability into the 'fgraph.php' script --- .../visual_console_builder.editor.js | 27 ++------ pandora_console/include/functions_graph.php | 10 +-- pandora_console/include/graphs/fgraph.php | 64 ++++++------------- 3 files changed, 30 insertions(+), 71 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index bc69c22351..42fc68d165 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -32,8 +32,6 @@ var SIZE_GRID = 16; //Const the size (for width and height) of grid. var img_handler_start; var img_handler_end; -var font; - function toggle_advance_options_palette(close) { if ($("#advance_options").css('display') == 'none') { $("#advance_options").css('display', ''); @@ -58,23 +56,6 @@ function visual_map_main() { img_handler_end = data; }); - //Get the actual system font. - parameter = Array(); - parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); - parameter.push ({name: "action", value: "get_font"}); - parameter.push ({name: "id_visual_console", - value: id_visual_console}); - jQuery.ajax({ - url: get_url_ajax(), - data: parameter, - type: "POST", - dataType: 'json', - success: function (data) - { - font = data['font']; - } - }); - //Get the list of posible parents parents = Base64.decode($("input[name='parents_load']").val()); parents = eval("(" + parents + ")"); @@ -1912,9 +1893,9 @@ function setPercentileBar(id_data, values) { value_text = module_value + " " + unit_text; } - var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&height=15&' + + var img = url_hack_metaconsole + 'include/graphs/fgraph.php?graph_type=progressbar&height=15&' + 'width=' + width_percentile + '&mode=1&progress=' + percentile + - '&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB; + '&value_text=' + value_text + '&colorRGB=' + colorRGB; $("#"+ id_data).attr('src', img); @@ -2035,9 +2016,9 @@ function setPercentileBubble(id_data, values) { value_text = module_value + " " + unit_text; } - var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble&height=' + width_percentile + '&' + + var img = url_hack_metaconsole + 'include/graphs/fgraph.php?graph_type=progressbubble&height=' + width_percentile + '&' + 'width=' + width_percentile + '&mode=1&progress=' + percentile + - '&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB; + '&value_text=' + value_text + '&colorRGB=' + colorRGB; $("#image_" + id_data).attr('src', img); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index c97867733b..754e1b684c 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2457,10 +2457,10 @@ function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value require_once("include_graph_dependencies.php"); include_graphs_dependencies($config['homedir'].'/'); $src = ui_get_full_url( - "/include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" . - "&width=".$width."&homedir=".$config['homedir']."&height=".$height."&progress=".$progress. + "/include/graphs/fgraph.php?graph_type=progressbar" . + "&width=".$width."&height=".$height."&progress=".$progress. "&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str . - "&title=".$title."&font=".$config['fontpath']."&value_text=". $value_text . + "&title=".$title."&value_text=". $value_text . "&colorRGB=". $colorRGB, false, false, false ); @@ -2492,10 +2492,10 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va include_graphs_dependencies($config['homedir'].'/'); return "" . $title . ""; } diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index c36529b7f7..15cf6eeeb7 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -10,48 +10,29 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -$ttl = 1; -$homeurl = ''; - -if (isset($_GET['homeurl'])) { - $homeurl = $_GET['homeurl']; -} -else $homeurl = ''; - -$homeurl = ((bool)filter_var($homeurl, FILTER_VALIDATE_URL) == 1) ? '' : $homeurl; - -if (isset($_GET['ttl'])) { - $ttl = $_GET['ttl']; -} -else $ttl_param = 1; - -if (isset($_GET['graph_type'])) { - $graph_type = $_GET['graph_type']; -} -else $graph_type = ''; - -//$graph_type = get_parameter('graph_type', ''); -//$ttl_param = get_parameter('ttl', 1); -//$homeurl_param = get_parameter('homeurl', ''); - // Turn on output buffering. // The entire buffer will be discarded later so that any accidental output // does not corrupt images generated by fgraph. -ob_start (); +ob_start(); + +global $config; + +if (empty($config['homedir'])) { + require_once ('../../include/config.php'); + global $config; +} + +include_once($config['homedir'] . '/include/functions.php'); + +$ttl = get_parameter('ttl', 1); +$graph_type = get_parameter('graph_type', ''); if (!empty($graph_type)) { - $homedir = $_GET['homedir']; - if ($homedir != null) { - $config['homedir'] = $homedir; - } - - include_once($homeurl . 'include/functions.php'); - include_once($homeurl . 'include/functions_html.php'); - - include_once($homeurl . 'include/graphs/functions_gd.php'); - include_once($homeurl . 'include/graphs/functions_utils.php'); - include_once($homeurl . 'include/graphs/functions_d3.php'); - include_once($homeurl . 'include/graphs/functions_flot.php'); + include_once($config['homedir'] . '/include/functions_html.php'); + include_once($config['homedir'] . '/include/graphs/functions_gd.php'); + include_once($config['homedir'] . '/include/graphs/functions_utils.php'); + include_once($config['homedir'] . '/include/graphs/functions_d3.php'); + include_once($config['homedir'] . '/include/graphs/functions_flot.php'); } // Clean the output buffer and turn off output buffering @@ -61,13 +42,12 @@ switch($graph_type) { case 'histogram': $width = get_parameter('width'); $height = get_parameter('height'); - $font = get_parameter('font'); $data = json_decode(io_safe_output(get_parameter('data')), true); $max = get_parameter('max'); $title = get_parameter('title'); $mode = get_parameter ('mode', 1); - gd_histogram ($width, $height, $mode, $data, $max, $font, $title); + gd_histogram ($width, $height, $mode, $data, $max, $config['fontpath'], $title); break; case 'progressbar': $width = get_parameter('width'); @@ -77,7 +57,6 @@ switch($graph_type) { $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); $out_of_lim_image = get_parameter('out_of_lim_image', false); - $font = get_parameter('font'); $title = get_parameter('title'); $mode = get_parameter('mode', 1); @@ -87,7 +66,7 @@ switch($graph_type) { $value_text = get_parameter('value_text', ''); $colorRGB = get_parameter('colorRGB', ''); - gd_progress_bar ($width, $height, $progress, $title, $font, + gd_progress_bar ($width, $height, $progress, $title, $config['fontpath'], $out_of_lim_str, $out_of_lim_image, $mode, $fontsize, $value_text, $colorRGB); break; @@ -99,7 +78,6 @@ switch($graph_type) { $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); $out_of_lim_image = get_parameter('out_of_lim_image', false); - $font = get_parameter('font'); $title = get_parameter('title'); $mode = get_parameter('mode', 1); @@ -109,7 +87,7 @@ switch($graph_type) { $value_text = get_parameter('value_text', ''); $colorRGB = get_parameter('colorRGB', ''); - gd_progress_bubble ($width, $height, $progress, $title, $font, + gd_progress_bubble ($width, $height, $progress, $title, $config['fontpath'], $out_of_lim_str, $out_of_lim_image, $mode, $fontsize, $value_text, $colorRGB); break; From f2c6837cd5ace2b2ac985ee4cbca2208f86483a0 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 30 Oct 2017 18:20:43 +0100 Subject: [PATCH 13/82] Add minor realeases doc link in header advice modal window - #951 --- pandora_console/general/header.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 49ef936515..e228c1eca4 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -261,7 +261,13 @@ config_check(); if ($check_minor_release_available) { if (users_is_admin($config['id_user'])) { - set_pandora_error_for_header('There are one or more minor releases waiting for update', 'minor release/s available'); + + if($config['language'] == 'es'){ + set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. '.__('Sobre actualizaciĂłn de revisiĂłn menor').'', 'RevisiĂłn/es menor/es disponible/s'); + } + else{ + set_pandora_error_for_header('There are one or more minor releases waiting for update. '.__('About minor release update').'', 'minor release/s available'); + } } } echo ''; From b9851a3a7150084029740f99f01eab294f4e18d7 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 31 Oct 2017 11:51:19 +0100 Subject: [PATCH 14/82] code backup --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 + .../godmode/reporting/graph_builder.main.php | 13 +++++ .../godmode/reporting/graph_builder.php | 12 +++- .../include/functions_custom_graphs.php | 8 ++- pandora_console/include/functions_events.php | 2 +- pandora_console/include/functions_graph.php | 57 +++++++++++++++++-- .../include/functions_reporting.php | 12 ++-- .../include/functions_visual_map.php | 10 ++-- .../include/graphs/functions_flot.php | 3 +- pandora_console/pandoradb.sql | 2 + 10 files changed, 99 insertions(+), 22 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 22bcc52766..86b8963865 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1248,6 +1248,8 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %'; -- Table `tgraph` -- --------------------------------------------------------------------- ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0'; +ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0'; +ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tnetflow_filter` diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index 9c95f2263b..53f8d47835 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -66,6 +66,8 @@ if ($edit_graph) { $height = $graphInTgraph['height']; $check = false; $percentil = $graphInTgraph['percentil']; + $summatory_series = $graphInTgraph['summatory_series']; + $average_series = $graphInTgraph['average_series']; if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = CUSTOM_GRAPH_BULLET_CHART; @@ -84,6 +86,8 @@ else { $stacked = 4; $check = false; $percentil = 0; + $summatory_series = 0; + $average_series = 0; } @@ -174,6 +178,15 @@ echo ""; echo ""; +echo "".__('Add summatory series')."" . + ui_print_help_tip (__("This will add a synthetic series to the graph, + using all series to give a SUM or an average of all present series values + in each interval. This feature could be used instead synthetic modules + if you only want to see a graph"), true).""; +echo "" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . " +".__('Add average series').""; +echo "" . html_print_checkbox ("average_series", 1, $average_series, true) . ""; + echo "".__('Percentil').""; echo "" . html_print_checkbox ("percentil", 1, $percentil, true) . ""; diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 317f562e6f..0d4cdcc2f9 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -87,6 +87,8 @@ if ($add_graph) { $period = get_parameter_post ("period"); $threshold = get_parameter('threshold'); $percentil = get_parameter ("percentil", 0); + $summatory_series = get_parameter ("summatory_series", 0); + $average_series = get_parameter ("average_series", 0); if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = $threshold; @@ -103,7 +105,9 @@ if ($add_graph) { 'private' => 0, 'id_group' => $idGroup, 'stacked' => $stacked, - 'percentil' => $percentil + 'percentil' => $percentil, + 'summatory_series' => $summatory_series, + 'average_series' => $average_series ); if (trim($name) != "") { @@ -131,6 +135,8 @@ if ($update_graph) { $period = get_parameter('period'); $stacked = get_parameter('stacked'); $percentil = get_parameter('percentil'); + $summatory_series = get_parameter ("summatory_series"); + $average_series = get_parameter ("average_series"); $alerts = get_parameter('alerts'); $threshold = get_parameter('threshold'); @@ -141,7 +147,9 @@ if ($update_graph) { if (trim($name) != "") { $success = db_process_sql_update('tgraph', - array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ), + array('name' => $name, 'id_group' => $id_group, 'description' => $description, + 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, + 'percentil' => $percentil, 'summatory_series' => $summatory_series, 'average_series' => $average_series), array('id_graph' => $id_graph)); if ($success !== false) db_pandora_audit("Report management", "Update graph #$id_graph"); diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index adf077ec6a..f61a7ee944 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -202,6 +202,10 @@ function custom_graphs_print($id_graph, $height, $width, $period, $sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph', $id_graph); + $series = db_get_all_rows_sql('SELECT summatory_series,average_series FROM tgraph WHERE id_graph = '.$id_graph); + $summatory = $series[0]['summatory_series']; + $average = $series[0]['average_series']; + $modules = array (); $weights = array (); $labels = array (); @@ -262,7 +266,9 @@ function custom_graphs_print($id_graph, $height, $width, $period, $percentil, $from_interface, $id_widget_dashboard, - $fullscale); + $fullscale, + $summatory, + $average); if ($return) return $output; diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 763f246bdf..58c11b1cc9 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") { } else { $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 9d66670864..f1ae8da7cc 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1061,11 +1061,11 @@ function graphic_combined_module ($module_list, $weight_list, $period, $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, $show_min = true, $show_avg = true, $labels = array(), $dashboard = false, $vconsole = false, $percentil = null, $from_interface = false, - $id_widget_dashboard=false, $fullscale = false) { + $id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0) { global $config; global $graphic_type; - + if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; @@ -1151,7 +1151,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, $weight_list[$i] = 1; } } - + + $aux_array = array(); // Set data containers for ($i = 0; $i < $resolution; $i++) { $timestamp = $datelimit + ($interval * $i);/* @@ -1203,12 +1204,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, // If its a projection graph, // first module will be data and second will be the projection + if ($projection != false && $i != 0) { if ($automatic_custom_graph_meta) $agent_module_id = $module_list[0]['module']; else $agent_module_id = $module_list[0]; - $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1219,7 +1220,6 @@ function graphic_combined_module ($module_list, $weight_list, $period, else $agent_module_id = $module_list[$i]; - $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1292,6 +1292,21 @@ function graphic_combined_module ($module_list, $weight_list, $period, continue; } + // if(empty($aux_array)){ + // foreach ($data as $key => $value) { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } else { + // foreach ($data as $key => $value) { + // if(array_key_exists($value['utimestamp'],$aux_array)){ + // $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos']; + // } else { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } + // } + + // html_debug($aux_array); if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { if ($labels[$agent_module_id] != '') $module_name_list[$i] = $labels[$agent_module_id]; @@ -2054,7 +2069,37 @@ function graphic_combined_module ($module_list, $weight_list, $period, $threshold_data['red_inverse'] = (bool)$red_inverse; } } - + + //summatory and average series + if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) { + if($summatory && $average){ + foreach ($graph_values as $key => $value) { + $cont = count($value); + $summ = array_sum($value); + array_push($value,$summ); + array_push($value,$summ/$cont); + $graph_values[$key] = $value; + } + array_push($module_name_list,'' . __('summatory'). ''); + array_push($module_name_list,'' . __('average'). ''); + + } elseif($summatory) { + foreach ($graph_values as $key => $value) { + array_push($value,array_sum($value)); + $graph_values[$key] = $value; + } + array_push($module_name_list,'' . __('summatory'). ''); + + } elseif($average) { + foreach ($graph_values as $key => $value) { + $summ = array_sum($value) / count($value); + array_push($value,$summ); + $graph_values[$key] = $value; + } + array_push($module_name_list,'' . __('average'). ''); + } + } + switch ($stacked) { case CUSTOM_GRAPH_AREA: return area_graph($flash_charts, $graph_values, $width, diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 72ab847d48..581de31d0e 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -7249,19 +7249,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he if ($links === false) { $urls = array(); $urls['monitor_critical'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; $urls['monitor_warning'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; $urls['monitor_ok'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; $urls['monitor_unknown'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; $urls['monitor_not_init'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; } else { @@ -7361,7 +7361,7 @@ function reporting_get_stats_agents_monitors($data) { else { $urls = array(); $urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; - $urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; + $urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1"; } // Agents and modules table diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 2ce0e32e08..4d7af868e0 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -433,7 +433,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -586,7 +586,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -633,11 +633,11 @@ function visual_map_print_item($mode = "read", $layoutData, $url = $server["server_url"] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = - $config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + $config['homeurl'].'/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } } else { @@ -701,7 +701,7 @@ function visual_map_print_item($mode = "read", $layoutData, else { if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 7e30d49215..0c11ba85a7 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -185,7 +185,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, include_javascript_dependencies_flot_graph(); $menu = (int)$menu; - + html_debug($legend); // Get a unique identifier to graph $graph_id = uniqid('graph_'); @@ -500,6 +500,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $short_data = false; } + // Javascript code $return .= ""; @@ -763,7 +763,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = } // Returns a 3D column chart -function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux, $background_color = 'white') { +function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux, $background_color = 'white', $tick_color = 'white') { global $config; include_javascript_dependencies_flot_graph(); @@ -847,14 +847,14 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon if ($from_ux) { if($from_wux){ - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color')"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color', '$tick_color')"; } else{ - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false, '$background_color')"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false, '$background_color', '$tick_color')"; } } else { - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color')"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color', '$tick_color')"; } $return .= ""; From 3de0e38c2dbf7d13da6d6bb3a9d1683c908447ab Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 8 Nov 2017 10:21:09 +0100 Subject: [PATCH 53/82] Added color to resume data --- .../reporting/visual_console_builder.editor.js | 10 ++++++++++ .../include/ajax/visual_console_builder.ajax.php | 8 ++++++++ pandora_console/include/functions_visual_map.php | 4 ++-- .../include/functions_visual_map_editor.php | 13 +++++++++++++ pandora_console/include/graphs/functions_d3.php | 4 ++-- pandora_console/include/graphs/pandora.d3.js | 5 +++-- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 8f18cd95af..f557647f8d 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -835,6 +835,7 @@ function readFields() { values['height_box'] = parseInt( $("input[name='height_box']").val()); values['border_color'] = $("input[name='border_color']").val(); + values['resume_color'] = $("input[name='resume_color']").val(); values['border_width'] = parseInt( $("input[name='border_width']").val()); values['fill_color'] = $("input[name='fill_color']").val(); @@ -1539,6 +1540,11 @@ function loadFieldsFromDB(item) { $("#border_color_row .ColorPickerDivSample") .css('background-color', val); } + if (key == 'resume_color') { + $("input[name='resume_color']").val(val); + $("#resume_color_row .ColorPickerDivSample") + .css('background-color', val); + } if (key == 'border_width') $("input[name='border_width']").val(val); if (key == 'fill_color') { @@ -1783,6 +1789,9 @@ function hiddenFields(item) { $("#border_color_row").css('display', 'none'); $("#border_color_row." + item).css('display', ''); + $("#resume_color_row").css('display', 'none'); + $("#resume_color_row." + item).css('display', ''); + $("#border_width_row").css('display', 'none'); $("#border_width_row." + item).css('display', ''); @@ -1835,6 +1844,7 @@ function cleanFields(item) { $("input[name='width_box']").val(300); $("input[name='height_box']").val(180); $("input[name='border_color']").val('#000000'); + $("input[name='resume_color']").val('#000000'); $("input[name='border_width']").val(3); $("input[name='fill_color']").val('#ffffff'); $("input[name='line_width']").val(3); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index fd34e3aff1..9e199d92e5 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -118,6 +118,7 @@ $id_group = (int)get_parameter('id_group', 0); $id_custom_graph = get_parameter('id_custom_graph', null); $border_width = (int)get_parameter('border_width', 0); $border_color = get_parameter('border_color', ''); +$resume_color = get_parameter('resume_color', ''); $fill_color = get_parameter('fill_color', ''); $percentile_color = get_parameter('percentile_color', ''); $percentile_label = io_safe_output(get_parameter('percentile_label', '')); @@ -607,6 +608,7 @@ switch ($action) { $values['width'] = $width_percentile; $values['height'] = $width_percentile; } + $values['border_color'] = $resume_color; $values['type'] = DONUT_GRAPH; break; @@ -739,6 +741,10 @@ switch ($action) { unset($values['image']); unset($values['type_graph']); break; + case 'donut_graph': + unset($values['border_color']); + unset($values['width']); + break; case 'box_item': unset($values['border_width']); unset($values['border_color']); @@ -882,6 +888,7 @@ switch ($action) { break; case 'donut_graph': $elementFields['width_percentile'] = $elementFields['width']; + $elementFields['resume_color'] = $elementFields['border_color']; break; case 'module_graph': @@ -1000,6 +1007,7 @@ switch ($action) { $values['type'] = DONUT_GRAPH; $values['width'] = $width; $values['height'] = $height; + $values['border_color'] = $resume_color; break; case 'module_graph': $values['type'] = MODULE_GRAPH; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 855501de7a..3c43771dce 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1436,10 +1436,10 @@ function visual_map_print_item($mode = "read", $layoutData, } else { if ($width == 0) { - $img = d3_donut_graph ($layoutData['id'], 400, 400, $donut_data); + $img = d3_donut_graph ($layoutData['id'], 400, 400, $donut_data, $layoutData['border_color']); } else{ - $img = d3_donut_graph ($layoutData['id'], $width, $width, $donut_data); + $img = d3_donut_graph ($layoutData['id'], $width, $width, $donut_data, $layoutData['border_color']); } } } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index c3e368a5d6..5bb5328fe5 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -319,6 +319,18 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { html_print_select(array(), 'module', '', '', __('Any'), 0, true) . ' '; + $form_items['resume_color_row'] = array(); + $form_items['resume_color_row']['items'] = array('donut_graph'); + $form_items['resume_color_row']['html'] = + '' . + __('Resume data color') . + '' . + '' . + html_print_input_text_extended ('resume_color', + '#000000', 'text-resume_color', '', 7, 7, false, + '', 'class="resume_color"', true) . + ''; + $event_times = array(86400 => __('24h'), 28800 => __('8h'), 7200 => __('2h'), @@ -645,6 +657,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $(".line_color").attachColorPicker(); $(".percentile_color").attachColorPicker(); $(".percentile_label_color").attachColorPicker(); + $(".resume_color").attachColorPicker(); $("input[name=radio_choice]").change(function(){ $('#count_items').html(1); diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index e4e53f2f1d..3a1cf73bbd 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -384,7 +384,7 @@ function progress_circular_bar_interior ($id, $percentile, $width, $height, $col return $output; } -function d3_donut_graph ($id, $width, $height, $module_data) { +function d3_donut_graph ($id, $width, $height, $module_data, $resume_color) { global $config; $module_data = json_encode($module_data); @@ -402,7 +402,7 @@ function d3_donut_graph ($id, $width, $height, $module_data) { "; $output .= ""; return $output; diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 1c2ab88b59..e60baa90d6 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -1972,7 +1972,7 @@ function print_interior_circular_progress_bar (recipient, percentile, width, hei })(); } -function print_donut_graph (recipient, width, height, module_data) { +function print_donut_graph (recipient, width, height, module_data, resume_color) { var svg = d3.select(recipient) .append("svg") .attr("width", width) @@ -2041,10 +2041,11 @@ function print_donut_graph (recipient, width, height, module_data) { .value(function(d) { return parseFloat(d.percent); }); - +console.log(resume_color); jQuery.each(module_data, function (key, m_d) { svg.append("g") .append("text") + .attr('fill', resume_color) .attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding))) + "," + (((height / 2) - radius) - increment_y) + ")") .text(m_d.tag_name) .style("font-family", "Verdana") From ab03a6b71ca9fe21a45e79e0eaaaa4cd70f2bda0 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 8 Nov 2017 10:37:15 +0100 Subject: [PATCH 54/82] Change the default number of ICMP packets and retries for ping modules. Ref pandora_enterprise#1562. --- pandora_server/conf/pandora_server.conf.new | 4 ++-- pandora_server/conf/pandora_server.conf.windows | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 3182f359e0..4c906c7eb6 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -161,10 +161,10 @@ network_threads 4 # that ping should be 1 to report 1. Setting this to 1 will make all icmp montioring faster but # with more probability of failure. -icmp_checks 3 +icmp_checks 1 # Number of ICMP packets to send per request. -icmp_packets 1 +icmp_packets 2 # tcp specific options : # tcp_checks: number of tcp retries if first attempt fails. diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index 94b764de40..a1429970b1 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -164,10 +164,10 @@ network_threads 5 # that ping should be 1 to report 1. Lower value have better performance, but more probability # of false positives -icmp_checks 3 +icmp_checks 1 # Number of ICMP packets to send per request. -icmp_packets 1 +icmp_packets 2 # tcp specific options : # tcp_checks: number of tcp retries if first attempt fails. From 1d7df38b61b8305db6bc226176c5837f4ce24b30 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Wed, 8 Nov 2017 11:55:23 +0100 Subject: [PATCH 55/82] Fixed entities in networkserver.pm --- pandora_server/lib/PandoraFMS/NetworkServer.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/NetworkServer.pm b/pandora_server/lib/PandoraFMS/NetworkServer.pm index 0901add896..f52b6e8a72 100644 --- a/pandora_server/lib/PandoraFMS/NetworkServer.pm +++ b/pandora_server/lib/PandoraFMS/NetworkServer.pm @@ -344,10 +344,10 @@ sub pandora_query_snmp ($$$$) { my $snmp_version = $module->{"tcp_send"}; # (1, 2, 2c or 3) my $snmp3_privacy_method = $module->{"custom_string_1"}; # DES/AES - my $snmp3_privacy_pass = pandora_output_password($pa_config, $module->{"custom_string_2"}); + my $snmp3_privacy_pass = safe_output(pandora_output_password($pa_config, $module->{"custom_string_2"})); my $snmp3_security_level = $module->{"custom_string_3"}; # noAuthNoPriv|authNoPriv|authPriv - my $snmp3_auth_user = $module->{"plugin_user"}; - my $snmp3_auth_pass = pandora_output_password($pa_config, $module->{"plugin_pass"}); + my $snmp3_auth_user = safe_output($module->{"plugin_user"}); + my $snmp3_auth_pass = safe_output(pandora_output_password($pa_config, $module->{"plugin_pass"})); my $snmp3_auth_method = $module->{"plugin_parameter"}; #MD5/SHA1 my $snmp_community = $module->{"snmp_community"}; my $snmp_target = $ip_target; @@ -412,7 +412,7 @@ sub pandora_query_snmp ($$$$) { if ($snmp3_security_level eq "authPriv"){ $snmp3_extra = " -a $snmp3_auth_method -u '$snmp3_auth_user' -A '$snmp3_auth_pass' -x $snmp3_privacy_method -X '$snmp3_privacy_pass' "; } - + $output = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra, $snmp_port, $pa_config); if (defined ($output) && $output ne ""){ $module_result = 0; From c9d1fab03690d85e5408cbdda60a121eb5f7d1d5 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 8 Nov 2017 12:49:03 +0100 Subject: [PATCH 56/82] Added new system of calculate status if user set a parent weight --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../visual_console_builder.editor.js | 7 ++ .../ajax/visual_console_builder.ajax.php | 12 +++- .../include/functions_visual_map.php | 67 ++++++++++++++++--- .../include/functions_visual_map_editor.php | 44 +++++++++++- pandora_console/pandoradb.sql | 1 + 6 files changed, 119 insertions(+), 13 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 159eb466f9..52299f75c9 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1239,6 +1239,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF'; ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down'; ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index ebd2427ce3..8adb70be5f 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -815,6 +815,7 @@ function readFields() { values['bars_graph_type'] = $("select[name=bars_graph_type]").val(); values['parent'] = $("select[name=parent]").val(); values['map_linked'] = $("select[name=map_linked]").val(); + values['map_linked_weight'] = $("select[name=map_linked_weight]").val(); values['width_percentile'] = $("input[name=width_percentile]").val(); values['max_percentile'] = parseInt($("input[name=max_percentile]").val()); values['width_module_graph'] = $("input[name=width_module_graph]").val(); @@ -1489,6 +1490,8 @@ function loadFieldsFromDB(item) { $("select[name=parent]").val(val); if (key == 'id_layout_linked') $("select[name=map_linked]").val(val); + if (key == 'id_layout_linked_weight') + $("select[name=map_linked_weight]").val(val); if (key == 'width_percentile') $("input[name=width_percentile]").val(val); if (key == 'max_percentile') @@ -1771,6 +1774,9 @@ function hiddenFields(item) { $("#map_linked_row").css('display', 'none'); $("#map_linked_row." + item).css('display', ''); + $("#map_linked_weight").css('display', 'none'); + $("#map_linked_weight." + item).css('display', ''); + $("#module_graph_size_row").css('display', 'none'); $("#module_graph_size_row." + item).css('display', ''); @@ -1848,6 +1854,7 @@ function cleanFields(item) { $("input[name=height]").val(0); $("select[name=parent]").val(''); $("select[name=map_linked]").val(''); + $("select[name=map_linked_weight]").val(''); $("input[name=width_module_graph]").val(300); $("input[name=height_module_graph]").val(180); $("input[name='width_box']").val(300); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index c7e4484a27..33044a53fd 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -100,6 +100,7 @@ $width = get_parameter('width', null); $height = get_parameter('height', null); $parent = get_parameter('parent', null); $map_linked = get_parameter('map_linked', null); +$map_linked_weight = get_parameter('map_linked_weight', null); $width_percentile = get_parameter('width_percentile', null); $max_percentile = get_parameter('max_percentile', null); $height_module_graph = get_parameter('height_module_graph', null); @@ -378,7 +379,7 @@ switch ($action) { // Linked to other layout ?? - Only if not module defined if ($layoutData['id_layout_linked'] != 0) { - $status = visual_map_get_layout_status ($layoutData['id_layout_linked']); + $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], $layoutData['id_layout_linked_weight']); // Single object } @@ -552,8 +553,6 @@ switch ($action) { break; } - - if (defined('METACONSOLE') && $metaconsole) { if ($server_name !== null) { $values['id_metaconsole'] = db_get_value('id', @@ -568,6 +567,9 @@ switch ($action) { $values['id_agent'] = $id_agent; } } + else if ($id_agent == 0) { + $values['id_agent'] = 0; + } else if (!empty($id_agent)) { $values['id_agent'] = $id_agent; } @@ -584,6 +586,9 @@ switch ($action) { if ($map_linked !== null) { $values['id_layout_linked'] = $map_linked; } + if ($map_linked_weight !== null) { + $values['id_layout_linked_weight'] = $map_linked_weight; + } switch ($type) { // -- line_item ------------------------------------ case 'handler_start': @@ -982,6 +987,7 @@ switch ($action) { } $values['id_agente_modulo'] = $id_module; $values['id_layout_linked'] = $map_linked; + $values['id_layout_linked_weight'] = $map_linked_weight; $values['parent_item'] = $parent; $values['enable_link'] = $enable_link; $values['image'] = $background_color; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f6293d8743..9388356be4 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -2923,7 +2923,26 @@ function visual_map_get_status_element($layoutData) { //Linked to other layout ?? - Only if not module defined if ($layoutData['id_layout_linked'] != 0) { - $status = visual_map_get_layout_status ($layoutData['id_layout_linked']); + if ($layoutData['id_layout_linked_weight'] != 0) { + $calculate_weight = true; + } + else { + $calculate_weight = false; + } + $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], 0, 0, $calculate_weight); + + if ($layoutData['id_layout_linked_weight'] > 0) { + $elements_to_compare = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $layoutData['id_layout_linked']); + + $aux_weight = ($status['elements_in_critical'] / count($elements_to_compare)) * 100; + + if ($aux_weight >= $layoutData['id_layout_linked_weight']) { + $status = $status['temp_total']; + } + else { + $status = VISUAL_MAP_STATUS_NORMAL; + } + } } else { switch ($layoutData["type"]) { @@ -3367,7 +3386,7 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter * * @return bool The status of the given layout. True if it's OK, false if not. */ -function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { +function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_critical = 0, $calculate_weight = false) { $temp_status = VISUAL_MAP_STATUS_NORMAL; $temp_total = VISUAL_MAP_STATUS_NORMAL; $depth++; // For recursion depth checking @@ -3387,7 +3406,10 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { 'parent_item', 'id_layout_linked', 'id_agent', - 'type')); + 'type', + 'id_layout_linked_weight', + 'id', + 'id_layout')); if ($result === false) return VISUAL_MAP_STATUS_NORMAL; @@ -3429,12 +3451,29 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { // Other Layout (Recursive!) if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { - $status = visual_map_get_layout_status($data["id_layout_linked"], $depth); + if ($data['id_layout_linked_weight'] > 0) { + $calculate_weight_c = true; + } + else { + $calculate_weight_c = false; + } + $status = visual_map_get_layout_status($data["id_layout_linked"], $depth, 0, $calculate_weight_c); + + $elements_in_child = db_get_all_rows_sql("SELECT id FROM tlayout_data WHERE type = 0 AND id_layout = " . $data['id_layout_linked']); + if ($calculate_weight_c) { + $aux_weight = ($status['elements_in_critical'] / count($elements_in_child)) * 100; + + if ($aux_weight >= $data['id_layout_linked_weight']) { + $status = $status['temp_total']; + } + else { + $status = VISUAL_MAP_STATUS_NORMAL; + } + } } // Module elseif ($data["id_agente_modulo"] != 0) { $status = modules_get_agentmodule_status($data["id_agente_modulo"]); - } // Agent else { @@ -3448,11 +3487,23 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { break; } - if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) - return VISUAL_MAP_STATUS_CRITICAL_BAD; + if ($calculate_weight) { + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD || $status == VISUAL_MAP_STATUS_WARNING) { + $elements_in_critical++; + } + } + else { + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) { + return VISUAL_MAP_STATUS_CRITICAL_BAD; + } - if ($status > $temp_total) + } + if ($status > $temp_total) { $temp_total = $status; + } + } + if ($calculate_weight) { + return array('elements_in_critical' => $elements_in_critical, 'temp_total' => $temp_total); } return $temp_total; diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 513c6ccc32..48f13e3022 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -621,11 +621,37 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) . ''; + $form_items_advance['map_linked_weight'] = array(); + $form_items_advance['map_linked_weight']['items'] = array('static_graph'); + $form_items_advance['map_linked_weight']['html'] = ''. + __('Map linked weight') . '' . + '' . html_print_select(array('10' => '10%', + '20' => '20%', + '30' => '30%', + '40' => '40%', + '50' => '50%', + '60' => '60%', + '70' => '70%', + '80' => '80%', + '90' => '90%', + '100' => '100%'), + 'map_linked_weight', '', '', __('By default'), 0, true) . + ui_print_help_tip ( + __("This percentage value specifies the number of items that must be present in the visual + console for it to transmit its status to the icon linked here. For example, if 20% is + specified and there are five elements in the console, it would be enough if you were in + WARNING or CRITICAL to pass that value to the icon. If it were 40%, you would need at + least two elements to be in CRITICAL or WARNING to go into that status. If it had one + element in critical and another in warning, it would not forward any status to the icon + associated with the visual console. If we had three in warning and one in critical, + it would only convey the warning status. If there were two in warning and two in critical, + it would show the CRITICAL because it is more serious. The same applies to unknown status."), true) . + ''; + $form_items_advance['line_case']['items'] = array('line_item'); $form_items_advance['line_case']['html'] = ' ' . __('Lines haven\'t advanced options') . ''; - //Insert and modify before the buttons to create or update. if (enterprise_installed()) { enterprise_visual_map_editor_modify_form_items_advance_palette($form_items_advance); @@ -806,4 +832,18 @@ function visual_map_editor_print_hack_translate_strings() { echo ''; } -?> \ No newline at end of file +?> + + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 28fb2575cf..3a7210560f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1362,6 +1362,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` ( `border_color` varchar(200) DEFAULT "", `fill_color` varchar(200) DEFAULT "", `show_statistics` tinyint(2) NOT NULL default '0', + `id_layout_linked_weight` int(10) NOT NULL default '0', PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From ef8b69841ca4c1d03d4e5395ee45c3ee66b1b0f0 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 8 Nov 2017 15:30:28 +0100 Subject: [PATCH 57/82] Updated version and build strings. --- pandora_agents/pc/AIX/pandora_agent.conf | 2 +- pandora_agents/pc/FreeBSD/pandora_agent.conf | 2 +- pandora_agents/pc/HP-UX/pandora_agent.conf | 2 +- pandora_agents/pc/Linux/pandora_agent.conf | 2 +- pandora_agents/pc/NT4/pandora_agent.conf | 2 +- pandora_agents/pc/SunOS/pandora_agent.conf | 2 +- pandora_agents/pc/Win32/pandora_agent.conf | 2 +- pandora_agents/shellscript/aix/pandora_agent.conf | 2 +- pandora_agents/shellscript/bsd-ipso/pandora_agent.conf | 2 +- pandora_agents/shellscript/hp-ux/pandora_agent.conf | 2 +- pandora_agents/shellscript/linux/pandora_agent.conf | 2 +- pandora_agents/shellscript/mac_osx/pandora_agent.conf | 2 +- pandora_agents/shellscript/openWRT/pandora_agent.conf | 2 +- pandora_agents/shellscript/solaris/pandora_agent.conf | 2 +- pandora_agents/unix/AIX/pandora_agent.conf | 2 +- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/Darwin/pandora_agent.conf | 2 +- pandora_agents/unix/FreeBSD/pandora_agent.conf | 2 +- pandora_agents/unix/HP-UX/pandora_agent.conf | 2 +- pandora_agents/unix/Linux/pandora_agent.conf | 2 +- pandora_agents/unix/NT4/pandora_agent.conf | 2 +- pandora_agents/unix/NetBSD/pandora_agent.conf | 2 +- pandora_agents/unix/SunOS/pandora_agent.conf | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 4 ++-- pandora_agents/unix/pandora_agent.spec | 4 ++-- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/bin/pandora_agent.conf | 2 +- pandora_agents/win32/installer/pandora.mpi | 4 ++-- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 4 ++-- pandora_console/pandora_console.spec | 4 ++-- pandora_console/pandora_console_install | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/conf/pandora_server.conf.new | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 4 ++-- pandora_server/pandora_server.spec | 4 ++-- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 49 files changed, 56 insertions(+), 56 deletions(-) diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index a22cebc516..c4a017d5df 100644 --- a/pandora_agents/pc/AIX/pandora_agent.conf +++ b/pandora_agents/pc/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, AIX version +# Version 7.0NG.715, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index 18e8a21aad..66ed797d78 100644 --- a/pandora_agents/pc/FreeBSD/pandora_agent.conf +++ b/pandora_agents/pc/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, FreeBSD Version +# Version 7.0NG.715, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf index 19c970f98a..876222a5eb 100644 --- a/pandora_agents/pc/HP-UX/pandora_agent.conf +++ b/pandora_agents/pc/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, HP-UX Version +# Version 7.0NG.715, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index c777a2e7fb..1ab6555ce5 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.715, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf index 749548f2c0..d308a01e8e 100644 --- a/pandora_agents/pc/NT4/pandora_agent.conf +++ b/pandora_agents/pc/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.715, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/SunOS/pandora_agent.conf b/pandora_agents/pc/SunOS/pandora_agent.conf index bb83684a4d..514782e164 100644 --- a/pandora_agents/pc/SunOS/pandora_agent.conf +++ b/pandora_agents/pc/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, Solaris Version +# Version 7.0NG.715, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index 49c1784938..8479b4515f 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2010 Artica Soluciones Tecnologicas -# Version 7.0NG.714 +# Version 7.0NG.715 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 4387ba2911..53c491e3c4 100644 --- a/pandora_agents/shellscript/aix/pandora_agent.conf +++ b/pandora_agents/shellscript/aix/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.714, AIX version +# Version 7.0NG.715, AIX version # General Parameters # ================== diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf index aa89be6fcc..e5c7738542 100644 --- a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf +++ b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.714 +# Version 7.0NG.715 # FreeBSD/IPSO version # Licenced under GPL licence, 2003-2007 Sancho Lerena diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf index 12bcbc5beb..8f8c2febdf 100644 --- a/pandora_agents/shellscript/hp-ux/pandora_agent.conf +++ b/pandora_agents/shellscript/hp-ux/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.714, HPUX Version +# Version 7.0NG.715, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index 1038178d4b..25712c4d7c 100644 --- a/pandora_agents/shellscript/linux/pandora_agent.conf +++ b/pandora_agents/shellscript/linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714 +# Version 7.0NG.715 # Licensed under GPL license v2, # (c) 2003-2010 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index da27975054..7a8f736c41 100644 --- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf +++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714 +# Version 7.0NG.715 # Licensed under GPL license v2, # (c) 2003-2009 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf index 06f42c5dba..8a33853ae5 100644 --- a/pandora_agents/shellscript/openWRT/pandora_agent.conf +++ b/pandora_agents/shellscript/openWRT/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714 +# Version 7.0NG.715 # Licensed under GPL license v2, # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf index 2c75ad952e..ba1d866ed2 100644 --- a/pandora_agents/shellscript/solaris/pandora_agent.conf +++ b/pandora_agents/shellscript/solaris/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.714, Solaris version +# Version 7.0NG.715, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index d80b2d00e2..bb75e5f95b 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, AIX version +# Version 7.0NG.715, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index daccc434bd..7e9d6536d0 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.714-171108 +Version: 7.0NG.715 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 d727d0377e..b42638ea99 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="7.0NG.714-171108" +pandora_version="7.0NG.715" 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/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 723b17232c..aaf29acb8f 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.715, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index 8a8ecd3451..817432efa6 100644 --- a/pandora_agents/unix/FreeBSD/pandora_agent.conf +++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, FreeBSD Version +# Version 7.0NG.715, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index f31d7e6cd0..d0f28e9943 100644 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, HP-UX Version +# Version 7.0NG.715, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 59ea7ed59d..d9876734df 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.715, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NT4/pandora_agent.conf b/pandora_agents/unix/NT4/pandora_agent.conf index ee6b7bb18d..c4665aaa94 100644 --- a/pandora_agents/unix/NT4/pandora_agent.conf +++ b/pandora_agents/unix/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.715, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf index aa64beba39..8100e76026 100644 --- a/pandora_agents/unix/NetBSD/pandora_agent.conf +++ b/pandora_agents/unix/NetBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, NetBSD Version +# Version 7.0NG.715, NetBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index 3dada142de..9a5432057a 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, Solaris Version +# Version 7.0NG.715, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 4ccfaa89f7..a8b1c316db 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -40,7 +40,7 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.714'; +use constant AGENT_VERSION => '7.0NG.715'; use constant AGENT_BUILD => '171108'; # Agent log default file size maximum and instances diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 5fe112e1dd..d609310d12 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.714 -%define release 171108 +%define version 7.0NG.715 +%define release 1 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 128fdceb58..cafc0d22c5 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.714 -%define release 171108 +%define version 7.0NG.715 +%define release 1 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 1ef999277a..b84b49dc03 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -9,7 +9,7 @@ # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.714" +PI_VERSION="7.0NG.715" PI_BUILD="171108" OS_NAME=`uname -s` diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index c8c32e84d0..90626fedbc 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2014 Artica Soluciones Tecnologicas -# Version 7.0NG.714 +# Version 7.0NG.715 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 24984522e9..9f0520f340 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -3,7 +3,7 @@ AllowLanguageSelection {Yes} AppName -{Pandora FMS Windows Agent v7.0NG.714} +{Pandora FMS Windows Agent v7.0NG.715} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives {No} Windows,Executable -{<%AppName%>-<%Version%>-Setup<%Ext%>} +{<%AppName%>-Setup<%Ext%>} Windows,FileDescription {<%AppName%> <%Version%> Setup} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9d136fc312..720ae1e064 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 ("7.0NG.714(Build 171108)") +#define PANDORA_VERSION ("7.0NG.715(Build 171108)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 21eb06f7bb..ba68b622b5 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", "(7.0NG.714(Build 171108))" + VALUE "ProductVersion", "(7.0NG.715(Build 171108))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 5d2e45981a..61e62da0f6 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.714-171108 +Version: 7.0NG.715 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 a37386ec16..16b0a24510 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="7.0NG.714-171108" +pandora_version="7.0NG.715" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 91ac462fd4..4e9f4bc4f4 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -23,7 +23,7 @@ * Pandora build version and version */ $build_version = 'PC171108'; -$pandora_version = 'v7.0NG.714'; +$pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. $script_tz = @date_default_timezone_get(); diff --git a/pandora_console/install.php b/pandora_console/install.php index 238e469d67..3765fd144f 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -70,7 +70,7 @@
Date: Wed, 8 Nov 2017 18:57:37 +0100 Subject: [PATCH 58/82] fixed errors in TIP --- pandora_console/include/functions_db.php | 73 +++++++++++++++++------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index a156538b9a..eac5299982 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -481,9 +481,6 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d } } - - - /** * * Returns the time the module is in unknown status (by events) @@ -514,7 +511,6 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend return false; } - // Retrieve going unknown events in range $query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo; $query .= " AND event_type like 'going_%' "; @@ -527,7 +523,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend return false; } - $last_status = 0; // normal + $last_status = $events[0]["event_type"] != "going_unknown" ? 1:0; $return = array(); $i=0; foreach ($events as $event) { @@ -555,6 +551,9 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend } } } + if(!isset($return[0])){ + return false; + } return $return; } @@ -573,6 +572,16 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend * * Note: All "unknown" data are marked as NULL * Warning: Be careful with the amount of data, check your RAM size available + * We'll return a bidimensional array + * Structure returned: schema: + * + * uncompressed_data => + * pool_id (int) + * utimestamp (start of current slice) + * data + * array + * datos + * utimestamp * */ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) { @@ -619,6 +628,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f $query .= " AND utimestamp=" . $first_utimestamp; $data = db_get_all_rows_sql($query,$search_historydb); + if ($data === false) { // first utimestamp not found in active database // SEARCH HISTORY DB @@ -643,7 +653,9 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f // Retrieve all data from module in given range $raw_data = db_get_all_rows_sql($query, $search_historydb); - if (($raw_data === false) && ($first_utimestamp === $tstart)) { + $module_interval = modules_get_interval ($id_agente_modulo); + + if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) { // No data return false; } @@ -651,28 +663,45 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f // Retrieve going unknown events in range $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb); - // Retrieve module_interval to build the template - $module_interval = modules_get_interval ($id_agente_modulo); - $slice_size = $module_interval; + $previous_unknown_events = db_get_module_ranges_unknown( + $id_agente_modulo, + $tstart - (SECONDS_1DAY + 2*$module_interval), + $tstart, + $search_historydb + ); - // We'll return a bidimensional array - // Structure returned: schema: - // - // uncompressed_data => - // pool_id (int) - // utimestamp (start of current slice) - // data - // array - // utimestamp - // datos + //don't show graph if graph is inside unknown + if( $previous_unknown_events && + !isset($previous_unknown_events[count($previous_unknown_events) -1]['time_to']) && + $unknown_events === false && $raw_data === false){ + return false; + } + + //if time to is missing in last event force time to outside range time + if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){ + $unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval; + } + + //if time to is missing in first event force time to outside range time + if ($first_data["datos"] === false) { + $last_inserted_value = false; + }elseif( $unknown_events && !isset($unknown_events[0]['time_from']) || + $first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) ){ + $last_inserted_value = null; + } + else{ + $last_inserted_value = $first_data["datos"]; + } + + // Retrieve module_interval to build the template + $slice_size = $module_interval; $return = array(); // Point current_timestamp to begin of the set and initialize flags $current_timestamp = $tstart; - $last_inserted_value = $first_data["datos"]; $last_timestamp = $first_data["utimestamp"]; - $last_value = $first_data["datos"]; + $last_value = $first_data["datos"]; // Build template $pool_id = 0; @@ -732,7 +761,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f ($current_timestamp_end >= $current_unknown['time_from']) ) || ($current_timestamp_end >= $current_unknown['time_to']) ) ) { - if( ( $current_timestamp < $current_unknown['time_from']) && + if( ( $current_timestamp <= $current_unknown['time_from']) && ( $current_timestamp_end >= $current_unknown['time_from'] ) ){ // Add unknown state detected $tmp_data["utimestamp"] = $current_unknown["time_from"]; From f512bea6106a38087fd751a4a198c939824d45fc Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 9 Nov 2017 00:01:13 +0100 Subject: [PATCH 59/82] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 4 ++-- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 7e9d6536d0..d819dcfd37 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715 +Version: 7.0NG.715-171109 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 b42638ea99..0d1258c9d5 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="7.0NG.715" +pandora_version="7.0NG.715-171109" 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 a8b1c316db..fd9ff4383d 100755 --- 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 => '7.0NG.715'; -use constant AGENT_BUILD => '171108'; +use constant AGENT_BUILD => '171109'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index d609310d12..5bf4f2dce6 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 7.0NG.715 -%define release 1 +%define release 171109 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 cafc0d22c5..bed96f3418 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 7.0NG.715 -%define release 1 +%define release 171109 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 b84b49dc03..09ae36c5db 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171108" +PI_BUILD="171109" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 9f0520f340..b8c7878567 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171108} +{171109} ViewReadme {Yes} @@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives {No} Windows,Executable -{<%AppName%>-Setup<%Ext%>} +{<%AppName%>-<%Version%>-Setup<%Ext%>} Windows,FileDescription {<%AppName%> <%Version%> Setup} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 720ae1e064..49b484b932 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 ("7.0NG.715(Build 171108)") +#define PANDORA_VERSION ("7.0NG.715(Build 171109)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index ba68b622b5..82d07c3371 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", "(7.0NG.715(Build 171108))" + VALUE "ProductVersion", "(7.0NG.715(Build 171109))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 61e62da0f6..ada8fc0134 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715 +Version: 7.0NG.715-171109 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 16b0a24510..081a3ea439 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="7.0NG.715" +pandora_version="7.0NG.715-171109" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4e9f4bc4f4..1542a7e084 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 = 'PC171108'; +$build_version = 'PC171109'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 3765fd144f..275a59a284 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Fri, 10 Nov 2017 00:01:09 +0100 Subject: [PATCH 60/82] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index d819dcfd37..48192919a2 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171109 +Version: 7.0NG.715-171110 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 0d1258c9d5..1b335438a9 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="7.0NG.715-171109" +pandora_version="7.0NG.715-171110" 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 fd9ff4383d..a5743df259 100755 --- 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 => '7.0NG.715'; -use constant AGENT_BUILD => '171109'; +use constant AGENT_BUILD => '171110'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 5bf4f2dce6..7071e4655d 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 7.0NG.715 -%define release 171109 +%define release 171110 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 bed96f3418..a3ce74230c 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 7.0NG.715 -%define release 171109 +%define release 171110 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 09ae36c5db..e75fffdc2b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171109" +PI_BUILD="171110" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index b8c7878567..1269e3108d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171109} +{171110} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 49b484b932..80142ca894 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 ("7.0NG.715(Build 171109)") +#define PANDORA_VERSION ("7.0NG.715(Build 171110)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 82d07c3371..5d9e664a8f 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", "(7.0NG.715(Build 171109))" + VALUE "ProductVersion", "(7.0NG.715(Build 171110))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ada8fc0134..fe0cfc6bdc 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171109 +Version: 7.0NG.715-171110 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 081a3ea439..b80b89eccd 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="7.0NG.715-171109" +pandora_version="7.0NG.715-171110" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1542a7e084..7a81d1d4f7 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 = 'PC171109'; +$build_version = 'PC171110'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 275a59a284..53b50bb05a 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Fri, 10 Nov 2017 09:33:12 +0100 Subject: [PATCH 61/82] Added changes to fix ldap login --- pandora_console/include/auth/mysql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 69f31d2bd1..372f9dfc58 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -693,10 +693,10 @@ function ldap_process_user_login ($login, $password) { } } - $dc = $config["ldap_base_dn"]; + $dc = io_safe_output($config["ldap_base_dn"]); #Search group of this user it belong. - $filter="(" . $config['ldap_login_attr'] . io_safe_output($login) . ")"; + $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")"; $justthese = array("objectclass=group"); $sr = ldap_search($ds, $dc, $filter, $justthese); From 555dc3744dded3a3fabfc4a59a9bcba55be33806 Mon Sep 17 00:00:00 2001 From: vgilc Date: Fri, 10 Nov 2017 12:24:01 +0100 Subject: [PATCH 62/82] =?UTF-8?q?Revert=20"Merge=20branch=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts merge request !1045 --- pandora_console/include/functions_db.php | 71 +++++++----------------- 1 file changed, 21 insertions(+), 50 deletions(-) diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index eac5299982..a156538b9a 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -481,6 +481,9 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d } } + + + /** * * Returns the time the module is in unknown status (by events) @@ -511,6 +514,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend return false; } + // Retrieve going unknown events in range $query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo; $query .= " AND event_type like 'going_%' "; @@ -523,7 +527,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend return false; } - $last_status = $events[0]["event_type"] != "going_unknown" ? 1:0; + $last_status = 0; // normal $return = array(); $i=0; foreach ($events as $event) { @@ -551,9 +555,6 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend } } } - if(!isset($return[0])){ - return false; - } return $return; } @@ -572,16 +573,6 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend * * Note: All "unknown" data are marked as NULL * Warning: Be careful with the amount of data, check your RAM size available - * We'll return a bidimensional array - * Structure returned: schema: - * - * uncompressed_data => - * pool_id (int) - * utimestamp (start of current slice) - * data - * array - * datos - * utimestamp * */ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) { @@ -628,7 +619,6 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f $query .= " AND utimestamp=" . $first_utimestamp; $data = db_get_all_rows_sql($query,$search_historydb); - if ($data === false) { // first utimestamp not found in active database // SEARCH HISTORY DB @@ -653,9 +643,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f // Retrieve all data from module in given range $raw_data = db_get_all_rows_sql($query, $search_historydb); - $module_interval = modules_get_interval ($id_agente_modulo); - - if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) { + if (($raw_data === false) && ($first_utimestamp === $tstart)) { // No data return false; } @@ -663,45 +651,28 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f // Retrieve going unknown events in range $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb); - $previous_unknown_events = db_get_module_ranges_unknown( - $id_agente_modulo, - $tstart - (SECONDS_1DAY + 2*$module_interval), - $tstart, - $search_historydb - ); - - //don't show graph if graph is inside unknown - if( $previous_unknown_events && - !isset($previous_unknown_events[count($previous_unknown_events) -1]['time_to']) && - $unknown_events === false && $raw_data === false){ - return false; - } - - //if time to is missing in last event force time to outside range time - if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){ - $unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval; - } - - //if time to is missing in first event force time to outside range time - if ($first_data["datos"] === false) { - $last_inserted_value = false; - }elseif( $unknown_events && !isset($unknown_events[0]['time_from']) || - $first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) ){ - $last_inserted_value = null; - } - else{ - $last_inserted_value = $first_data["datos"]; - } - // Retrieve module_interval to build the template + $module_interval = modules_get_interval ($id_agente_modulo); $slice_size = $module_interval; + // We'll return a bidimensional array + // Structure returned: schema: + // + // uncompressed_data => + // pool_id (int) + // utimestamp (start of current slice) + // data + // array + // utimestamp + // datos + $return = array(); // Point current_timestamp to begin of the set and initialize flags $current_timestamp = $tstart; + $last_inserted_value = $first_data["datos"]; $last_timestamp = $first_data["utimestamp"]; - $last_value = $first_data["datos"]; + $last_value = $first_data["datos"]; // Build template $pool_id = 0; @@ -761,7 +732,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f ($current_timestamp_end >= $current_unknown['time_from']) ) || ($current_timestamp_end >= $current_unknown['time_to']) ) ) { - if( ( $current_timestamp <= $current_unknown['time_from']) && + if( ( $current_timestamp < $current_unknown['time_from']) && ( $current_timestamp_end >= $current_unknown['time_from'] ) ){ // Add unknown state detected $tmp_data["utimestamp"] = $current_unknown["time_from"]; From 68a10343fbd292d02ea19e8530a4d9f26edaf5d0 Mon Sep 17 00:00:00 2001 From: vgilc Date: Fri, 10 Nov 2017 12:24:33 +0100 Subject: [PATCH 63/82] =?UTF-8?q?Revert=20"Merge=20branch=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts merge request !1025 --- pandora_console/include/ajax/events.php | 11 +- pandora_console/include/db/mysql.php | 4 +- pandora_console/include/functions_db.php | 345 +++++++++++------- pandora_console/include/functions_graph.php | 337 ++++++++--------- pandora_console/include/functions_modules.php | 83 ++--- .../include/graphs/flot/pandora.flot.js | 20 +- .../operation/agentes/stat_win.php | 17 +- 7 files changed, 464 insertions(+), 353 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index d431a83dd7..cad5efae1a 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -478,13 +478,10 @@ if ($get_extended_event) { if ($get_events_details) { $event_ids = explode(',',get_parameter ('event_ids')); - $events = db_get_all_rows_filter ( - 'tevento', - array ('id_evento' => $event_ids,'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'), - 'AND', - true - ); + $events = db_get_all_rows_filter ('tevento', + array ('id_evento' => $event_ids, + 'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario')); $out = ''; $out .= ''; diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index 7101f960de..7da9316c65 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -738,7 +738,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) { * * @return mixed Array of the row or false in case of error. */ -function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) { +function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND') { if (empty ($fields)) { $fields = '*'; } @@ -758,7 +758,7 @@ function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join $sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter); - return db_get_row_sql ($sql, $historydb); + return db_get_row_sql ($sql); } /** diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index a156538b9a..06c85ef194 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -416,12 +416,12 @@ function db_get_row ($table, $field_search, $condition, $fields = false) { * * @return mixed Array of the row or false in case of error. */ -function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) { +function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND') { global $config; switch ($config["dbtype"]) { case "mysql": - return mysql_db_get_row_filter($table, $filter, $fields, $where_join, $historydb); + return mysql_db_get_row_filter($table, $filter, $fields, $where_join); break; case "postgresql": return postgresql_db_get_row_filter($table, $filter, $fields, $where_join); @@ -493,7 +493,7 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d * @param int $tend end of search * */ -function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false, $historydb = false) { +function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) { global $config; if (!isset($id_agente_modulo)) { @@ -521,7 +521,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend $query .= " AND utimestamp >= $tstart AND utimestamp <= $tend "; $query .= " ORDER BY utimestamp ASC"; - $events = db_get_all_rows_sql($query, $historydb); + $events = db_get_all_rows_sql($query); if (! is_array($events)){ return false; @@ -582,6 +582,17 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f return false; } + if ((!isset($tstart)) || ($tstart === false)) { + // Return data from the begining + // Get first available utimestamp in active DB + $query_first_man_time = " SELECT utimestamp FROM tagente_datos "; + $query_first_man_time .= " WHERE id_agente_modulo = $id_agente_modulo"; + $query_first_man_time .= " ORDER BY utimestamp ASC LIMIT 1"; + + $first_man_time = db_get_all_rows_sql( $query_first_man_time, false); + $tstart = $first_man_time[0]['utimestamp']; + } + if ((!isset($tend)) || ($tend === false)) { // Return data until now $tend = time(); @@ -605,51 +616,53 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f $table = "tagente_datos_string"; } - $result = modules_get_first_date($id_agente_modulo,$tstart); - $first_utimestamp = $result["first_utimestamp"]; - $search_historydb = $result["search_historydb"]; + // Get first available utimestamp in active DB + $query = " SELECT utimestamp, datos FROM $table "; + $query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart"; + $query .= " ORDER BY utimestamp DESC LIMIT 1"; - if ($first_utimestamp === false) { - $first_data["utimestamp"] = $tstart; + $ret = db_get_all_rows_sql( $query , $search_historydb); + + if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) { + // Value older than first retrieved from active DB + $search_historydb = true; + + $ret = db_get_all_rows_sql( $query , $search_historydb); + + if ($ret) { + $tstart = $ret[0]["utimestamp"]; + } + } + else { + $first_data["utimestamp"] = $ret[0]["utimestamp"]; + $first_data["datos"] = $ret[0]["datos"]; + } + + if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) { + // No previous data. -> not init + // Avoid false unknown status + $first_data["utimestamp"] = time(); $first_data["datos"] = false; } else { - $query = "SELECT datos,utimestamp FROM $table "; - $query .= " WHERE id_agente_modulo=$id_agente_modulo "; - $query .= " AND utimestamp=" . $first_utimestamp; - - $data = db_get_all_rows_sql($query,$search_historydb); - if ($data === false) { - // first utimestamp not found in active database - // SEARCH HISTORY DB - $search_historydb = true; - $data = db_get_all_rows_sql($query,$search_historydb); - } - - if ($data === false) { // Not init - $first_data["utimestamp"] = $tstart; - $first_data["datos"] = false; - } - else { - $first_data["utimestamp"] = $data[0]["utimestamp"]; - $first_data["datos"] = $data[0]["datos"]; - - } + $first_data["utimestamp"] = $ret[0]["utimestamp"]; + $first_data["datos"] = $ret[0]["datos"]; } $query = " SELECT utimestamp, datos FROM $table "; $query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend"; $query .= " ORDER BY utimestamp ASC"; + // Retrieve all data from module in given range $raw_data = db_get_all_rows_sql($query, $search_historydb); - if (($raw_data === false) && ($first_utimestamp === $tstart)) { + if (($raw_data === false) && ($ret === false)) { // No data return false; } // Retrieve going unknown events in range - $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb); + $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend); // Retrieve module_interval to build the template $module_interval = modules_get_interval ($id_agente_modulo); @@ -672,115 +685,197 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f $current_timestamp = $tstart; $last_inserted_value = $first_data["datos"]; $last_timestamp = $first_data["utimestamp"]; - $last_value = $first_data["datos"]; + $data_found = 0; // Build template $pool_id = 0; $now = time(); - $current_unknown = array_shift($unknown_events); - $current_raw_data = array_shift($raw_data); - + $in_unknown_status = 0; + if (is_array($unknown_events)) { + $current_unknown = array_shift($unknown_events); + } while ( $current_timestamp < $tend ) { + $expected_data_generated = 0; + $return[$pool_id]["data"] = array(); $tmp_data = array(); - $current_timestamp_end = $current_timestamp + $slice_size; + $data_found = 0; - if ( ( $current_timestamp > $now) || - ( ($current_timestamp_end - $last_timestamp) > - (SECONDS_1DAY + 2*$module_interval) ) ) { - $tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2*$module_interval; - - //check not init - $tmp_data["datos"] = $last_value === false ? false : null; - - // debug purpose - //$tmp_data["obs"] = "unknown extra"; - array_push($return[$pool_id]["data"], $tmp_data); - } - - //insert first slice data - $tmp_data["utimestamp"] = $current_timestamp; - $tmp_data["datos"] = $last_inserted_value; - // debug purpose - //$tmp_data["obs"] = "virtual data"; - - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - - //insert raw data - while ( ($current_raw_data != null) && - ( ($current_timestamp_end >= $current_raw_data['utimestamp']) && - ($current_timestamp < $current_raw_data['utimestamp']) ) ) { - - // Add unknown state detected - $tmp_data["utimestamp"] = $current_raw_data["utimestamp"]; - $tmp_data["datos"] = $current_raw_data["datos"]; - // debug purpose - //$tmp_data["obs"] = "real data"; - array_push($return[$pool_id]["data"], $tmp_data); - - $last_value = $current_raw_data["datos"]; - $last_timestamp = $current_raw_data["utimestamp"]; - $current_raw_data = array_shift($raw_data); - } - - //unknown - $data_slices = $return[$pool_id]["data"]; - while ( ($current_unknown != null) && - ( ( ($current_unknown['time_from'] != null) && - ($current_timestamp_end >= $current_unknown['time_from']) ) || - ($current_timestamp_end >= $current_unknown['time_to']) ) ) { - - if( ( $current_timestamp < $current_unknown['time_from']) && - ( $current_timestamp_end >= $current_unknown['time_from'] ) ){ - // Add unknown state detected - $tmp_data["utimestamp"] = $current_unknown["time_from"]; - $tmp_data["datos"] = null; - // debug purpose - //$tmp_data["obs"] = "event data unknown from"; - array_push($return[$pool_id]["data"], $tmp_data); - $current_unknown["time_from"] = null; - } - - if( ($current_timestamp < $current_unknown['time_to']) && - ($current_timestamp_end >= $current_unknown['time_to'] ) ){ - $tmp_data["utimestamp"] = $current_unknown["time_to"]; - $i = count($data_slices) - 1; - while ($i >= 0) { - if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){ - $tmp_data["datos"] = - $data_slices[$i]['datos'] == null - ? $last_value - : $data_slices[$i]['datos']; - break; - } - $i--; + if (is_array($unknown_events)) { + $i = 0; + while ($current_timestamp >= $unknown_events[$i]["time_to"] ) { + // Skip unknown events in past + array_splice($unknown_events, $i,1); + $i++; + if (!isset($unknown_events[$i])) { + break; } - - // debug purpose - //$tmp_data["obs"] = "event data unknown to"; - array_push($return[$pool_id]["data"], $tmp_data); - $current_unknown = array_shift($unknown_events); } + if (isset($current_unknown)) { + + // check if recovered from unknown status + if(is_array($unknown_events) && isset($current_unknown)) { + if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"]) + && ($current_timestamp < $current_unknown["time_to"]) + && ($in_unknown_status == 1) ) { + // Recovered from unknown + + if ( ($current_unknown["time_to"] > $current_timestamp) + && ($expected_data_generated == 0) ) { + // also add the "expected" data + $tmp_data["utimestamp"] = $current_timestamp; + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $expected_data_generated = 1; + } + + + $tmp_data["utimestamp"] = $current_unknown["time_to"]; + $tmp_data["datos"] = $last_inserted_value; + // debug purpose + //$tmp_data["obs"] = "event recovery data"; + + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $data_found = 1; + $in_unknown_status = 0; + } + + if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"]) + && (($current_timestamp+$slice_size) < $current_unknown["time_to"]) + && ($in_unknown_status == 0) ) { + // Add unknown state detected + + if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) { + if ( ($current_unknown["time_from"] > $current_timestamp) + && ($expected_data_generated == 0) ) { + // also add the "expected" data + $tmp_data["utimestamp"] = $current_timestamp; + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $expected_data_generated = 1; + } + + $tmp_data["utimestamp"] = $current_unknown["time_from"]; + $tmp_data["datos"] = null; + // debug purpose + //$tmp_data["obs"] = "event data"; + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $data_found = 1; + } + $in_unknown_status = 1; + } + + if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) { + $current_unknown = array_shift($unknown_events); + } + } + } // unknown events handle } - //sort current slice - usort( - $return[$pool_id]['data'], - function ($a, $b) { - if ($a['utimestamp'] == $b['utimestamp']) return 0; - return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1; + // Search for data + $i=0; + if (is_array($raw_data)) { + foreach ($raw_data as $data) { + if ( ($data["utimestamp"] >= $current_timestamp) + && ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) { + // Data in block, push in, and remove from $raw_data (processed) + + if ( ($data["utimestamp"] > $current_timestamp) + && ($expected_data_generated == 0) ) { + // also add the "expected" data + $tmp_data["utimestamp"] = $current_timestamp; + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + //$tmp_data["obs"] = "expected data"; + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + $expected_data_generated = 1; + } + + $tmp_data["utimestamp"] = intval($data["utimestamp"]); + $tmp_data["datos"] = $data["datos"]; + // debug purpose + //$tmp_data["obs"] = "real data"; + + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + + $last_inserted_value = $data["datos"]; + $last_timestamp = intval($data["utimestamp"]); + + unset($raw_data[$i]); + $data_found = 1; + $in_unknown_status = 0; + } + elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) { + // Data in future, stop searching new ones + break; + } } - ); - //put the last slice data like first element of next slice - $last_inserted_value = end($return[$pool_id]['data']); - $last_inserted_value = $last_inserted_value['datos']; - - //increment + $i++; + } + + if ($data_found == 0) { + // No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval + // UNKNOWN! + + if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) { + if (isset($last_inserted_value)) { + // unhandled unknown status control + $unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp; + if ($unhandled_time_unknown > 0) { + // unhandled unknown status detected. Add to previous pool + $tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval); + $tmp_data["datos"] = null; + // debug purpose + //$tmp_data["obs"] = "unknown extra"; + // add to previous pool if needed + if (isset($return[$pool_id-1])) { + array_push($return[$pool_id-1]["data"], $tmp_data); + } + } + } + $last_inserted_value = null; + } + + $tmp_data["utimestamp"] = $current_timestamp; + + if ($in_unknown_status == 1) { + $tmp_data["datos"] = null; + } + else { + $tmp_data["datos"] = $last_inserted_value; + } + // debug purpose + //$tmp_data["obs"] = "virtual data"; + + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + } + $pool_id++; - $current_timestamp = $current_timestamp_end; + $current_timestamp += $slice_size; } + return $return; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index c91e71c07a..0c9bd6ebfb 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -550,6 +550,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $search_in_history_db = db_search_in_history_db($datelimit); + + if($force_interval){ $resolution = $period/$time_interval; } @@ -580,29 +582,18 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, // Get event data (contains alert data too) $events = array(); if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ( - 'tevento', + $events = db_get_all_rows_filter ('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", 'order' => 'utimestamp ASC'), - array ('id_evento', 'evento', 'utimestamp', 'event_type'), - 'AND', - $search_in_history_db - ); + array ('id_evento', 'evento', 'utimestamp', 'event_type')); // Get the last event after inverval to know if graph start on unknown - $prev_event = db_get_row_filter ( - 'tevento', + $prev_event = db_get_row_filter ('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp <= $datelimit", - 'order' => 'utimestamp DESC' - ), - false, - 'AND', - $search_in_history_db - ); - + 'order' => 'utimestamp DESC')); if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { $start_unknown = true; } @@ -1127,7 +1118,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, global $config; global $graphic_type; - + if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; @@ -1354,6 +1345,21 @@ function graphic_combined_module ($module_list, $weight_list, $period, continue; } + // if(empty($aux_array)){ + // foreach ($data as $key => $value) { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } else { + // foreach ($data as $key => $value) { + // if(array_key_exists($value['utimestamp'],$aux_array)){ + // $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos']; + // } else { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } + // } + + // html_debug($aux_array); if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { if ($labels[$agent_module_id] != '') $module_name_list[$i] = $labels[$agent_module_id]; @@ -3986,33 +3992,22 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($uncompressed_module) { $avg_only = 1; } + $search_in_history_db = db_search_in_history_db($datelimit); // Get event data (contains alert data too) if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter( - 'tevento', + $events = db_get_all_rows_filter('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", - 'order' => 'utimestamp ASC' - ), - array ('evento', 'utimestamp', 'event_type', 'id_evento'), - 'AND', - $search_in_history_db - ); + 'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'event_type', 'id_evento')); // Get the last event after inverval to know if graph start on unknown - $prev_event = db_get_row_filter ( - 'tevento', + $prev_event = db_get_row_filter ('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp <= $datelimit", - 'order' => 'utimestamp DESC' - ), - false, - 'AND', - $search_in_history_db - ); - + 'order' => 'utimestamp DESC')); if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { $start_unknown = true; } @@ -4117,7 +4112,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $zero = 0; $total = 0; $count = 0; - + $is_unknown = false; // Read data that falls in the current interval while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && @@ -4150,7 +4145,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, // Is the first point of a unknown interval $first_unknown = false; - $check_unknown = false; + $event_ids = array(); $alert_ids = array(); while (isset ($events[$k]) && @@ -4169,15 +4164,10 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($is_unknown == false) { $first_unknown = true; } - else{ - $first_unknown = false; - } - $check_unknown = true; $is_unknown = true; } else if (substr ($events[$k]['event_type'], 0, 5) == 'going') { $is_unknown = false; - $first_unknown = false; } } $k++; @@ -4260,12 +4250,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $chart[$timestamp]['unknown'.$series_suffix] = 0; } $chart[$timestamp]['unknown'.$series_suffix] = $unknown_value; - - if($unknown_value == 0 && $check_unknown == true){ - $chart[$timestamp]['unknown'.$series_suffix] = 1; - $check_unknown = false; - } - $series_type['unknown'.$series_suffix] = 'area'; } @@ -4396,138 +4380,165 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index, global $min_value; global $series_type; global $chart_extra_data; + + $ranges_unknown = db_get_module_ranges_unknown($agent_module_id, $datelimit, $date); - $first_data = 0; + $table = "tagente_datos"; + $module_type_str = modules_get_type_name ($agent_module_id); + if (strstr ($module_type_str, 'string') !== false) { + $table = "tagente_datos_string"; + } + $query = " SELECT utimestamp, datos FROM $table "; + $query .= " WHERE id_agente_modulo=$agent_module_id "; + $query .= " ORDER BY utimestamp ASC LIMIT 1"; + + $ret = db_get_all_rows_sql( $query , true); + + $first_data = $ret[0]['utimestamp']; $data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date); - - $chart_data = array(); - - $min_value = PHP_INT_MAX-1; - $max_value = PHP_INT_MIN+1; - $previous_data = $first_data; - $previous_unknown = 0; - - $i=0; - $current_event = $events[0]; - $prueba = array(); - foreach ($data_uncompress as $k) { - foreach ($k["data"] as $v) { - $real_date = date("Y M d H:i:s", $v['utimestamp']); - - if(!$flash_chart){ - $real_date = date("Y/M/d", $v['utimestamp']); - $real_date .= "\n"; - $real_date .= date(" H:i:s", $v['utimestamp']); - } - - $event_ids = array(); - $alert_ids = array(); - while (isset($current_event) && ($v['utimestamp'] >= $current_event["utimestamp"]) ) { - $event_date = date("Y M d H:i:s", $current_event['utimestamp']); + $i = 0; + $max_value = 0; + $min_value = 0; + $timestamp_second = 0; + if(is_array($data_uncompress)){ + foreach ($data_uncompress as $v) { + foreach ($v['data'] as $key => $value) { + $real_date = date("Y M d H:i:s", $value['utimestamp']); if(!$flash_chart){ - $event_date = date("Y/M/d", $current_event['utimestamp']); - $event_date .= "\n"; - $event_date .= date(" H:i:s", $current_event['utimestamp']); + $real_date = date("Y/M/d", $value['utimestamp']); + $real_date .= "\n"; + $real_date .= date(" H:i:s", $value['utimestamp']); } - - if ($show_events && (strpos($current_event["event_type"], "going") !== false)) { - $event_ids[$event_date][] = $current_event["id_evento"]; - - $chart_data[$event_date]["event" . $series_suffix] = 1; - $chart_data[$event_date]["alert" . $series_suffix] = NULL; - $chart_extra_data[count($chart_data)-1]['events'] = implode (',', $event_ids[$event_date]); + // Read events and alerts that fall in the current interval + $event_value = 0; + $alert_value = 0; + $unknown_value = 0; + $event_i = 0; + // Is the first point of a unknown interval + $first_unknown = false; + + $event_ids = array(); + $alert_ids = array(); + + // + if($timestamp_second == 0){ + $timestamp_second = $value['utimestamp']; } - elseif ($show_alerts && (strpos($current_event["event_type"], "alert") !== false)) { - $alert_ids[$event_date][] = $current_event["id_evento"]; - - $chart_data[$event_date]["event" . $series_suffix] = NULL; - $chart_data[$event_date]["alert" . $series_suffix] = 1; - $chart_extra_data[count($chart_data)-1]['alerts'] = implode (',', $alert_ids[$event_date]); + $timestamp_first = $timestamp_second; + $timestamp_second = $value['utimestamp']; + + foreach ($events as $key => $val) { + if( $val['utimestamp'] > $timestamp_first && + $val['utimestamp'] <= $timestamp_second ){ + if ($show_events == 1) { + $event_ids[] = $val['id_evento']; + $event_value++; + } + if ($show_alerts == 1 && substr ($val['event_type'], 0, 5) == 'alert') { + $alert_ids[] = $val['id_evento']; + $alert_value++; + } + if ($show_unknown) { + if ($val['event_type'] == 'going_unknown') { + if ($is_unknown == false) { + $first_unknown = true; + } + $is_unknown = true; + } + else if (substr ($val['event_type'], 0, 5) == 'going') { + $is_unknown = false; + } + } + } + } + + if(empty($value['datos'])){ + if($value['utimestamp'] < $first_data){ + //$chart_data[$real_date]['unknown'.$series_suffix] = 0; + $is_unknown = false; + } + else{ + //$chart_data[$real_date]['unknown'.$series_suffix] = 1; + $first_unknown = true; + } + } + + $timestamp_short = date("Y M d H:i:s", $value['utimestamp']); + + if(!$flash_chart){ + $timestamp_short = date("Y/M/d", $value['utimestamp']); + $timestamp_short .= "\n"; + $timestamp_short .= date(" H:i:s", $value['utimestamp']); + } + + + $long_index[$timestamp_short] = date( + html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $value['utimestamp']); + // In some cases, can be marked as known because a recovery event + // was found in same interval. For this cases first_unknown is + // checked too + if ($is_unknown || $first_unknown) { + $unknown_value++; + } + + // Data + if ($show_events) { + if (!isset($chart_data[$real_date]['event'.$series_suffix])) { + $chart_data[$real_date]['event'.$series_suffix] = 0; + } + + $chart_data[$real_date]['event'.$series_suffix] += $event_value; + + $series_type['event'.$series_suffix] = 'points'; + } + + if ($show_alerts) { + if (!isset($chart_data[$real_date]['alert'.$series_suffix])) { + $chart_data[$real_date]['alert'.$series_suffix] = 0; + } + + $chart_data[$real_date]['alert'.$series_suffix] += $alert_value; + + $series_type['alert'.$series_suffix] = 'points'; + } + + $chart_data[$real_date]['sum'.$series_suffix] = $value['datos']; + + if($value['datos'] > $max_value){ + $max_value = $value['datos']; + } + + if($value['datos'] < $min_value){ + $min_value = $value['datos']; } - $chart_data[$event_date]["sum" . $series_suffix] = $previous_data; - if($show_unknown) { - $chart_data[$event_date]["unknown" . $series_suffix] = $previous_unknown; - } - $current_event = $events[$i++]; - } - - if ($v["datos"] === NULL) { - // Unknown - if (!isset($chart_data[$real_date]["event" . $series_suffix])) { - if($show_events) { - $chart_data[$real_date]["event" . $series_suffix] = NULL; - } - if($show_alerts) { - $chart_data[$real_date]["alert" . $series_suffix] = NULL; - } - } - - $chart_data[$real_date]["sum" . $series_suffix] = $previous_data; - if($show_unknown) { - $chart_data[$real_date]["unknown" . $series_suffix] = "1"; - } - $previous_unknown = "1"; - } - elseif($v["datos"] === false) { - // Not Init - $previous_data = $v["datos"]; - if (!isset($chart_data[$real_date]["event" . $series_suffix])) { - if ($show_events) { - $chart_data[$real_date]["event" . $series_suffix] = NULL; - } - if ($show_alerts) { - $chart_data[$real_date]["alert" . $series_suffix] = NULL; - } + if ($show_unknown) { + if (!isset($chart_data[$real_date]['unknown'.$series_suffix])) { + $chart_data[$real_date]['unknown'.$series_suffix] = 0; + } + $chart_data[$real_date]['unknown'.$series_suffix] = $unknown_value; + $series_type['unknown'.$series_suffix] = 'area'; } - $chart_data[$real_date]["sum" . $series_suffix] = $v["datos"]; - - if($v['datos'] >= $max_value){ - $max_value = $v['datos']; + if (!empty($event_ids)) { + $chart_extra_data[count($chart_data)-1]['events'] = implode(',',$event_ids); } - - if($v['datos'] <= $min_value){ - $min_value = $v['datos']; - } - - if($show_unknown) { - $chart_data[$real_date]["unknown" . $series_suffix] = NULL; - $previous_unknown = NULL; + if (!empty($alert_ids)) { + $chart_extra_data[count($chart_data)-1]['alerts'] = implode(',',$alert_ids); } } - else { - $previous_data = $v["datos"]; - if (!isset($chart_data[$real_date]["event" . $series_suffix])) { - if ($show_events) { - $chart_data[$real_date]["event" . $series_suffix] = NULL; - } - if ($show_alerts) { - $chart_data[$real_date]["alert" . $series_suffix] = NULL; - } - } - - $chart_data[$real_date]["sum" . $series_suffix] = $v["datos"]; - - if($v['datos'] >= $max_value){ - $max_value = $v['datos']; - } - - if($v['datos'] <= $min_value){ - $min_value = $v['datos']; - } - - if($show_unknown) { - $chart_data[$real_date]["unknown" . $series_suffix] = NULL; - $previous_unknown = NULL; - } - } + } + + if (!is_null($percentil) && $percentil) { + $avg = array_map(function($item) { return $item['sum']; }, $chart_data); + $percentil_result = get_percentile($percentil, $avg); + //Fill the data of chart + array_walk($chart_data, function(&$item) use ($percentil_result, $series_suffix) { + $item['percentil' . $series_suffix] = $percentil_result; }); + $series_type['percentil' . $series_suffix] = 'line'; } } - $series_type['event'.$series_suffix] = 'points'; - $series_type['alert'.$series_suffix] = 'points'; - $series_type['unknown'.$series_suffix] = 'area'; } function grafico_modulo_boolean ($agent_module_id, $period, $show_events, diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 03f63e624c..bcdeb6819c 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2261,53 +2261,50 @@ function modules_change_relation_lock ($id_relation) { return ($result !== false ? $new_value : $old_value); } -/* - * @return utimestamp with the first contact of the module or first contact before datelimit, false if not-init - */ -function modules_get_first_date($id_agent_module, $datelimit = 0) { + + +function modules_get_count_datas($id_agent_module, $date_init, $date_end) { + $interval = modules_get_interval ($id_agent_module); + + // TODO REMOVE THE TIME IN PLANNED DOWNTIME + + if (!is_numeric($date_init)) { + $date_init = strtotime($date_init); + } + + if (!is_numeric($date_end)) { + $date_end = strtotime($date_end); + } + + + + $first_date = modules_get_first_contact_date($id_agent_module); + + + + if ($date_init < $first_date) { + $date_init = $first_date; + } + + $diff = $date_end - $date_init; + + + return ($diff / $interval); +} + + +function modules_get_first_contact_date($id_agent_module) { global $config; - //check datatype string or normal - $table = "tagente_datos"; - $module_type_str = modules_get_type_name ($id_agent_module); - if (strstr ($module_type_str, 'string') !== false) { - $table = "tagente_datos_string"; - } - - $search_historydb = false; - - // tagente_estado.first_utimestamp is not valid or is not updated. Scan DBs for first utimestamp - if ($datelimit > 0) { - // get last data before datelimit - $query = " SELECT max(utimestamp) as utimestamp FROM $table "; - $query .= " WHERE id_agente_modulo=$id_agent_module "; - $query .= " AND utimestamp < $datelimit "; + // TODO REMOVE THE TIME IN PLANNED DOWNTIME - } - else { - // get first utimestamp - $query = " SELECT min(utimestamp) as utimestamp FROM $table "; - $query .= " WHERE id_agente_modulo=$id_agent_module "; - } + // TODO FOR OTHER KIND OF DATA - - // SEARCH ACTIVE DB - $data = db_get_all_rows_sql($query,$search_historydb); - if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) { - // first utimestamp not found in active database - // SEARCH HISTORY DB - $search_historydb = true; - $data = db_get_all_rows_sql($query,$search_historydb); - } - - if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) { - // Nor active DB nor history DB have the data, the module is not-init - return array ("first_utimestamp" => false, "search_historydb" => $search_historydb); - } - - // The data has been found - return array ("first_utimestamp" => $data[0]["utimestamp"], "search_historydb" => $search_historydb); - + $first_date = db_get_value('utimestamp', 'tagente_datos', + 'id_agente_modulo', $id_agent_module, + $config['history_db_enabled']); + + return $first_date; } /** diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index e6f97bc829..6fe97ae606 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -1767,11 +1767,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, if (timesize+timenewpos > canvaslimit) { $('#timestamp_'+graph_id).css('left', timenewpos - timesize); - $('#timestamp_'+graph_id).css('top', 50); } else { $('#timestamp_'+graph_id).css('left', timenewpos); - $('#timestamp_'+graph_id).css('top', 50); } } else { @@ -1814,16 +1812,24 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, plot.unhighlight(); if (item && item.series.label != '' && (item.series.label == legend_events || item.series.label == legend_events+series_suffix_str || item.series.label == legend_alerts || item.series.label == legend_alerts+series_suffix_str)) { plot.unhighlight(); + var canvaslimit = parseInt(plot.offset().left + plot.width()); var dataset = plot.getData(); + var timenewpos = parseInt(dataset[0].xaxis.p2c(pos.x)+plot.offset().left); + var extrasize = parseInt($('#extra_'+graph_id).css('width').split('px')[0]); + + var left_pos; + if (extrasize+timenewpos > canvaslimit) { + left_pos = timenewpos - extrasize - 20; + } + else { + left_pos = timenewpos - (extrasize / 2); + } var extra_info = 'No info to show'; var extra_show = false; - var coord_x = (item.dataIndex/item.series.xaxis.datamax)* (event.target.clientWidth - event.target.offsetLeft + 1) + event.target.offsetLeft; - - - $('#extra_'+graph_id).css('left',coord_x); - $('#extra_'+graph_id).css('top', event.target.offsetTop + 55 ); + $('#extra_'+graph_id).css('left',left_pos); + $('#extra_'+graph_id).css('top',plot.offset().top + 25); switch(item.series.label) { case legend_alerts+series_suffix_str: diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index f0fdf37082..ba7965fd63 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -111,6 +111,8 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); $id = (int) get_parameter ("id", 0); // Agent id $agent_id = (int) modules_get_agentmodule_agent($id); + // Kind module + $type_module = modules_get_agentmodule_kind($id); if (empty($id) || empty($agent_id)) { ui_print_error_message(__('There was a problem locating the source of the graph')); @@ -169,6 +171,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); $time_compare_overlapped = get_parameter ("time_compare_overlapped", 0); $unknown_graph = get_parameter_checkbox ("unknown_graph", 1); + //$type_module == 'predictionserver'; $fullscale_sent = get_parameter ("fullscale_sent", 0); if(!$fullscale_sent){ if(!isset($config['full_scale_option']) || $config['full_scale_option'] == 0){ @@ -420,12 +423,14 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); break; } - $data = array(); - $data[0] = __('Show full scale graph (TIP)'); - $data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, - true, false); - $table->data[] = $data; - $table->rowclass[] = ''; + if($type_module != 'predictionserver'){ + $data = array(); + $data[0] = __('Show full scale graph (TIP)'); + $data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, + true, false); + $table->data[] = $data; + $table->rowclass[] = ''; + } $form_table = html_print_table($table, true); From de65e7cf27553a442a61811cc3716790b5941897 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 10 Nov 2017 14:43:31 +0100 Subject: [PATCH 64/82] Fixed element name and leyend separator --- pandora_console/include/functions_visual_map.php | 6 +++--- pandora_console/include/functions_visual_map_editor.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index f6293d8743..647e603a51 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -2583,7 +2583,7 @@ function get_donut_module_data ($id_module) { $total = 0; foreach ($values as $val) { if ($index < $max_elements) { - $data = explode(":", $val); + $data = explode(",", $val); $values_to_return[$index]['tag_name'] = $data[0] . ", " . $data[1]; $values_to_return[$index]['color'] = $colors[$index]; $values_to_return[$index]['value'] = (int)$data[1]; @@ -2591,7 +2591,7 @@ function get_donut_module_data ($id_module) { $index++; } else { - $data = explode(":", $val); + $data = explode(",", $val); $values_to_return[$index]['tag_name'] = __('Others') . ", " . $data[1]; $values_to_return[$index]['color'] = $colors[$index]; $values_to_return[$index]['value'] += (int)$data[1]; @@ -2602,7 +2602,7 @@ function get_donut_module_data ($id_module) { foreach ($values_to_return as $ind => $donut_data) { $values_to_return[$ind]['percent'] = ($donut_data['value'] * 100) / $total; } - + return $values_to_return; } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 513c6ccc32..82d6382343 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -731,7 +731,7 @@ function visual_map_editor_print_toolbox() { visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true); visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true); visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true); - visual_map_print_button_editor('donut_graph', __('Donut Graph'), 'left', false, 'donut_graph_min', true); + visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true); visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_graph_min', true); visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true); visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true); From eb39d25c4b137115b6d65a7ee733b987df4a1b88 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 10 Nov 2017 15:03:52 +0100 Subject: [PATCH 65/82] Added field to get string modules --- .../visual_console_builder.editor.js | 15 ++++++-- .../ajax/visual_console_builder.ajax.php | 5 ++- pandora_console/include/functions_ui.php | 9 +++++ .../include/functions_visual_map_editor.php | 35 ++++++++++++++++++- .../operation/agentes/ver_agente.php | 5 +++ 5 files changed, 65 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index ebd2427ce3..291c3abd38 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -800,6 +800,8 @@ function readFields() { values['top'] = $("input[name=top]").val(); values['agent'] = $("input[name=agent]").val(); values['id_agent'] = $("input[name=id_agent]").val(); + values['agent_string'] = $("input[name=agent_string]").val(); + values['id_agent_string'] = $("input[name=id_agent_string]").val(); values['module'] = $("select[name=module]").val(); values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); @@ -910,7 +912,7 @@ function create_button_palette_callback() { } break; case 'donut_graph': - if ((values['agent'] == '')) { + if ((values['agent_string'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; } @@ -1442,11 +1444,16 @@ function loadFieldsFromDB(item) { if (key == 'pos_y') $("input[name=top]").val(val); if (key == 'agent_name') { $("input[name=agent]").val(val); + $("input[name=agent_string]").val(val); //Reload no-sincrone the select of modules } + if (key == 'id_agent') { $("input[name=id_agent]").val(val); } + if (key == 'id_agent_string') { + $("input[name=id_agent_string]").val(val); + } if (key == 'modules_html') { $("select[name=module]").empty().html(val); $("select[name=module]").val(moduleId); @@ -1714,6 +1721,9 @@ function hiddenFields(item) { $("#agent_row").css('display', 'none'); $("#agent_row." + item).css('display', ''); + $("#agent_row_string").css('display', 'none'); + $("#agent_row_string." + item).css('display', ''); + $("#module_row").css('display', 'none'); $("#module_row." + item).css('display', ''); @@ -1838,6 +1848,7 @@ function cleanFields(item) { $("input[name=left]").val(0); $("input[name=top]").val(0); $("input[name=agent]").val(''); + $("input[name=agent_string]").val(''); $("select[name=module]").val(''); $("select[name=process_value]").val(0); $("select[name=background_image]").val(''); @@ -2452,7 +2463,7 @@ function setDonutsGraph (id_data, values) { parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_type_string"}); - parameter.push ({name: "id_agent", value: values['id_agent']}); + parameter.push ({name: "id_agent", value: values['id_agent_string']}); parameter.push ({name: "module", value: values['module']}); parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_visual_console", value: id_visual_console}); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index c7e4484a27..07a51af3bb 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -113,6 +113,7 @@ $metaconsole = get_parameter('metaconsole', 0); $server_name = get_parameter('server_name', null); $server_id = (int)get_parameter('server_id', 0); $id_agent = get_parameter('id_agent', null); +$id_agent_string = get_parameter('id_agent_string', null); $id_metaconsole = get_parameter('id_metaconsole', null); $id_group = (int)get_parameter('id_group', 0); $id_custom_graph = get_parameter('id_custom_graph', null); @@ -179,7 +180,7 @@ switch ($action) { } $is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo', - array ('id_agente' => $id_agent, + array ('id_agente' => _string, 'id_agente_modulo' => $id_module)); if ($layoutData['id_metaconsole'] != 0) { @@ -611,6 +612,7 @@ switch ($action) { } $values['border_color'] = $resume_color; $values['type'] = DONUT_GRAPH; + $values['id_agent'] = $id_agent_string; break; case 'box_item': @@ -1013,6 +1015,7 @@ switch ($action) { $values['width'] = $width; $values['height'] = $height; $values['border_color'] = $resume_color; + $values['id_agent'] = $id_agent_string; break; case 'module_graph': $values['type'] = MODULE_GRAPH; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 11395a37ba..e76ba9399f 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2973,6 +2973,11 @@ function ui_print_agent_autocomplete_input($parameters) { else $metaconsole_enabled = false; } + + $get_only_string_modules = false; + if (isset($parameters['get_only_string_modules'])) { + $get_only_string_modules = true; + } $spinner_image = html_print_image('images/spinner.gif', true, false, true); if (isset($parameters['spinner_image'])) { @@ -3128,6 +3133,10 @@ function ui_print_agent_autocomplete_input($parameters) { if (' . ((int) $get_order_json) . ') { inputs.push ("get_order_json=1"); } + + if (' . ((int) $get_only_string_modules) . ') { + inputs.push ("get_only_string_modules=1"); + } if (' . ((int)$metaconsole_enabled) . ') { if ((' . ((int)$use_input_server) . ') diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 82d6382343..f4d99e5bfa 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -290,7 +290,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph', 'donut_graph'); + 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph'); $form_items['agent_row']['html'] = ''; $params = array(); @@ -320,6 +320,39 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row']['html'] .= ''; + + $form_items['agent_row_string'] = array(); + $form_items['agent_row_string']['items'] = array('donut_graph'); + $form_items['agent_row_string']['html'] = ''; + $params = array(); + $params['return'] = true; + $params['show_helptip'] = true; + $params['input_name'] = 'agent_string'; + $params['size'] = 30; + $params['selectbox_id'] = 'module'; + $params['javascript_is_function_select'] = true; + $params['use_hidden_input_idagent'] = true; + $params['print_hidden_input_idagent'] = true; + $params['hidden_input_idagent_name'] = 'id_agent_string'; + $params['get_order_json'] = true; + $params['get_only_string_modules'] = true; + if (defined('METACONSOLE')) { + $params['javascript_ajax_page'] = '../../ajax.php'; + $params['disabled_javascript_on_blur_function'] = true; + + $params['print_input_server'] = true; + $params['print_input_id_server'] = true; + $params['input_server_id'] = 'id_server_name'; + $params['input_id_server_name'] = 'id_server_metaconsole'; + $params['input_server_value'] = ''; + $params['use_input_id_server'] = true; + $params['metaconsole_enabled'] = true; + $params['print_hidden_input_idagent'] = true; + } + $form_items['agent_row_string']['html'] .= ''; $form_items['module_row'] = array(); $form_items['module_row']['items'] = array('static_graph', diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 97c4f01720..b2479fec88 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -589,6 +589,11 @@ if (is_ajax ()) { if (empty($filter)) $filter = false; + $get_only_string_modules = get_parameter('get_only_string_modules', false); + if ($get_only_string_modules) { + $filter['tagente_modulo.id_tipo_modulo IN'] = "(17,23,3,10,33)"; + } + // Status selector if ($status_modulo == AGENT_MODULE_STATUS_NORMAL) { //Normal $sql_conditions .= ' estado = 0 AND utimestamp > 0 ) From b8e6d7927e46eaf1d770b4fa371fe7c8e0eebb80 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 11 Nov 2017 00:01:10 +0100 Subject: [PATCH 66/82] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 48192919a2..156268ce8c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171110 +Version: 7.0NG.715-171111 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 1b335438a9..31f95327c0 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="7.0NG.715-171110" +pandora_version="7.0NG.715-171111" 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 a5743df259..f4e44d7d0b 100755 --- 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 => '7.0NG.715'; -use constant AGENT_BUILD => '171110'; +use constant AGENT_BUILD => '171111'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 7071e4655d..bf9d45ae00 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 7.0NG.715 -%define release 171110 +%define release 171111 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 a3ce74230c..2bc5799319 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 7.0NG.715 -%define release 171110 +%define release 171111 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 e75fffdc2b..b2f66323ec 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171110" +PI_BUILD="171111" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 1269e3108d..719bd89c90 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171110} +{171111} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 80142ca894..167574bdf9 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 ("7.0NG.715(Build 171110)") +#define PANDORA_VERSION ("7.0NG.715(Build 171111)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 5d9e664a8f..013d3b0c13 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", "(7.0NG.715(Build 171110))" + VALUE "ProductVersion", "(7.0NG.715(Build 171111))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index fe0cfc6bdc..b32834625c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171110 +Version: 7.0NG.715-171111 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 b80b89eccd..1e48ffbcac 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="7.0NG.715-171110" +pandora_version="7.0NG.715-171111" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7a81d1d4f7..040784099a 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 = 'PC171110'; +$build_version = 'PC171111'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 53b50bb05a..706c533462 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Sun, 12 Nov 2017 00:01:08 +0100 Subject: [PATCH 67/82] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 156268ce8c..db41c07d03 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171111 +Version: 7.0NG.715-171112 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 31f95327c0..67a638c16c 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="7.0NG.715-171111" +pandora_version="7.0NG.715-171112" 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 f4e44d7d0b..6e6db74d26 100755 --- 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 => '7.0NG.715'; -use constant AGENT_BUILD => '171111'; +use constant AGENT_BUILD => '171112'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index bf9d45ae00..0fc59b5059 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 7.0NG.715 -%define release 171111 +%define release 171112 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 2bc5799319..21c5766d9d 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 7.0NG.715 -%define release 171111 +%define release 171112 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 b2f66323ec..1a751158f3 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171111" +PI_BUILD="171112" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 719bd89c90..0b08db5814 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171111} +{171112} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 167574bdf9..099535ced0 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 ("7.0NG.715(Build 171111)") +#define PANDORA_VERSION ("7.0NG.715(Build 171112)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 013d3b0c13..bae828cff6 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", "(7.0NG.715(Build 171111))" + VALUE "ProductVersion", "(7.0NG.715(Build 171112))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b32834625c..4598c56e02 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171111 +Version: 7.0NG.715-171112 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 1e48ffbcac..2e90f69351 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="7.0NG.715-171111" +pandora_version="7.0NG.715-171112" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 040784099a..82c28e09c4 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 = 'PC171111'; +$build_version = 'PC171112'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 706c533462..265d9d3c36 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 13 Nov 2017 00:01:08 +0100 Subject: [PATCH 68/82] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index db41c07d03..d2f1d23070 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171112 +Version: 7.0NG.715-171113 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 67a638c16c..69e3c2ffcb 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="7.0NG.715-171112" +pandora_version="7.0NG.715-171113" 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 6e6db74d26..aaa878e973 100755 --- 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 => '7.0NG.715'; -use constant AGENT_BUILD => '171112'; +use constant AGENT_BUILD => '171113'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 0fc59b5059..b1a9037142 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 7.0NG.715 -%define release 171112 +%define release 171113 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 21c5766d9d..d673c5303c 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 7.0NG.715 -%define release 171112 +%define release 171113 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 1a751158f3..fd036c8408 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.715" -PI_BUILD="171112" +PI_BUILD="171113" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 0b08db5814..f5497c337e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171112} +{171113} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 099535ced0..43c57250fd 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 ("7.0NG.715(Build 171112)") +#define PANDORA_VERSION ("7.0NG.715(Build 171113)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index bae828cff6..13d29a9a76 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", "(7.0NG.715(Build 171112))" + VALUE "ProductVersion", "(7.0NG.715(Build 171113))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 4598c56e02..1f8f167a7e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171112 +Version: 7.0NG.715-171113 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 2e90f69351..f713415073 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="7.0NG.715-171112" +pandora_version="7.0NG.715-171113" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 82c28e09c4..41b5293d1c 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 = 'PC171112'; +$build_version = 'PC171113'; $pandora_version = 'v7.0NG.715'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 265d9d3c36..c5695928bb 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 13 Nov 2017 09:35:24 +0100 Subject: [PATCH 69/82] Added the last change to load string modules --- .../visual_console_builder.editor.js | 2 +- .../ajax/visual_console_builder.ajax.php | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 291c3abd38..2e328b2077 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -2486,7 +2486,7 @@ function setDonutsGraph (id_data, values) { else { $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/donut-graph.png'); - if($('#text-width').val() == 0 || $('#text-height').val() == 0){ + if($('#text-width_percentile').val() == 0){ // Image size } else{ diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 07a51af3bb..827f92a512 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -180,7 +180,7 @@ switch ($action) { } $is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo', - array ('id_agente' => _string, + array ('id_agente' => $id_agent, 'id_agente_modulo' => $id_module)); if ($layoutData['id_metaconsole'] != 0) { @@ -613,7 +613,6 @@ switch ($action) { $values['border_color'] = $resume_color; $values['type'] = DONUT_GRAPH; $values['id_agent'] = $id_agent_string; - break; case 'box_item': $values['border_width'] = $border_width; @@ -751,6 +750,7 @@ switch ($action) { case 'donut_graph': unset($values['border_color']); unset($values['width']); + unset($values['id_agent']); break; case 'box_item': unset($values['border_width']); @@ -895,6 +895,20 @@ switch ($action) { case 'donut_graph': $elementFields['width_percentile'] = $elementFields['width']; $elementFields['resume_color'] = $elementFields['border_color']; + $elementFields['id_agent_string'] = $elementFields['id_agent']; + if (($elementFields['id_agent_string'] != 0) + && ($elementFields['id_layout_linked'] == 0)) { + $modules = agents_get_modules( + $elementFields['id_agent'], false, + array('disabled' => 0, + 'id_agente' => $elementFields['id_agent'], + 'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)")); + + $elementFields['modules_html'] = ''; + foreach ($modules as $id => $name) { + $elementFields['modules_html'] .= ''; + } + } break; case 'module_graph': @@ -1012,8 +1026,8 @@ switch ($action) { break; case 'donut_graph': $values['type'] = DONUT_GRAPH; - $values['width'] = $width; - $values['height'] = $height; + $values['width'] = $width_percentile; + $values['height'] = $width_percentile; $values['border_color'] = $resume_color; $values['id_agent'] = $id_agent_string; break; From 49df1e448aeb8589450d449780b70fd74a5e7142 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 13 Nov 2017 09:59:00 +0100 Subject: [PATCH 70/82] Added changes from donut graph --- .../visual_console_builder.editor.js | 32 +- .../ajax/visual_console_builder.ajax.php | 18 + .../include/functions_visual_map.php | 346 ++++++++---------- .../include/functions_visual_map_editor.php | 4 +- 4 files changed, 181 insertions(+), 219 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 2e328b2077..6637654f00 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -985,7 +985,7 @@ function create_button_palette_callback() { } break; case 'bars_graph': - if ((values['agent'] == '')) { + if ((values['agent_string'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; } @@ -2029,7 +2029,7 @@ function setBarsGraph(id_data, values) { parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_type_string"}); - parameter.push ({name: "id_agent", value: values['id_agent']}); + parameter.push ({name: "id_agent", value: values['id_agent_string']}); parameter.push ({name: "module", value: values['module']}); parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_visual_console", value: id_visual_console}); @@ -2039,28 +2039,16 @@ function setBarsGraph(id_data, values) { type: "POST", dataType: 'json', success: function (data) { - if (data['no_data'] == true) { - if (values['width_percentile'] == "0") { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png'); - } - else { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png'); - $("#" + id_data + " img").css('width', width_percentile + 'px'); - $("#" + id_data + " img").css('height', width_percentile + 'px'); - } + $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png'); + + if (values['width_percentile'] == "0") { + // Image size } - else { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png'); - - if (values['width_percentile'] == "0") { - // Image size - } - else{ - $("#" + id_data + " img").css('width', width_percentile+'px'); - $("#" + id_data + " img").css('height', width_percentile+'px'); - } + else{ + $("#" + id_data + " img").css('width', width_percentile+'px'); + $("#" + id_data + " img").css('height', width_percentile+'px'); } - + if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){ $('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2); } diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 827f92a512..9b3fd183e2 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -664,6 +664,7 @@ switch ($action) { if ($grid_color !== null) { $values['border_color'] = $grid_color; } + $values['id_agent'] = $id_agent_string; break; case 'percentile_item': case 'percentile_bar': @@ -746,6 +747,8 @@ switch ($action) { unset($values['image']); unset($values['type_graph']); unset($values['border_color']); + unset($values['width']); + unset($values['id_agent']); break; case 'donut_graph': unset($values['border_color']); @@ -919,6 +922,20 @@ switch ($action) { $elementFields['width_percentile'] = $elementFields['width']; $elementFields['bars_graph_type'] = $elementFields['type_graph']; $elementFields['grid_color'] = $elementFields['border_color']; + $elementFields['id_agent_string'] = $elementFields['id_agent']; + if (($elementFields['id_agent_string'] != 0) + && ($elementFields['id_layout_linked'] == 0)) { + $modules = agents_get_modules( + $elementFields['id_agent'], false, + array('disabled' => 0, + 'id_agente' => $elementFields['id_agent'], + 'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)")); + + $elementFields['modules_html'] = ''; + foreach ($modules as $id => $name) { + $elementFields['modules_html'] .= ''; + } + } break; case 'box_item': $elementFields['width_box'] = $elementFields['width']; @@ -1074,6 +1091,7 @@ switch ($action) { $values['type_graph'] = $bars_graph_type; $values['image'] = $background_color; $values['border_color'] = $grid_color; + $values['id_agent'] = $id_agent_string; break; case 'auto_sla_graph': $values['type'] = AUTO_SLA_GRAPH; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 647e603a51..b9b92a65da 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1140,224 +1140,180 @@ function visual_map_print_item($mode = "read", $layoutData, if ( (get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap') ) { if($width == 0){ - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; } - else { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + else{ + $img = ''; } } else{ - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; } - else { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + else{ + $img = ''; } } } else { - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { + $color = array(); - $color = array(); - - $color[0] = array('border' => '#000000', - 'color' => $config['graph_color1'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[1] = array('border' => '#000000', - 'color' => $config['graph_color2'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[2] = array('border' => '#000000', - 'color' => $config['graph_color3'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[3] = array('border' => '#000000', - 'color' => $config['graph_color4'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[4] = array('border' => '#000000', - 'color' => $config['graph_color5'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[5] = array('border' => '#000000', - 'color' => $config['graph_color6'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[6] = array('border' => '#000000', - 'color' => $config['graph_color7'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[7] = array('border' => '#000000', - 'color' => $config['graph_color8'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[8] = array('border' => '#000000', - 'color' => $config['graph_color9'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[9] = array('border' => '#000000', - 'color' => $config['graph_color10'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[11] = array('border' => '#000000', - 'color' => COL_GRAPH9, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[12] = array('border' => '#000000', - 'color' => COL_GRAPH10, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[13] = array('border' => '#000000', - 'color' => COL_GRAPH11, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[14] = array('border' => '#000000', - 'color' => COL_GRAPH12, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[15] = array('border' => '#000000', - 'color' => COL_GRAPH13, - 'alpha' => CHART_DEFAULT_ALPHA); + $color[0] = array('border' => '#000000', + 'color' => $config['graph_color1'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[1] = array('border' => '#000000', + 'color' => $config['graph_color2'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[2] = array('border' => '#000000', + 'color' => $config['graph_color3'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[3] = array('border' => '#000000', + 'color' => $config['graph_color4'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[4] = array('border' => '#000000', + 'color' => $config['graph_color5'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[5] = array('border' => '#000000', + 'color' => $config['graph_color6'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[6] = array('border' => '#000000', + 'color' => $config['graph_color7'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[7] = array('border' => '#000000', + 'color' => $config['graph_color8'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[8] = array('border' => '#000000', + 'color' => $config['graph_color9'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[9] = array('border' => '#000000', + 'color' => $config['graph_color10'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[11] = array('border' => '#000000', + 'color' => COL_GRAPH9, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[12] = array('border' => '#000000', + 'color' => COL_GRAPH10, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[13] = array('border' => '#000000', + 'color' => COL_GRAPH11, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[14] = array('border' => '#000000', + 'color' => COL_GRAPH12, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[15] = array('border' => '#000000', + 'color' => COL_GRAPH13, + 'alpha' => CHART_DEFAULT_ALPHA); - $module_data = get_bars_module_data($id_module); - $water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png', - 'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png'); - - if ($width == 0) { - if ($layoutData['label_position']=='left') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; - } - } - elseif($layoutData['label_position']=='right') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; - } + $module_data = get_bars_module_data($id_module); + $water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png', + 'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png'); + + if ($width == 0) { + if ($layoutData['label_position']=='left') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; } else { - if ($layoutData['type_graph'] == 'horizontal') { - $img = hbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); - } - else { - $img = vbar_graph(true, $module_data, - 400, 400, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); - } + $img = '
'. + vbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; } } - else{ - if ($layoutData['label_position']=='left') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; - } - } - elseif($layoutData['label_position']=='right') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; - } + elseif($layoutData['label_position']=='right') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; } else { - if ($layoutData['type_graph'] == 'horizontal') { - $img = hbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); - } - else { - $img = vbar_graph(true, $module_data, - $width, $width, $color, array(), array(), - ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", "", $water_mark, $config['fontpath'], 6, - "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); - } + $img = '
'. + vbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; + } + } + else { + if ($layoutData['type_graph'] == 'horizontal') { + $img = hbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); + } + else { + $img = vbar_graph(true, $module_data, + 400, 400, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); } } } - else { - if($width == 0){ - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + else{ + if ($layoutData['label_position']=='left') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; } - else{ - $img = ''; + else { + $img = '
'. + vbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; } } - else{ - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + elseif($layoutData['label_position']=='right') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '
'; } - else{ - $img = ''; + else { + $img = '
'. + vbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '
'; + } + } + else { + if ($layoutData['type_graph'] == 'horizontal') { + $img = hbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); + } + else { + $img = vbar_graph(true, $module_data, + $width, $width, $color, array(), array(), + ui_get_full_url("images/image_problem.opaque.png", false, false, false), + "", "", $water_mark, $config['fontpath'], 6, + "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); } } } @@ -2182,7 +2138,7 @@ function get_bars_module_data ($id_module) { $color_index = 0; $total = 0; foreach ($values as $val) { - $data = explode(":", $val); + $data = explode(",", $val); $values_to_return[$data[0]] = array('g' =>$data[1]); } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index f4d99e5bfa..787275330a 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -290,7 +290,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph'); + 'simple_value', 'datos', 'auto_sla_graph'); $form_items['agent_row']['html'] = '
'; $params = array(); @@ -322,7 +322,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { ''; $form_items['agent_row_string'] = array(); - $form_items['agent_row_string']['items'] = array('donut_graph'); + $form_items['agent_row_string']['items'] = array('donut_graph', 'bars_graph'); $form_items['agent_row_string']['html'] = ''; $params = array(); From 86a5599aadb35b8da10deb8be90978d98257ee69 Mon Sep 17 00:00:00 2001 From: vgilc Date: Mon, 13 Nov 2017 10:20:58 +0100 Subject: [PATCH 71/82] Revert "Fixed traces" This reverts commit 173efae22d0a97ab727299a9bb7707521933190e --- pandora_console/include/functions_reporting.php | 3 +++ pandora_console/include/graphs/functions_flot.php | 1 + 2 files changed, 4 insertions(+) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c058d94188..c8e2d00d99 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -3848,6 +3848,9 @@ function reporting_value($report, $content, $type,$pdf) { $return['agent_name'] = $agent_name; $return['module_name'] = $module_name; + html_debug($pdf,true); + html_debug($only_image,true); + if($pdf){ $only_image = 1; } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 200033901b..a0da140dbd 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -185,6 +185,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, include_javascript_dependencies_flot_graph(); $menu = (int)$menu; + html_debug($legend); // Get a unique identifier to graph $graph_id = uniqid('graph_'); From 3493b9c15cd87ae66f97bbf8da10e7dc0b4a4177 Mon Sep 17 00:00:00 2001 From: vgilc Date: Mon, 13 Nov 2017 10:21:38 +0100 Subject: [PATCH 72/82] Revert "code backup" This reverts commit b9851a3a7150084029740f99f01eab294f4e18d7 --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 - .../godmode/reporting/graph_builder.main.php | 13 ----- .../godmode/reporting/graph_builder.php | 12 +--- .../include/functions_custom_graphs.php | 8 +-- pandora_console/include/functions_events.php | 2 +- pandora_console/include/functions_graph.php | 57 ++----------------- .../include/functions_reporting.php | 12 ++-- .../include/graphs/functions_flot.php | 3 +- pandora_console/pandoradb.sql | 2 - 9 files changed, 17 insertions(+), 94 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 159eb466f9..9fcc5f70c4 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1256,8 +1256,6 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %'; -- Table `tgraph` -- --------------------------------------------------------------------- ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0'; -ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0'; -ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tnetflow_filter` diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index 53f8d47835..9c95f2263b 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -66,8 +66,6 @@ if ($edit_graph) { $height = $graphInTgraph['height']; $check = false; $percentil = $graphInTgraph['percentil']; - $summatory_series = $graphInTgraph['summatory_series']; - $average_series = $graphInTgraph['average_series']; if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = CUSTOM_GRAPH_BULLET_CHART; @@ -86,8 +84,6 @@ else { $stacked = 4; $check = false; $percentil = 0; - $summatory_series = 0; - $average_series = 0; } @@ -178,15 +174,6 @@ echo ""; echo ""; -echo ""; -echo " -"; -echo ""; - echo ""; echo ""; diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 0d4cdcc2f9..317f562e6f 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -87,8 +87,6 @@ if ($add_graph) { $period = get_parameter_post ("period"); $threshold = get_parameter('threshold'); $percentil = get_parameter ("percentil", 0); - $summatory_series = get_parameter ("summatory_series", 0); - $average_series = get_parameter ("average_series", 0); if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = $threshold; @@ -105,9 +103,7 @@ if ($add_graph) { 'private' => 0, 'id_group' => $idGroup, 'stacked' => $stacked, - 'percentil' => $percentil, - 'summatory_series' => $summatory_series, - 'average_series' => $average_series + 'percentil' => $percentil ); if (trim($name) != "") { @@ -135,8 +131,6 @@ if ($update_graph) { $period = get_parameter('period'); $stacked = get_parameter('stacked'); $percentil = get_parameter('percentil'); - $summatory_series = get_parameter ("summatory_series"); - $average_series = get_parameter ("average_series"); $alerts = get_parameter('alerts'); $threshold = get_parameter('threshold'); @@ -147,9 +141,7 @@ if ($update_graph) { if (trim($name) != "") { $success = db_process_sql_update('tgraph', - array('name' => $name, 'id_group' => $id_group, 'description' => $description, - 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, - 'percentil' => $percentil, 'summatory_series' => $summatory_series, 'average_series' => $average_series), + array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ), array('id_graph' => $id_graph)); if ($success !== false) db_pandora_audit("Report management", "Update graph #$id_graph"); diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index f61a7ee944..adf077ec6a 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -202,10 +202,6 @@ function custom_graphs_print($id_graph, $height, $width, $period, $sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph', $id_graph); - $series = db_get_all_rows_sql('SELECT summatory_series,average_series FROM tgraph WHERE id_graph = '.$id_graph); - $summatory = $series[0]['summatory_series']; - $average = $series[0]['average_series']; - $modules = array (); $weights = array (); $labels = array (); @@ -266,9 +262,7 @@ function custom_graphs_print($id_graph, $height, $width, $period, $percentil, $from_interface, $id_widget_dashboard, - $fullscale, - $summatory, - $average); + $fullscale); if ($return) return $output; diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 58c11b1cc9..763f246bdf 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") { } else { $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0c9bd6ebfb..ccad237208 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1114,11 +1114,11 @@ function graphic_combined_module ($module_list, $weight_list, $period, $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, $show_min = true, $show_avg = true, $labels = array(), $dashboard = false, $vconsole = false, $percentil = null, $from_interface = false, - $id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0) { + $id_widget_dashboard=false, $fullscale = false) { global $config; global $graphic_type; - + if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; @@ -1204,8 +1204,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $weight_list[$i] = 1; } } - - $aux_array = array(); + // Set data containers for ($i = 0; $i < $resolution; $i++) { $timestamp = $datelimit + ($interval * $i);/* @@ -1257,12 +1256,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, // If its a projection graph, // first module will be data and second will be the projection - if ($projection != false && $i != 0) { if ($automatic_custom_graph_meta) $agent_module_id = $module_list[0]['module']; else $agent_module_id = $module_list[0]; + $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1273,6 +1272,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, else $agent_module_id = $module_list[$i]; + $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1345,21 +1345,6 @@ function graphic_combined_module ($module_list, $weight_list, $period, continue; } - // if(empty($aux_array)){ - // foreach ($data as $key => $value) { - // $aux_array[$value['utimestamp']] = $value['datos']; - // } - // } else { - // foreach ($data as $key => $value) { - // if(array_key_exists($value['utimestamp'],$aux_array)){ - // $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos']; - // } else { - // $aux_array[$value['utimestamp']] = $value['datos']; - // } - // } - // } - - // html_debug($aux_array); if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { if ($labels[$agent_module_id] != '') $module_name_list[$i] = $labels[$agent_module_id]; @@ -2122,37 +2107,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $threshold_data['red_inverse'] = (bool)$red_inverse; } } - - //summatory and average series - if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) { - if($summatory && $average){ - foreach ($graph_values as $key => $value) { - $cont = count($value); - $summ = array_sum($value); - array_push($value,$summ); - array_push($value,$summ/$cont); - $graph_values[$key] = $value; - } - array_push($module_name_list,'' . __('summatory'). ''); - array_push($module_name_list,'' . __('average'). ''); - - } elseif($summatory) { - foreach ($graph_values as $key => $value) { - array_push($value,array_sum($value)); - $graph_values[$key] = $value; - } - array_push($module_name_list,'' . __('summatory'). ''); - - } elseif($average) { - foreach ($graph_values as $key => $value) { - $summ = array_sum($value) / count($value); - array_push($value,$summ); - $graph_values[$key] = $value; - } - array_push($module_name_list,'' . __('average'). ''); - } - } - + switch ($stacked) { case CUSTOM_GRAPH_AREA: return area_graph($flash_charts, $graph_values, $width, diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c8e2d00d99..26ea84367a 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -7763,19 +7763,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he if ($links === false) { $urls = array(); $urls['monitor_critical'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; $urls['monitor_warning'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; $urls['monitor_ok'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; $urls['monitor_unknown'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; $urls['monitor_not_init'] = "index.php?" . - "sec=view&sec2=operation/agentes/status_monitor&" . + "sec=estado&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; } else { @@ -7875,7 +7875,7 @@ function reporting_get_stats_agents_monitors($data) { else { $urls = array(); $urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; - $urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1"; + $urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; } // Agents and modules table diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index a0da140dbd..4f8943ed8f 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -185,7 +185,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, include_javascript_dependencies_flot_graph(); $menu = (int)$menu; - html_debug($legend); + // Get a unique identifier to graph $graph_id = uniqid('graph_'); @@ -500,7 +500,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $short_data = false; } - // Javascript code $return .= "
' . __('Agent') . '' . ui_print_agent_autocomplete_input($params) . '' . + __('Agent') . '' . + ui_print_agent_autocomplete_input($params) . + '' . __('Agent') . '' . __('Agent') . '
".__('Add summatory series')."" . - ui_print_help_tip (__("This will add a synthetic series to the graph, - using all series to give a SUM or an average of all present series values - in each interval. This feature could be used instead synthetic modules - if you only want to see a graph"), true)."" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "".__('Add average series')."" . html_print_checkbox ("average_series", 1, $average_series, true) . "
".__('Percentil')."" . html_print_checkbox ("percentil", 1, $percentil, true) . "