From 9dbc693d2bf7432cc1c064ee7e3311d2cfded167 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Thu, 7 Mar 2019 16:50:36 +0100 Subject: [PATCH 01/60] Arreglado leyenda Former-commit-id: eb893efbb586d0852531e9e52fe2e1c9ee64d010 --- pandora_console/include/functions_graph.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 71049d7804..bf28373284 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1834,7 +1834,7 @@ function graphic_combined_module( $label = $params_combined['labels'][$module]; } else { $alias = db_get_value('alias', 'tagente', 'id_agente', $module_data['id_agente']); - $label = $alias.' - '.$module_data['nombre']; + $label = $module_data['nombre']; } $temp[$label]['g'] = round($temp_data, 4); From a21f2fc96db2c52cd85057c5d29be6202ea3baa5 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Mon, 11 Mar 2019 13:43:37 +0100 Subject: [PATCH 02/60] Resolved Former-commit-id: 4d15a55f166cdc9b111379b0b2302ac74e836bdb --- pandora_console/include/functions_events.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index fa8287f406..93fb704a6c 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3169,8 +3169,7 @@ function events_page_general($event) $table_general->data[] = $data; - $event['owner_user'] = $event['id_usuario']; - + // $event['owner_user'] = $event['id_usuario']; $data = []; $data[0] = __('Owner'); if (empty($event['owner_user'])) { From bf18d0374c3100f80855e9b9389c8bbece878af1 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Mon, 11 Mar 2019 13:49:45 +0100 Subject: [PATCH 03/60] changed wrong php Former-commit-id: 311c78efd112c85494885f9a01ac6b3e6e15d163 --- pandora_console/include/functions_graph.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index bf28373284..71049d7804 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1834,7 +1834,7 @@ function graphic_combined_module( $label = $params_combined['labels'][$module]; } else { $alias = db_get_value('alias', 'tagente', 'id_agente', $module_data['id_agente']); - $label = $module_data['nombre']; + $label = $alias.' - '.$module_data['nombre']; } $temp[$label]['g'] = round($temp_data, 4); From 45b0392d8da2d58736ca63133f45fe1d79fdd836 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Tue, 12 Mar 2019 15:12:43 +0100 Subject: [PATCH 04/60] Removed unnecesary io_safe_inpunt on from functions_api.php Former-commit-id: 3120967c09d6629f0c1a1197d122a7e11788fbb7 --- pandora_console/include/functions_api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index e57dd31013..98f12faad7 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -11620,7 +11620,7 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) returnError('error_parameter', 'Error in the parameters.'); return; } else if ($other['type'] == 'array') { - $comment = io_safe_input($other['data'][0]); + $comment = $other['data'][0]; $meta = $other['data'][1]; $history = $other['data'][2]; From df85b0f700e32b31b1cab1bf5d24988b490694e2 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Tue, 19 Mar 2019 16:09:59 +0100 Subject: [PATCH 05/60] fixed SLA weekly hourly and monthly Former-commit-id: 9c04c8f55b080d6d12f3b3868e7d96660db76470 --- .../include/functions_reporting.php | 58 ++++++++++++++++--- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index e0b719006e..511a3a44a9 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11436,33 +11436,35 @@ function reporting_sla_is_ignored_from_array($sla_array) * * @return integer Status */ -function reporting_sla_get_status_period($sla_times, $priority_mode=REPORT_PRIORITY_MODE_OK) -{ - if ($sla_times['time_error'] > 0) { +function reporting_sla_get_status_period( + $sla, + $priority_mode=REPORT_PRIORITY_MODE_OK +) { + if ($sla['time_error'] > 0) { return REPORT_STATUS_ERR; } - if ($priority_mode == REPORT_PRIORITY_MODE_OK && $sla_times['time_ok'] > 0) { + if ($priority_mode == REPORT_PRIORITY_MODE_OK && $sla['time_ok'] > 0) { return REPORT_STATUS_OK; } - if ($sla_times['time_out'] > 0) { + if ($sla['time_out'] > 0) { return REPORT_STATUS_IGNORED; } - if ($sla_times['time_downtime'] > 0) { + if ($sla['time_downtime'] > 0) { return REPORT_STATUS_DOWNTIME; } - if ($sla_times['time_unknown'] > 0) { + if ($sla['time_unknown'] > 0) { return REPORT_STATUS_UNKNOWN; } - if ($sla_times['time_not_init'] > 0) { + if ($sla['time_not_init'] > 0) { return REPORT_STATUS_NOT_INIT; } - if ($sla_times['time_ok'] > 0) { + if ($sla['time_ok'] > 0) { return REPORT_STATUS_OK; } @@ -11470,6 +11472,44 @@ function reporting_sla_get_status_period($sla_times, $priority_mode=REPORT_PRIOR } +/** + * @brief Given a period, get the SLA status + * of the period compare with sla_limit. + * + * @param Array An array with all times to calculate the SLA. + * @param int Limit SLA pass for user. + * Only used for monthly, weekly And hourly report. + * + * @return integer Status + */ +function reporting_sla_get_status_period_compliance( + $sla, + $sla_limit +) { + if ($sla['time_unknown'] == $sla['time_total']) { + return REPORT_STATUS_UNKNOWN; + } + + if ($sla['time_not_init'] == $sla['time_total']) { + return REPORT_STATUS_NOT_INIT; + } + + if ($sla['time_downtime'] == $sla['time_total']) { + return REPORT_STATUS_DOWNTIME; + } + + if ($sla['SLA'] >= $sla_limit) { + return REPORT_STATUS_OK; + } + + if ($sla['SLA'] < $sla_limit) { + return REPORT_STATUS_ERR; + } + + return REPORT_STATUS_IGNORED; +} + + /** * @brief Translate the status to the color to graph_sla_slicebar function * From 6121c2a32b28d1649f8f22f69e12afce64f7e5fb Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 19 Mar 2019 17:16:31 +0100 Subject: [PATCH 06/60] Added types reports to send email Former-commit-id: 7d2f349c47d81de454cb5464146d4f0ac2fc3fb6 --- pandora_console/extras/mr/27.sql | 6 ++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 9 +++++++-- .../godmode/reporting/reporting_builder.php | 8 +++----- pandora_console/include/functions_reporting.php | 4 ++-- .../include/functions_reporting_xml.php | 14 ++++++++------ pandora_console/pandoradb_data.sql | 4 ++-- 6 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 pandora_console/extras/mr/27.sql diff --git a/pandora_console/extras/mr/27.sql b/pandora_console/extras/mr/27.sql new file mode 100644 index 0000000000..f85064c9eb --- /dev/null +++ b/pandora_console/extras/mr/27.sql @@ -0,0 +1,6 @@ +START TRANSACTION; + +UPDATE tuser_task SET parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report"; + + +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 822134c54d..f0e504a6b9 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 @@ -1199,13 +1199,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned; INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 26); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 27); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; -INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '733'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '734'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); -- --------------------------------------------------------------------- @@ -2041,3 +2041,8 @@ INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Di -- Add column in table `tagent_custom_fields` -- ---------------------------------------------------------------------- ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ''; + +-- ---------------------------------------------------------------------- +-- Update table `tuser_task` +-- ---------------------------------------------------------------------- +UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report"; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index fd64d9ac5e..1aa7804860 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -117,10 +117,10 @@ if ($schedule_report != '') { $date = date(DATE_FORMAT); $time = date(TIME_FORMAT); $parameters[0] = get_parameter('id_schedule_report'); - // $parameters[1] = db_get_value('schedule_email', 'treport', 'id_report', $id_report); $parameters[1] = get_parameter('schedule_email_address'); $parameters[2] = get_parameter('schedule_subject', ''); $parameters[3] = get_parameter('schedule_email', ''); + $parameters[4] = get_parameter('report_type', ''); $parameters['first_execution'] = strtotime($date.' '.$time); $values = [ @@ -141,7 +141,7 @@ if ($schedule_report != '') { echo '
'; } -// Other Checks for the edit the reports +// Other Checks for the edit the reports. if ($idReport != 0) { $report = db_get_row_filter('treport', ['id_report' => $idReport]); $type_access_selected = reports_get_type_access($report); @@ -293,7 +293,7 @@ switch ($action) { $temp = []; foreach ($items as $item) { - // Remove the contents from the block to sort + // Remove the contents from the block to sort. if (array_search($item['id_rc'], $ids) === false) { $temp[$item['order']] = $item['id_rc']; } @@ -1298,7 +1298,6 @@ switch ($action) { $values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['id_module_group'] = get_parameter('combo_modulegroup'); $values['id_group'] = get_parameter('combo_group'); - $values['show_extended_events'] = get_parameter('include_extended_events'); $values['server_name'] = get_parameter('server_name'); $server_id = (int) get_parameter('server_id'); if ($server_id != 0) { @@ -1690,7 +1689,6 @@ switch ($action) { $values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['id_module_group'] = get_parameter('combo_modulegroup'); $values['id_group'] = get_parameter('combo_group'); - $values['show_extended_events'] = get_parameter('include_extended_events'); if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index f65849bb54..e2d244e3d4 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -7770,11 +7770,11 @@ function reporting_get_agents_detailed_event( foreach ($events as $eventRow) { foreach ($eventRow as $k => $event) { - // First pass along the class of this row + // First pass along the class of this row. $table->cellclass[$k][1] = $table->cellclass[$k][2] = $table->cellclass[$k][4] = $table->cellclass[$k][5] = $table->cellclass[$k][6] = get_priority_class($event['criticity']); $data = []; - // Colored box + // Colored box. switch ($event['estado']) { case 0: $img_st = 'images/star.png'; diff --git a/pandora_console/include/functions_reporting_xml.php b/pandora_console/include/functions_reporting_xml.php index d1b28ac2a0..565fac557a 100644 --- a/pandora_console/include/functions_reporting_xml.php +++ b/pandora_console/include/functions_reporting_xml.php @@ -31,7 +31,7 @@ function reporting_xml_get_report($report, $filename, $return=false) unset($report['private']); unset($report['custom_logo']); // ---------------------------------------------------------------------- - // change agent name + // change agent name. if (count($report['contents']) > 0) { for ($i = 0; $i < count($report['contents']); $i++) { $aux = explode('-', $report['contents'][$i]['subtitle']); @@ -44,16 +44,18 @@ function reporting_xml_get_report($report, $filename, $return=false) $xml = preg_replace('/(<[^>]+>)(<[^>]+>)(<[^>]+>)/', "$1\n$2\n$3", $xml); $xml = preg_replace('/(<[^>]+>)(<[^>]+>)/', "$1\n$2", $xml); - // Return if is marked to return + // Return if is marked to return. if ($return) { return $xml; } - // Download if marked to download - header('Content-Type: application/xml; charset=UTF-8'); - header('Content-Disposition: attachment; filename="'.$filename.'.xml"'); + // Download if marked to download. + if ($filename === false) { + header('Content-Type: application/xml; charset=UTF-8'); + header('Content-Disposition: attachment; filename="'.$filename.'.xml"'); + } - // Clean the output buffer + // Clean the output buffer. ob_clean(); echo $xml; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index ee4ad45c06..f98cc3b511 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -114,10 +114,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_header', ''), ('custom_report_front_footer', ''), -('MR', 26), +('MR', 27), ('identification_reminder', 1), ('identification_reminder_timestamp', 0), -('current_package_enterprise', '733'), +('current_package_enterprise', '734'), ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'), ('custom_docs_logo', 'default_docs.png'), ('custom_support_logo', 'default_support.png'), From 1fe1beb930337770170bce177105020bdb3c06bb Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Wed, 20 Mar 2019 09:51:15 +0100 Subject: [PATCH 07/60] fixed IPAM config Former-commit-id: 39b80d2ca41c21a823cdec5948e30109a81eeb2a --- pandora_console/include/functions_config.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 9ba9ace3ff..f388d74f16 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -81,11 +81,6 @@ function config_update_value($token, $value) $value = ($value); } - if (!isset($config[$token])) { - $config[$token] = $value; - return (bool) config_create_value($token, io_safe_input($value)); - } - // If it has not changed. if ($config[$token] == $value) { return true; @@ -100,10 +95,18 @@ function config_update_value($token, $value) ['token' => $token] ); - if ($result === 0) { + if ($result == 0) { return true; } else { - return (bool) $result; + if (!isset($config[$token])) { + $config[$token] = $value; + return (bool) config_create_value( + $token, + io_safe_input($value) + ); + } else { + return (bool) $result; + } } } From 05ab375f8ae8f291901e301964abb91569cf8d4e Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 20 Mar 2019 11:32:25 +0100 Subject: [PATCH 08/60] Fixed bug in meta Former-commit-id: abccf5d87390bdb9981928e975947fe3ad71cc70 --- pandora_console/include/functions_cron.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/include/functions_cron.php b/pandora_console/include/functions_cron.php index e56a3d4a52..4bb7f5c752 100644 --- a/pandora_console/include/functions_cron.php +++ b/pandora_console/include/functions_cron.php @@ -429,8 +429,10 @@ function cron_list_table() } $email = $args[1]; + $report_type = $args[4]; $data[2] .= '
- '.__('Report').": "; $data[2] .= $report['name'].''; + $data[2] .= '
- '.__('Report type').': '.$report_type; $data[2] .= '
- '.__('Email').": "; $data[2] .= ui_print_truncate_text($email, 60, false).''; break; From 603f8a08e8d4b34f90468ca9aaa2c81998d9a95b Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 21 Mar 2019 13:15:21 +0100 Subject: [PATCH 09/60] Fixed bug in ACL setup section 2 Former-commit-id: a3d2f53cdc169fe7a5455368229e396451de0208 --- pandora_console/include/functions_menu.php | 77 +++++++++++----------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index ae090c6320..088f40168d 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -41,11 +41,11 @@ function menu_print_menu(&$menu) $allsec2 = $sec2; } - // Open list of menu + // Open list of menu. echo ''; // Use $config because a global var is required because normal - // and godmode menu are painted separately + // and godmode menu are painted separately. if (!isset($config['count_main_menu'])) { $config['count_main_menu'] = 0; } @@ -98,7 +98,7 @@ function menu_print_menu(&$menu) if (! $submenu) { $main['sub'] = []; - // Empty array won't go through foreach + // Empty array won't go through foreach. } $submenu_output = ''; @@ -110,12 +110,12 @@ function menu_print_menu(&$menu) foreach ($main['sub'] as $subsec2 => $sub) { $count_sub++; - // Init some variables + // Init some variables. $visible = false; $selected = false; $subsec2 = io_safe_output($subsec2); - // Choose valid suboptions (sec2) + // Choose valid suboptions (sec2). $check_2 = true; if (isset($sub['sub2'])) { $check_2 = false; @@ -125,7 +125,7 @@ function menu_print_menu(&$menu) continue; } - // We store the first subsection to use it if the main section has not access + // We store the first subsection to use it if the main section has not access. if ($count_sub_access == 0) { $first_sub_sec2 = $subsec2; } @@ -145,7 +145,7 @@ function menu_print_menu(&$menu) $sec2 = ' '; } - // Check if some submenu was selected to mark this (the parent) as selected + // Check if some submenu was selected to mark this (the parent) as selected. foreach (array_keys($sub['sub2']) as $key) { if (strpos($key, $sec2) !== false) { $selected_submenu2 = true; @@ -154,13 +154,13 @@ function menu_print_menu(&$menu) } } - // Create godmode option if submenu has godmode on + // Create godmode option if submenu has godmode on. if (isset($sub['subsecs'])) { // Sometimes you need to add all paths because in the // same dir are code from visual console and reports - // for example + // for example. if (is_array($sub['subsecs'])) { - // Compare each string + // Compare each string. foreach ($sub['subsecs'] as $god_path) { if (strpos($sec2, $god_path) !== false) { $selected_submenu2 = true; @@ -168,19 +168,19 @@ function menu_print_menu(&$menu) } } } else { - // If there is only a string just compare + // If there is only a string just compare. if (strpos($sec2, $sub['subsecs']) !== false) { $selected_submenu2 = true; } } } - // Set class + // Set class. if (($sec2 == $subsec2 || $allsec2 == $subsec2 || $selected_submenu2) && isset($sub[$subsec2]['options']) && ( get_parameter_get($sub[$subsec2]['options']['name']) == $sub[$subsec2]['options']['value']) ) { - // If the subclass is selected and there are options and that options value is true + // If the subclass is selected and there are options and that options value is true. $class .= 'submenu_selected selected'; $menu_selected = true; $selected = true; @@ -201,7 +201,7 @@ function menu_print_menu(&$menu) $selected = true; $visible = true; } else { - // Else it's not selected + // Else it's not selected. $class .= 'submenu_not_selected'; } @@ -209,7 +209,7 @@ function menu_print_menu(&$menu) $sub['refr'] = 0; } - // Define submenu class to draw tree image + // Define submenu class to draw tree image. if ($count_sub >= count($main['sub'])) { $sub_tree_class = 'submenu_text submenu_text_last'; } else { @@ -217,7 +217,7 @@ function menu_print_menu(&$menu) } if (isset($sub['type']) && $sub['type'] == 'direct') { - // This is an external link + // This is an external link. $submenu_output .= '
  • '; if (isset($sub['subtype']) && $sub['subtype'] == 'nolink') { @@ -228,7 +228,7 @@ function menu_print_menu(&$menu) $submenu_output .= '
    '.$sub['text'].'
    '; } } else { - // This is an internal link + // This is an internal link. if (isset($sub[$subsec2]['options'])) { $link_add = '&'.$sub[$subsec2]['options']['name'].'='.$sub[$subsec2]['options']['value']; } else { @@ -237,7 +237,7 @@ function menu_print_menu(&$menu) $submenu_output .= '
  • '; - // Ini Add icon extension + // Ini Add icon extension. $secExtension = null; if (array_key_exists('extension', $sub)) { $secExtensionBool = $sub['extension']; @@ -245,7 +245,7 @@ function menu_print_menu(&$menu) $secExtensionBool = false; } - // DISABLE SUBMENU IMAGES + // DISABLE SUBMENU IMAGES. $secExtensionBool = false; if ($secExtensionBool) { @@ -298,7 +298,7 @@ function menu_print_menu(&$menu) } } - // Print second level submenu + // Print second level submenu. if (isset($sub['sub2'])) { $submenu2_list = ''; @@ -324,7 +324,7 @@ function menu_print_menu(&$menu) $class .= ' selected'; } - // Define submenu2 class to draw tree image + // Define submenu2 class to draw tree image. if ($count_sub2 >= count($sub['sub2'])) { $sub_tree_class = 'submenu_text submenu2_text_last'; } else { @@ -342,7 +342,7 @@ function menu_print_menu(&$menu) $sub_title = ''; } - // Add submenu2 to submenu string + // Add submenu2 to submenu string. $submenu_output .= ''; @@ -352,7 +352,7 @@ function menu_print_menu(&$menu) $submenu_output .= '
  • '; } - // Choose valid section (sec) + // Choose valid section (sec). if (enterprise_hook('enterprise_acl', [$config['id_user'], $mainsec, $main['sec2']]) == false) { if ($count_sub_access > 0) { // If any susection have access but main section not, we change main link to first subsection found @@ -368,14 +368,14 @@ function menu_print_menu(&$menu) $seleccionado = ''; } - // Print out the first level + // Print out the first level. $output .= '
  • '; // onclick="location.href=\'index.php?sec='.$mainsec.'&sec2='.$main["sec2"].($main["refr"] ? '&refr='.$main["refr"] : '').'\'">'; $length = strlen(__($main['text'])); $padding_top = ( $length >= 18) ? 6 : 12; $output .= ''; - // Add the notification ball if defined + // Add the notification ball if defined. if (isset($main['notification'])) { $output .= '
    '.$main['notification'].'
    '; } @@ -384,7 +384,7 @@ function menu_print_menu(&$menu) $length = 0; // $output .= html_print_image("include/styles/images/toggle.png", true, array("class" => "toggle", "alt" => "toogle")); if ($submenu_output != '') { - // WARNING: IN ORDER TO MODIFY THE VISIBILITY OF MENU'S AND SUBMENU'S (eg. with cookies) YOU HAVE TO ADD TO THIS ELSEIF. DON'T MODIFY THE CSS + // WARNING: IN ORDER TO MODIFY THE VISIBILITY OF MENU'S AND SUBMENU'S (eg. with cookies) YOU HAVE TO ADD TO THIS ELSEIF. DON'T MODIFY THE CSS. if ($visible || in_array('selected', $classes)) { $visible = true; } @@ -404,9 +404,9 @@ function menu_print_menu(&$menu) $menu_selected = false; } - // Finish menu + // Finish menu. echo ''; - // Invisible UL for adding border-top + // Invisible UL for adding border-top. echo ''; } @@ -506,7 +506,7 @@ function menu_add_extras(&$menu) $menu_extra['workspace']['sub']['operation/incidents/incident_detail']['text'] = __('Manage incident'); - // Duplicate extensions as sec=extension to check it from url + // Duplicate extensions as sec=extension to check it from url. foreach ($menu as $k => $m) { if (!isset($m['sub'])) { continue; @@ -550,7 +550,7 @@ function menu_get_sec($with_categories=false) if ($with_categories) { if (!$in_godmode && $k[0] == 'g') { // Hack to dont confuse with gis activated because godmode - // sec starts with g (like gismaps) + // sec starts with g (like gismaps). if ($k != 'gismaps') { $in_godmode = true; } @@ -619,17 +619,17 @@ function menu_get_sec_pages($sec, $menu_hash=false) $sec2_array = []; if (isset($sec)) { - // Get the sec2 of the main section + // Get the sec2 of the main section. $sec2_array[$menu[$sec]['sec2']] = $menu[$sec]['text']; - // Get the sec2 of the subsections + // Get the sec2 of the subsections. foreach ($menu[$sec]['sub'] as $k => $v) { - // Avoid special cases of standalone windows + // Avoid special cases of standalone windows. if (preg_match('/^javascript:/', $k) || preg_match('/\.php/', $k)) { continue; } - // If this value has various parameters, we only get the first + // If this value has various parameters, we only get the first. $k = explode('&', $k); $k = $k[0]; @@ -637,6 +637,7 @@ function menu_get_sec_pages($sec, $menu_hash=false) } } + $sec2_array = array_unique($sec2_array); return $sec2_array; } @@ -663,8 +664,8 @@ function menu_get_sec2_pages($sec, $sec2, $menu_hash=false) $sec3_array = []; - if (isset($menu[$sec]['sub']) and isset($menu[$sec]['sub'][$sec2]['sub2'])) { - // Get the sec2 of the subsections + if (isset($menu[$sec]['sub']) && isset($menu[$sec]['sub'][$sec2]['sub2'])) { + // Get the sec2 of the subsections. foreach ($menu[$sec]['sub'][$sec2]['sub2'] as $k => $v) { $sec3_array[$k] = $v['text']; } @@ -686,7 +687,7 @@ function menu_sec2_in_sec($sec, $sec2) { $sec2_array = menu_get_sec_pages($sec); - // If this value has various parameters, we only get the first + // If this value has various parameters, we only get the first. $sec2 = explode('&', $sec2); $sec2 = $sec2[0]; @@ -702,7 +703,7 @@ function menu_sec3_in_sec2($sec, $sec2, $sec3) { $sec3_array = menu_get_sec2_pages($sec, $sec2, $menu_hash = false); - // If this value has various parameters, we only get the first + // If this value has various parameters, we only get the first. $sec3 = explode('&', $sec3); $sec3 = $sec3[0]; From da684fecd2d51af9f8eab6dcffe90015c6d0c045 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Mon, 25 Mar 2019 09:04:22 +0100 Subject: [PATCH 10/60] fixed sla status in graph monthly weekly hourly Former-commit-id: 8cd977e5f1b69c199fc1a5cb2cf405715bd4b4b1 --- .../include/functions_reporting.php | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 511a3a44a9..1c01928523 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11486,24 +11486,46 @@ function reporting_sla_get_status_period_compliance( $sla, $sla_limit ) { - if ($sla['time_unknown'] == $sla['time_total']) { - return REPORT_STATUS_UNKNOWN; + global $config; + + $time_compliance = ( + $sla['time_ok'] + $sla['time_unknown'] + $sla['time_downtime'] + ); + + $time_total_working = ( + $time_compliance + $sla['time_error'] + ); + + $time_compliance = ($time_compliance == 0) ? 0 : (($time_compliance / $time_total_working) * 100); + + if ($sla['time_error'] > 0 && ($time_compliance < $sla_limit)) { + return REPORT_STATUS_ERR; } - if ($sla['time_not_init'] == $sla['time_total']) { - return REPORT_STATUS_NOT_INIT; - } - - if ($sla['time_downtime'] == $sla['time_total']) { - return REPORT_STATUS_DOWNTIME; - } - - if ($sla['SLA'] >= $sla_limit) { + if ($priority_mode == REPORT_PRIORITY_MODE_OK + && $sla['time_ok'] > 0 && ($time_compliance >= $sla_limit) + ) { return REPORT_STATUS_OK; } - if ($sla['SLA'] < $sla_limit) { - return REPORT_STATUS_ERR; + if ($sla['time_out'] > 0 && ($time_compliance < $sla_limit)) { + return REPORT_STATUS_IGNORED; + } + + if ($sla['time_downtime'] > 0 && ($time_compliance < $sla_limit)) { + return REPORT_STATUS_DOWNTIME; + } + + if ($sla['time_unknown'] > 0 && ($time_compliance < $sla_limit)) { + return REPORT_STATUS_UNKNOWN; + } + + if ($sla['time_not_init'] > 0 && ($time_compliance < $sla_limit)) { + return REPORT_STATUS_NOT_INIT; + } + + if ($sla['time_ok'] > 0 && ($time_compliance >= $sla_limit)) { + return REPORT_STATUS_OK; } return REPORT_STATUS_IGNORED; From 34b057befd5a9c0c6c1920605ff6a6b262a7bdf7 Mon Sep 17 00:00:00 2001 From: samucarc Date: Tue, 26 Mar 2019 11:18:15 +0100 Subject: [PATCH 11/60] Fixed errors in Diagnostic tool Former-commit-id: a82e827df2266c0962df62ee44ad35dc1e0d04d6 --- pandora_console/extras/pandora_diag.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index d6cd017087..10e9fbfd42 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -139,7 +139,7 @@ function get_logs_size($file) function get_status_logs($path) { $status_server_log = ''; - $size_server_log = number_format(get_logs_size($path)); + $size_server_log = get_logs_size($path); if ($size_server_log <= 1048576) { $status_server_log = "Normal Status   You have less than 10 MB of logs"; } else { @@ -157,9 +157,9 @@ function percentage_modules_per_agent() $total_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo'); $average_modules_per_agent = ($total_modules / $total_agents); if ($average_modules_per_agent <= 40) { - $status_average_modules = "Normal Status   The average of modules per agent is less than 40 percent"; + $status_average_modules = "Normal Status   The average of modules per agent is less than 40"; } else { - $status_average_modules = "Warning Status  The average of modules per agent is more than 40 percent. You can have performance problems"; + $status_average_modules = "Warning Status  The average of modules per agent is more than 40. You can have performance problems"; } return $status_average_modules; @@ -202,9 +202,9 @@ function interval_average_of_network_modules() $average_time = ((int) $total_module_interval_time / $total_network_modules); if ($average_time < 180) { - $status_average_modules = "Warning Status   The system has a lot of load and a very fine configuration is required"; + $status_average_modules = "Warning Status   The system has a lot of load (average time $average_time) and a very fine configuration is required"; } else { - $status_average_modules = "Normal Status   The system has an acceptable charge"; + $status_average_modules = "Normal Status   The system has an acceptable charge (average time $average_time) "; } if ($average_time == 0) { @@ -274,6 +274,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { } $path_server_logs = '/log/pandora/pandora_server.log'; +$path_err_logs = '/log/pandora/pandora_server.error'; $path_console_logs = '/www/html/pandora_console/pandora_console.log'; $innodb_log_file_size_min_rec_value = '64M'; $innodb_log_buffer_size_min_rec_value = '16M'; @@ -710,6 +711,8 @@ render_info_data( render_row(number_format((get_logs_size($path_server_logs) / 1048576), 3).'M', 'Size server logs (current value)'); render_row(get_status_logs($path_server_logs), 'Status server logs'); + render_row(number_format((get_logs_size($path_err_logs) / 1048576), 3).'M', 'Size error logs (current value)'); + render_row(get_status_logs($path_err_logs), 'Status error logs'); render_row(number_format((get_logs_size($path_console_logs) / 1048576), 3).'M', 'Size console logs (current value)'); render_row(get_status_logs($path_console_logs), 'Status console logs'); From a3865a31810365c792c5bec4df993a3a69d71b5a Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Wed, 27 Mar 2019 18:16:53 +0100 Subject: [PATCH 12/60] flip flop keep counters Former-commit-id: 0d39875c7a78f4be07fdffcf76a686007333c626 --- pandora_console/extras/mr/27.sql | 23 ++++ .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 17 +++ .../godmode/agentes/configurar_agente.php | 3 + .../godmode/agentes/module_manager_editor.php | 2 + .../agentes/module_manager_editor_common.php | 60 ++++++++-- .../modules/manage_network_components.php | 3 + .../manage_network_components_form.php | 3 + .../manage_network_components_form_common.php | 53 ++++++++- pandora_console/pandoradb.sql | 16 +++ pandora_server/lib/PandoraFMS/Core.pm | 108 ++++++++++++------ 10 files changed, 238 insertions(+), 50 deletions(-) create mode 100644 pandora_console/extras/mr/27.sql diff --git a/pandora_console/extras/mr/27.sql b/pandora_console/extras/mr/27.sql new file mode 100644 index 0000000000..a2c721cd5f --- /dev/null +++ b/pandora_console/extras/mr/27.sql @@ -0,0 +1,23 @@ +START TRANSACTION; + +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; + +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_normal` int(4) unsigned default '0'; + +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_warning` int(4) unsigned default '0'; + +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_critical` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_critical` int(4) unsigned 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 6e5e2ebcc9..4aed6f9000 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 @@ -58,6 +58,11 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` ( ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; + -- ----------------------------------------------------- -- Table `tpolicy_modules` @@ -136,6 +141,10 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` ( ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -- --------------------------------------------------------------------- -- Table `tpolicies` @@ -1260,6 +1269,10 @@ ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0; ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0; +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -- --------------------------------------------------------------------- -- Table `tagente_datos` @@ -1279,6 +1292,10 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_max` int(4) default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -- --------------------------------------------------------------------- -- Table `tagente` diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 9c10099042..c0a9c27c41 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1320,6 +1320,7 @@ if ($update_module || $create_module) { $ff_event_normal = (int) get_parameter('ff_event_normal'); $ff_event_warning = (int) get_parameter('ff_event_warning'); $ff_event_critical = (int) get_parameter('ff_event_critical'); + $ff_type = (int) get_parameter('ff_type'); $each_ff = (int) get_parameter('each_ff'); $ff_timeout = (int) get_parameter('ff_timeout'); $unit = (string) get_parameter('unit_select'); @@ -1482,6 +1483,7 @@ if ($update_module) { 'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_critical' => $ff_event_critical, + 'ff_type' => $ff_type, 'each_ff' => $each_ff, 'ff_timeout' => $ff_timeout, 'unit' => io_safe_output($unit), @@ -1677,6 +1679,7 @@ if ($create_module) { 'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_critical' => $ff_event_critical, + 'ff_type' => $ff_type, 'each_ff' => $each_ff, 'ff_timeout' => $ff_timeout, 'unit' => io_safe_output($unit), diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index aaa2078479..9d49bb0a96 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -249,6 +249,7 @@ if ($id_agent_module) { $ff_event_normal = $module['min_ff_event_normal']; $ff_event_warning = $module['min_ff_event_warning']; $ff_event_critical = $module['min_ff_event_critical']; + $ff_type = $module['ff_type']; $each_ff = $module['each_ff']; $ff_timeout = $module['ff_timeout']; // Select tag info. @@ -393,6 +394,7 @@ if ($id_agent_module) { $ff_event_normal = ''; $ff_event_warning = ''; $ff_event_critical = ''; + $ff_type = 0; $id_category = 0; diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 892228042a..1724ee6622 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -496,10 +496,28 @@ if (modules_is_string_type($id_module_type) || $edit) { $table_simple->data[5][1] .= '
    '.__('Inverse interval').''; $table_simple->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy); -// FF stands for Flip-flop -$table_simple->data[6][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true); +// FF stands for Flip-flop. +$table_simple->data[6][0] = __('FF threshold').' '; +$table_simple->data[6][0] .= ui_print_help_icon('ff_threshold', true); -$table_simple->data[6][1] = html_print_radio_button('each_ff', 0, '', $each_ff, true, $disabledBecauseInPolicy).' '.__('All state changing').' : '; +$table_simple->data[6][1] .= __('Keep counters'); +$table_simple->data[6][1] .= html_print_checkbox( + 'ff_type', + 1, + $ff_type, + true, + $disabledBecauseInPolicy +).'
    '; + +$table_simple->data[6][1] .= html_print_radio_button( + 'each_ff', + 0, + '', + $each_ff, + true, + $disabledBecauseInPolicy +); +$table_simple->data[6][1] .= ' '.__('All state changing').' : '; $table_simple->data[6][1] .= html_print_input_text( 'ff_event', $ff_event, @@ -512,7 +530,16 @@ $table_simple->data[6][1] .= html_print_input_text( '', $classdisabledBecauseInPolicy ).'
    '; -$table_simple->data[6][1] .= html_print_radio_button('each_ff', 1, '', $each_ff, true, $disabledBecauseInPolicy).' '.__('Each state changing').' : '; +$table_simple->data[6][1] .= html_print_radio_button( + 'each_ff', + 1, + '', + $each_ff, + true, + $disabledBecauseInPolicy +); + +$table_simple->data[6][1] .= ' '.__('Each state changing').' : '; $table_simple->data[6][1] .= __('To normal'); $table_simple->data[6][1] .= html_print_input_text( 'ff_event_normal', @@ -526,6 +553,7 @@ $table_simple->data[6][1] .= html_print_input_text( '', $classdisabledBecauseInPolicy ).' '; + $table_simple->data[6][1] .= __('To warning'); $table_simple->data[6][1] .= html_print_input_text( 'ff_event_warning', @@ -539,6 +567,7 @@ $table_simple->data[6][1] .= html_print_input_text( '', $classdisabledBecauseInPolicy ).' '; + $table_simple->data[6][1] .= __('To critical'); $table_simple->data[6][1] .= html_print_input_text( 'ff_event_critical', @@ -552,16 +581,31 @@ $table_simple->data[6][1] .= html_print_input_text( '', $classdisabledBecauseInPolicy ); + $table_simple->data[7][0] = __('Historical data'); if ($disabledBecauseInPolicy) { - // If is disabled, we send a hidden in his place and print a false checkbox because HTML dont send disabled fields and could be disabled by error - $table_simple->data[7][1] = html_print_checkbox('history_data_fake', 1, $history_data, true, $disabledBecauseInPolicy); + // If is disabled, we send a hidden in his place and print a false + // checkbox because HTML dont send disabled fields + // and could be disabled by error. + $table_simple->data[7][1] = html_print_checkbox( + 'history_data_fake', + 1, + $history_data, + true, + $disabledBecauseInPolicy + ); $table_simple->data[7][1] .= ''; } else { - $table_simple->data[7][1] = html_print_checkbox('history_data', 1, $history_data, true, $disabledBecauseInPolicy); + $table_simple->data[7][1] = html_print_checkbox( + 'history_data', + 1, + $history_data, + true, + $disabledBecauseInPolicy + ); } -// Advanced form part +// Advanced form part. $table_advanced = new stdClass(); $table_advanced->id = 'advanced'; $table_advanced->width = '100%'; diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index f1fae1785d..ab2063fe35 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -124,6 +124,7 @@ $pure = get_parameter('pure', 0); $ff_event_normal = (int) get_parameter('ff_event_normal'); $ff_event_warning = (int) get_parameter('ff_event_warning'); $ff_event_critical = (int) get_parameter('ff_event_critical'); +$ff_type = (int) get_parameter('ff_type'); $each_ff = (int) get_parameter('each_ff'); if (count($id_tag_selected) == 1 && empty($id_tag_selected[0])) { @@ -261,6 +262,7 @@ if ($create_component) { 'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_critical' => $ff_event_critical, + 'ff_type' => $ff_type, 'each_ff' => $each_ff, ] ); @@ -355,6 +357,7 @@ if ($update_component) { 'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_critical' => $ff_event_critical, + 'ff_type' => $ff_type, 'each_ff' => $each_ff, ] ); diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 3f9a33cb8a..fd922046d1 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -76,6 +76,7 @@ if ($create_network_from_module) { $ff_event_normal = $data_module['min_ff_event_normal']; $ff_event_warning = $data_module['min_ff_event_warning']; $ff_event_critical = $data_module['min_ff_event_critical']; + $ff_type = $data_module['ff_type']; $each_ff = $data_module['each_ff']; } @@ -134,6 +135,7 @@ if (isset($id)) { $ff_event_normal = $component['min_ff_event_normal']; $ff_event_warning = $component['min_ff_event_warning']; $ff_event_critical = $component['min_ff_event_critical']; + $ff_type = $component['ff_type']; $each_ff = $component['each_ff']; if ($type >= 15 && $type <= 18) { @@ -192,6 +194,7 @@ if (isset($id)) { $ff_event_normal = 0; $ff_event_warning = 0; $ff_event_critical = 0; + $ff_type = 0; $each_ff = 0; $snmp_version = 1; diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index 2e511c6f6f..7b33a0a275 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -233,7 +233,23 @@ $table->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inver $table->data[6][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true); $table->colspan[6][1] = 3; -$table->data[6][1] = html_print_radio_button('each_ff', 0, '', $each_ff, true).' '.__('All state changing').' : '; + +$table->data[6][1] = __('Keep counters'); +$table->data[6][1] .= html_print_checkbox( + 'ff_type', + 1, + $ff_type, + true +).'
    '; + +$table->data[6][1] .= html_print_radio_button( + 'each_ff', + 0, + '', + $each_ff, + true +).' '.__('All state changing').' : '; + $table->data[6][1] .= html_print_input_text( 'ff_event', $ff_event, @@ -242,13 +258,40 @@ $table->data[6][1] .= html_print_input_text( 15, true ).'
    '; -$table->data[6][1] .= html_print_radio_button('each_ff', 1, '', $each_ff, true).' '.__('Each state changing').' : '; +$table->data[6][1] .= html_print_radio_button( + 'each_ff', + 1, + '', + $each_ff, + true +).' '.__('Each state changing').' : '; $table->data[6][1] .= __('To normal'); -$table->data[6][1] .= html_print_input_text('ff_event_normal', $ff_event_normal, '', 5, 15, true).' '; +$table->data[6][1] .= html_print_input_text( + 'ff_event_normal', + $ff_event_normal, + '', + 5, + 15, + true +).' '; $table->data[6][1] .= __('To warning'); -$table->data[6][1] .= html_print_input_text('ff_event_warning', $ff_event_warning, '', 5, 15, true).' '; +$table->data[6][1] .= html_print_input_text( + 'ff_event_warning', + $ff_event_warning, + '', + 5, + 15, + true +).' '; $table->data[6][1] .= __('To critical'); -$table->data[6][1] .= html_print_input_text('ff_event_critical', $ff_event_critical, '', 5, 15, true); +$table->data[6][1] .= html_print_input_text( + 'ff_event_critical', + $ff_event_critical, + '', + 5, + 15, + true +); $table->data[7][0] = __('Historical data'); $table->data[7][1] = html_print_checkbox('history_data', 1, $history_data, true); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0ecc9b8f5d..457bef61d6 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -249,6 +249,10 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` ( `min_ff_event_normal` int(4) unsigned default '0', `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', + `ff_type` tinyint(1) unsigned default '0', + `ff_normal` int(4) unsigned default '0', + `ff_warning` int(4) unsigned default '0', + `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `ff_timeout` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', @@ -863,6 +867,10 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` ( `min_ff_event_normal` int(4) unsigned default '0', `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', + `ff_type` tinyint(1) unsigned default '0', + `ff_normal` int(4) unsigned default '0', + `ff_warning` int(4) unsigned default '0', + `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', `dynamic_max` int(4) default '0', @@ -2222,6 +2230,10 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` ( `min_ff_event_normal` int(4) unsigned default '0', `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', + `ff_type` tinyint(1) unsigned default '0', + `ff_normal` int(4) unsigned default '0', + `ff_warning` int(4) unsigned default '0', + `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `ff_timeout` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', @@ -2300,6 +2312,10 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` ( `min_ff_event_normal` int(4) unsigned default '0', `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', + `ff_type` tinyint(1) unsigned default '0', + `ff_normal` int(4) unsigned default '0', + `ff_warning` int(4) unsigned default '0', + `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `ff_timeout` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 2e79e4958c..3316cc2202 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1609,49 +1609,82 @@ sub pandora_process_module ($$$$$$$$$;$) { my $min_ff_event = $module->{'min_ff_event'}; my $current_utimestamp = time (); my $ff_timeout = $module->{'ff_timeout'}; + my $ff_warning = $module->{'ff_warning'}; + my $ff_critical = $module->{'ff_critical'}; + my $ff_normal = $module->{'ff_normal'}; - if ($module->{'each_ff'}) { - $min_ff_event = $module->{'min_ff_event_normal'} if ($new_status == 0); - $min_ff_event = $module->{'min_ff_event_critical'} if ($new_status == 1); - $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); - } - - if ($last_known_status == $new_status) { - # Avoid overflows - $status_changes = $min_ff_event if ($status_changes > $min_ff_event); + if ($module->{'ff_type'} == 0) { + if ($module->{'each_ff'}) { + $min_ff_event = $module->{'min_ff_event_normal'} if ($new_status == 0); + $min_ff_event = $module->{'min_ff_event_critical'} if ($new_status == 1); + $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); + } - $status_changes++; - if ($module_type =~ m/async/ && $min_ff_event != 0 && $ff_timeout != 0 && ($utimestamp - $ff_start_utimestamp) > $ff_timeout) { + if ($last_known_status == $new_status) { + # Avoid overflows + $status_changes = $min_ff_event if ($status_changes > $min_ff_event); + + $status_changes++; + if ($module_type =~ m/async/ && $min_ff_event != 0 && $ff_timeout != 0 && ($utimestamp - $ff_start_utimestamp) > $ff_timeout) { + $status_changes = 0; + $ff_start_utimestamp = $utimestamp; + } + } + else { $status_changes = 0; - $ff_start_utimestamp = $utimestamp; + $ff_start_utimestamp = $utimestamp if ($module_type =~ m/async/); + } + + # Active ff interval + if ($module->{'module_ff_interval'} != 0 && $status_changes < $min_ff_event) { + $current_interval = $module->{'module_ff_interval'}; + } + + # Change status + if ($status_changes >= $min_ff_event && $known_status != $new_status) { + generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $known_status, $dbh); + $status = $new_status; + + # Update module status count. + $mark_for_update = 1; + + # Safe mode execution. + if ($agent->{'safe_mode_module'} == $module->{'id_agente_modulo'}) { + safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh); + } + } + } else { + # Independent min_ff_event for all. + if ($module->{'each_ff'}) { + $min_ff_event = $module->{'min_ff_event_normal'} if ($new_status == 0); + $min_ff_event = $module->{'min_ff_event_critical'} if ($new_status == 1); + $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); + } + + if ($last_known_status == $new_status) { + $ff_normal = 0; + $ff_critical = 0; + $ff_warning = 0; + } else { + # Status change. + $ff_critical++ if ($new_status == 1); + $ff_warning++ if ($new_status == 2); + $ff_normal++ if ($new_status == 0); + } + + if ( ($new_status == 0 && $ff_normal >= $min_ff_event) + || ($new_status == 1 && $ff_critical >= $min_ff_event) + || ($new_status == 2 && $ff_warning >= $min_ff_event)) { + $status = $new_status; + $ff_normal = 0; + $ff_critical = 0; + $ff_warning = 0; } } - else { - $status_changes = 0; - $ff_start_utimestamp = $utimestamp if ($module_type =~ m/async/); - } - - # Active ff interval - if ($module->{'module_ff_interval'} != 0 && $status_changes < $min_ff_event) { - $current_interval = $module->{'module_ff_interval'}; - } - - # Change status - if ($status_changes >= $min_ff_event && $known_status != $new_status) { - generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $known_status, $dbh); - $status = $new_status; - # Update module status count. - $mark_for_update = 1; - - # Safe mode execution. - if ($agent->{'safe_mode_module'} == $module->{'id_agente_modulo'}) { - safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh); - } - } # Set not-init modules to normal status even if min_ff_event is not matched the first time they receive data. # if critical or warning status, just pass through here and wait the time min_ff_event will be matched. - elsif ($status == 4) { + if ($status == 4) { generate_status_event ($pa_config, $processed_data, $agent, $module, 0, $status, $known_status, $dbh); $status = 0; @@ -1692,10 +1725,11 @@ sub pandora_process_module ($$$$$$$$$;$) { status_changes = ?, utimestamp = ?, timestamp = ?, id_agente = ?, current_interval = ?, running_by = ?, last_execution_try = ?, last_try = ?, last_error = ?, - ff_start_utimestamp = ? + ff_start_utimestamp = ?, ff_normal = ?, ff_warning = ?, ff_critical = ? WHERE id_agente_modulo = ?', $processed_data, $status, $status, $new_status, $new_status, $status_changes, $current_utimestamp, $timestamp, $module->{'id_agente'}, $current_interval, $server_id, - $utimestamp, ($save == 1) ? $timestamp : $agent_status->{'last_try'}, $last_error, $ff_start_utimestamp, $module->{'id_agente_modulo'}); + $utimestamp, ($save == 1) ? $timestamp : $agent_status->{'last_try'}, $last_error, $ff_start_utimestamp, + $ff_normal, $ff_warning, $ff_critical, $module->{'id_agente_modulo'}); } # Save module data. Async and log4x modules are not compressed. From e3222626dca81b05fd513d4e141fbd8763960888 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Thu, 28 Mar 2019 09:49:16 +0100 Subject: [PATCH 13/60] fixed error in bbdd Former-commit-id: dddd4fc90a4d3847c04108ba4dcdd4988872066f --- pandora_console/extras/mr/27.sql | 17 +++-------------- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 13 +++---------- pandora_console/pandoradb.sql | 15 +++------------ 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/pandora_console/extras/mr/27.sql b/pandora_console/extras/mr/27.sql index a2c721cd5f..3b6391af07 100644 --- a/pandora_console/extras/mr/27.sql +++ b/pandora_console/extras/mr/27.sql @@ -5,19 +5,8 @@ ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned defaul ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; -ALTER TABLE `tagente_modulo` ADD COLUMN `ff_normal` int(4) unsigned default '0'; -ALTER TABLE `tnetwork_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; -ALTER TABLE `tlocal_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; -ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_normal` int(4) unsigned default '0'; - -ALTER TABLE `tagente_modulo` ADD COLUMN `ff_warning` int(4) unsigned default '0'; -ALTER TABLE `tnetwork_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; -ALTER TABLE `tlocal_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; -ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_warning` int(4) unsigned default '0'; - -ALTER TABLE `tagente_modulo` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -ALTER TABLE `tnetwork_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -ALTER TABLE `tlocal_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_critical` int(4) unsigned default '0'; +ALTER TABLE `tagente_estado` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tagente_estado` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tagente_estado` ADD COLUMN `ff_critical` int(4) unsigned 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 4aed6f9000..c5e1ad75e1 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 @@ -59,10 +59,6 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` ( ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; -ALTER TABLE `tlocal_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; -ALTER TABLE `tlocal_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; -ALTER TABLE `tlocal_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; - -- ----------------------------------------------------- -- Table `tpolicy_modules` @@ -142,9 +138,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` ( ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; -ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_normal` int(4) unsigned default '0'; -ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_warning` int(4) unsigned default '0'; -ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -- --------------------------------------------------------------------- -- Table `tpolicies` @@ -1159,6 +1152,9 @@ ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0 ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0; ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0; ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0; +ALTER TABLE `tagente_estado` ADD COLUMN `ff_normal` int(4) unsigned default '0'; +ALTER TABLE `tagente_estado` ADD COLUMN `ff_warning` int(4) unsigned default '0'; +ALTER TABLE `tagente_estado` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -- --------------------------------------------------------------------- -- Table `talert_actions` @@ -1293,9 +1289,6 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; -ALTER TABLE `tnetwork_component` ADD COLUMN `ff_normal` int(4) unsigned default '0'; -ALTER TABLE `tnetwork_component` ADD COLUMN `ff_warning` int(4) unsigned default '0'; -ALTER TABLE `tnetwork_component` ADD COLUMN `ff_critical` int(4) unsigned default '0'; -- --------------------------------------------------------------------- -- Table `tagente` diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 457bef61d6..fef32673b7 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -164,6 +164,9 @@ CREATE TABLE IF NOT EXISTS `tagente_estado` ( `last_known_status` tinyint(4) default 0, `last_error` int(4) NOT NULL default '0', `ff_start_utimestamp` bigint(20) default 0, + `ff_normal` int(4) unsigned default '0', + `ff_warning` int(4) unsigned default '0', + `ff_critical` int(4) unsigned default '0', `last_dynamic_update` bigint(20) NOT NULL default '0', `last_unknown_update` bigint(20) NOT NULL default '0', PRIMARY KEY (`id_agente_estado`), @@ -250,9 +253,6 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` ( `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', `ff_type` tinyint(1) unsigned default '0', - `ff_normal` int(4) unsigned default '0', - `ff_warning` int(4) unsigned default '0', - `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `ff_timeout` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', @@ -868,9 +868,6 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` ( `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', `ff_type` tinyint(1) unsigned default '0', - `ff_normal` int(4) unsigned default '0', - `ff_warning` int(4) unsigned default '0', - `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', `dynamic_max` int(4) default '0', @@ -2231,9 +2228,6 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` ( `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', `ff_type` tinyint(1) unsigned default '0', - `ff_normal` int(4) unsigned default '0', - `ff_warning` int(4) unsigned default '0', - `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `ff_timeout` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', @@ -2313,9 +2307,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` ( `min_ff_event_warning` int(4) unsigned default '0', `min_ff_event_critical` int(4) unsigned default '0', `ff_type` tinyint(1) unsigned default '0', - `ff_normal` int(4) unsigned default '0', - `ff_warning` int(4) unsigned default '0', - `ff_critical` int(4) unsigned default '0', `each_ff` tinyint(1) unsigned default '0', `ff_timeout` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0', From 783417cab5b45ed7e8cf1a06c18a3a3de6418122 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 28 Mar 2019 12:20:15 +0100 Subject: [PATCH 14/60] rollback agent_get_agents Former-commit-id: 95627afdb87777d0703fe57a82f7a3e0ec82b286 --- pandora_console/include/functions_agents.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index a2775f5bfb..67ad7b949c 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -434,15 +434,15 @@ function agents_get_agents( $filter_nogroup = $filter; // Get user groups - $groups = array_keys(users_get_groups($config['id_user'], $access, true)); + $groups = array_keys(users_get_groups($config['id_user'], $access, false)); // If no group specified, get all user groups - if (isset($filter['id_grupo']) === false) { + if (empty($filter['id_grupo'])) { $all_groups = true; $filter['id_grupo'] = $groups; } else if (! is_array($filter['id_grupo'])) { $all_groups = false; - // If group is specified but not allowed, return false. + // If group is specified but not allowed, return false if (! in_array($filter['id_grupo'], $groups)) { return false; } @@ -466,6 +466,11 @@ function agents_get_agents( $filter['id_group'] = $filter['id_grupo']; + if (in_array(0, $filter['id_grupo'])) { + unset($filter['id_grupo']); + unset($filter['id_group']); + } + if (!is_array($fields)) { $fields = []; $fields[0] = 'id_agente'; From 33197df731da78301d9dbb85adf9530b8c88181f Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Thu, 28 Mar 2019 17:33:49 +0100 Subject: [PATCH 15/60] add new functionality flipflop Former-commit-id: 00a71df0d228833dbe7211504e11418d91622d93 --- pandora_server/lib/PandoraFMS/Core.pm | 103 +++++++++++++++++--------- 1 file changed, 69 insertions(+), 34 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 3316cc2202..29d3f14f62 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1605,42 +1605,53 @@ sub pandora_process_module ($$$$$$$$$;$) { $current_interval = $module->{'module_interval'}; } - #Update module status + # Update module status. my $min_ff_event = $module->{'min_ff_event'}; my $current_utimestamp = time (); my $ff_timeout = $module->{'ff_timeout'}; - my $ff_warning = $module->{'ff_warning'}; - my $ff_critical = $module->{'ff_critical'}; - my $ff_normal = $module->{'ff_normal'}; - if ($module->{'ff_type'} == 0) { - if ($module->{'each_ff'}) { - $min_ff_event = $module->{'min_ff_event_normal'} if ($new_status == 0); - $min_ff_event = $module->{'min_ff_event_critical'} if ($new_status == 1); - $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); - } + # Counters. + my $ff_warning = $agent_status->{'ff_warning'}; + my $ff_critical = $agent_status->{'ff_critical'}; + my $ff_normal = $agent_status->{'ff_normal'}; + + if ($module->{'each_ff'}) { + $min_ff_event = $module->{'min_ff_event_normal'} if ($new_status == 0); + $min_ff_event = $module->{'min_ff_event_critical'} if ($new_status == 1); + $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); + } + + if ($last_known_status == $new_status) { + # Avoid overflows + $status_changes = $min_ff_event if ($status_changes > $min_ff_event && $module->{'ff_type'} == 0); - if ($last_known_status == $new_status) { - # Avoid overflows - $status_changes = $min_ff_event if ($status_changes > $min_ff_event); + $status_changes++; + if ($module_type =~ m/async/ && $min_ff_event != 0 && $ff_timeout != 0 && ($utimestamp - $ff_start_utimestamp) > $ff_timeout) { + # Only type ff with counters. + $status_changes = 0 if ($module->{'ff_type'} == 0); - $status_changes++; - if ($module_type =~ m/async/ && $min_ff_event != 0 && $ff_timeout != 0 && ($utimestamp - $ff_start_utimestamp) > $ff_timeout) { - $status_changes = 0; - $ff_start_utimestamp = $utimestamp; - } - } - else { - $status_changes = 0; - $ff_start_utimestamp = $utimestamp if ($module_type =~ m/async/); + $ff_start_utimestamp = $utimestamp; + + # Reset counters because expired timeout. + $ff_normal = 0; + $ff_critical = 0; + $ff_warning = 0; } + } + else { + # Only type ff with counters. + $status_changes = 0 if ($module->{'ff_type'} == 0); - # Active ff interval + $ff_start_utimestamp = $utimestamp if ($module_type =~ m/async/); + } + + if ($module->{'ff_type'} == 0) { + # Active ff interval. if ($module->{'module_ff_interval'} != 0 && $status_changes < $min_ff_event) { $current_interval = $module->{'module_ff_interval'}; } - # Change status + # Change status. if ($status_changes >= $min_ff_event && $known_status != $new_status) { generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $known_status, $dbh); $status = $new_status; @@ -1654,31 +1665,50 @@ sub pandora_process_module ($$$$$$$$$;$) { } } } else { - # Independent min_ff_event for all. - if ($module->{'each_ff'}) { - $min_ff_event = $module->{'min_ff_event_normal'} if ($new_status == 0); - $min_ff_event = $module->{'min_ff_event_critical'} if ($new_status == 1); - $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); - } - - if ($last_known_status == $new_status) { + if ($status == $new_status) { + # If the status is equal to the previous status reset the counters. $ff_normal = 0; $ff_critical = 0; $ff_warning = 0; } else { - # Status change. + # Sequential critical and normal status are needed + # if don't, reset counters. + if ($last_known_status == 1 && $new_status != 1) { + $ff_critical = 0; + } elsif ($last_known_status == 0 && $new_status != 0) { + $ff_normal = 0; + } + + # Increase counters. $ff_critical++ if ($new_status == 1); $ff_warning++ if ($new_status == 2); $ff_normal++ if ($new_status == 0); } - + if ( ($new_status == 0 && $ff_normal >= $min_ff_event) || ($new_status == 1 && $ff_critical >= $min_ff_event) || ($new_status == 2 && $ff_warning >= $min_ff_event)) { + # Change status generate event. + generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $known_status, $dbh); $status = $new_status; + + # Update module status count. + $mark_for_update = 1; + + # Safe mode execution. + if ($agent->{'safe_mode_module'} == $module->{'id_agente_modulo'}) { + safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh); + } + + # Reset counters because change status. $ff_normal = 0; $ff_critical = 0; $ff_warning = 0; + } else { + # Active ff interval + if ($module->{'module_ff_interval'} != 0) { + $current_interval = $module->{'module_ff_interval'}; + } } } @@ -1696,6 +1726,11 @@ sub pandora_process_module ($$$$$$$$$;$) { generate_status_event ($pa_config, $processed_data, $agent, $module, $known_status, $status, $known_status, $dbh); $status = $known_status; + # reset counters because change status. + $ff_normal = 0; + $ff_critical = 0; + $ff_warning = 0; + # Update module status count. $mark_for_update = 1; } From 2a96b610d964e60739f5aff6c8548d0916d04105 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 29 Mar 2019 00:01:24 +0100 Subject: [PATCH 16/60] Auto-updated build strings. Former-commit-id: eef26e4d622c8068249de564ee37638343f22dc0 --- 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/lib/PandoraFMS/PluginTools.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 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 305342f0d7..b9646f8787 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.733-190328 +Version: 7.0NG.733-190329 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 8b8ec904c5..fbb03a30e0 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.733-190328" +pandora_version="7.0NG.733-190329" 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 093bc078f5..859526fd73 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.733'; -use constant AGENT_BUILD => '190328'; +use constant AGENT_BUILD => '190329'; # 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 d2597d9f3e..9fd58997dc 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.733 -%define release 190328 +%define release 190329 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 fe756636b4..42df30ad4c 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.733 -%define release 190328 +%define release 190329 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 0e0229707f..c42d486127 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190328" +PI_BUILD="190329" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 410edf850f..258dbfafc1 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190328} +{190329} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 4eca7665c2..9678ac47e4 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.733(Build 190328)") +#define PANDORA_VERSION ("7.0NG.733(Build 190329)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 0e13be6bb3..9940dd61fd 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.733(Build 190328))" + VALUE "ProductVersion", "(7.0NG.733(Build 190329))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 1fd042be78..ce7d85e806 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.733-190328 +Version: 7.0NG.733-190329 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 c4e5d98fa3..6adb002182 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.733-190328" +pandora_version="7.0NG.733-190329" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a1b9b6e302..5f4fdda4ba 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190328'; +$build_version = 'PC190329'; $pandora_version = 'v7.0NG.733'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 6e6bbb4d77..8d74e18606 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 63d1381dc3..bc9516314f 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190328 +%define release 190329 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 04f8fad7d4..4f64ac25b3 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190328 +%define release 190329 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 7624727189..50f375f0f3 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190328" +PI_BUILD="190329" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 7e968333d2..36571a9c2c 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.733 PS190328"; +my $version = "7.0NG.733 PS190329"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 76adf73359..0cd7f59554 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.733 PS190328"; +my $version = "7.0NG.733 PS190329"; # save program name for logging my $progname = basename($0); From 05ce178854f40abbfc4691b56d2bf07e2b3b6d38 Mon Sep 17 00:00:00 2001 From: Fermin Date: Fri, 29 Mar 2019 11:51:51 +0100 Subject: [PATCH 17/60] Fixed week day cron in server Former-commit-id: cfbd3601904c85fa1112eaf0f2310edb53f9afe8 --- pandora_server/lib/PandoraFMS/Tools.pm | 82 +++++++++++--------------- 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index b086ab1fbd..af1059ebd4 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -1359,45 +1359,22 @@ sub cron_next_execution { } # Get day of the week and month from cron config - my ($mday, $wday) = (split (/\s/, $cron))[2, 4]; + my ($wday) = (split (/\s/, $cron))[4]; # Get current time and day of the week my $cur_time = time(); my $cur_wday = (localtime ($cur_time))[6]; - # Any day of the week - if ($wday eq '*') { - my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval); - return $nex_time - time(); - } - # A range? - else { - $wday = cron_get_closest_in_range ($cur_wday, $wday); + my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval); + + # Check the day + while (!cron_check_interval($wday, (localtime ($nex_time))[6])) { + # If it does not acomplish the day of the week, go to the next day. + $nex_time += 86400; + $nex_time = cron_next_execution_date ($cron, $nex_time, 0); } - # A specific day of the week - my $count = 0; - my $nex_time = $cur_time; - do { - $nex_time = cron_next_execution_date ($cron, $nex_time, $interval); - my $nex_time_wd = $nex_time; - my ($nex_mon, $nex_wday) = (localtime ($nex_time_wd))[4, 6]; - my $nex_mon_wd; - do { - # Check the day of the week - if ($nex_wday == $wday) { - return $nex_time_wd - time(); - } - - # Move to the next day of the month - $nex_time_wd += 86400; - ($nex_mon_wd, $nex_wday) = (localtime ($nex_time_wd))[4, 6]; - } while ($mday eq '*' && $nex_mon_wd == $nex_mon); - $count++; - } while ($count < 60); - - # Something went wrong, default to 5 minutes - return $interval; + return $nex_time - time(); } ############################################################################### # Get the number of seconds left to the next execution of the given cron entry. @@ -1409,6 +1386,30 @@ sub cron_check_syntax ($) { return ($cron =~ m/^(\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+$/); } ############################################################################### +# Check if a value is inside an interval. +############################################################################### +sub cron_check_interval { + my ($elem_cron, $elem_curr_time) = @_; + + # Return 1 if wildcard. + return 1 if ($elem_cron eq "*"); + + my ($down, $up) = cron_get_interval($elem_cron); + # Check if it is not a range + if (!defined($up)) { + return ($down == $elem_curr_time) ? 1 : 0; + } + + # Check if it is on the range + if ($down < $up) { + return 0 if ($elem_curr_time < $down || $elem_curr_time > $up); + } else { + return 0 if ($elem_curr_time > $down || $elem_curr_time < $up); + } + + return 1; +} +############################################################################### # Get the next execution date for the given cron entry in seconds since epoch. ############################################################################### sub cron_next_execution_date { @@ -1560,20 +1561,9 @@ sub cron_is_in_cron { #If there is no elements means that is in cron return 1 unless (defined($elem_cron) || defined($elem_curr_time)); - # Go to last element if current is a wild card - if ($elem_cron ne '*') { - my ($down, $up) = cron_get_interval($elem_cron); - # Check if there is no a range - return 0 if (!defined($up) && ($down != $elem_curr_time)); - # Check if there is on the range - if (defined($up)) { - if ($down < $up) { - return 0 if ($elem_curr_time < $down || $elem_curr_time > $up); - } else { - return 0 if ($elem_curr_time > $down || $elem_curr_time < $up); - } - } - } + # Check the element interval + return 0 unless (cron_check_interval($elem_cron, $elem_curr_time)); + return cron_is_in_cron(\@deref_elems_cron, \@deref_elems_curr_time); } ############################################################################### From 59300bd757379b5759112af4d4ca2d207abc9581 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Fri, 29 Mar 2019 13:24:22 +0100 Subject: [PATCH 18/60] Changed field for last contact to timestamp Former-commit-id: 41678b6c2541a05a92bcb4631eff00e6b60d5660 --- pandora_console/operation/agentes/estado_generalagente.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 18cb29027a..30705e7267 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -565,7 +565,7 @@ if (!empty($network_interfaces)) { $sqlLast_contact = sprintf( ' - SELECT last_try + SELECT timestamp FROM tagente_estado WHERE id_agente_modulo = '.$interface['status_module_id'] ); From b2e16848f9a1fbaccfac15d2fbab6b846da9b00a Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Fri, 29 Mar 2019 14:59:31 +0100 Subject: [PATCH 19/60] add new ff type Former-commit-id: b9ff391d6586e5844e78207d44cdf9b80c98ba7e --- .../godmode/agentes/agent_template.php | 1 + .../godmode/massive/massive_edit_modules.php | 111 +++++++++++++-- .../include/ajax/snmp_browser.ajax.php | 1 + pandora_console/include/functions_api.php | 129 +++++++++++------- pandora_server/lib/PandoraFMS/PluginTools.pm | 3 + 5 files changed, 189 insertions(+), 56 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_template.php b/pandora_console/godmode/agentes/agent_template.php index 64e78320f5..f4c93bb9f1 100644 --- a/pandora_console/godmode/agentes/agent_template.php +++ b/pandora_console/godmode/agentes/agent_template.php @@ -106,6 +106,7 @@ if (isset($_POST['template_id'])) { 'min_ff_event_normal' => $row2['min_ff_event_normal'], 'min_ff_event_warning' => $row2['min_ff_event_warning'], 'min_ff_event_critical' => $row2['min_ff_event_critical'], + 'ff_type' => $row2['ff_type'], ]; $name = $row2['name']; diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 568e74dbbb..917117aa1c 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -844,20 +844,110 @@ $table->data['edit1'][1] = ''; $table->data['edit6'][3] = html_print_extended_select_for_unit('unit', '-1', '', '', '0', '15', true, false, false, false, 1); - // FF stands for Flip-flop - $table->data['edit7'][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true); + // FF stands for Flip-flop. + $table->data['edit7'][0] = __('FF threshold').' '; + $table->data['edit7'][0] .= ui_print_help_icon( + 'ff_threshold', + true + ); + $table->colspan['edit7'][1] = 3; - $table->data['edit7'][1] = __('Mode').' '.html_print_select(['' => __('No change'), '1' => __('Each state changing'), '0' => __('All state changing')], 'each_ff', '', '', '', '', true).'
    '; - $table->data['edit7'][1] .= __('All state changing').' : '.html_print_input_text('min_ff_event', '', '', 5, 15, true).'
    '; + $table->data['edit7'][1] = __('Mode').' '; + $table->data['edit7'][1] .= html_print_select( + [ + '' => __('No change'), + '1' => __('Each state changing'), + '0' => __('All state changing'), + ], + 'each_ff', + '', + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 400px;' + ).'
    '; + + $table->data['edit7'][1] .= __('All state changing').' : '; + $table->data['edit7'][1] .= html_print_input_text( + 'min_ff_event', + '', + '', + 5, + 15, + true + ).'
    '; + $table->data['edit7'][1] .= __('Each state changing').' : '; - $table->data['edit7'][1] .= __('To normal').html_print_input_text('min_ff_event_normal', '', '', 5, 15, true).' '; - $table->data['edit7'][1] .= __('To warning').html_print_input_text('min_ff_event_warning', '', '', 5, 15, true).' '; - $table->data['edit7'][1] .= __('To critical').html_print_input_text('min_ff_event_critical', '', '', 5, 15, true).' '; + $table->data['edit7'][1] .= __('To normal').' '; + $table->data['edit7'][1] .= html_print_input_text( + 'min_ff_event_normal', + '', + '', + 5, + 15, + true + ).' '; + + $table->data['edit7'][1] .= __('To warning').' '; + $table->data['edit7'][1] .= html_print_input_text( + 'min_ff_event_warning', + '', + '', + 5, + 15, + true + ).' '; + + $table->data['edit7'][1] .= __('To critical').' '; + $table->data['edit7'][1] .= html_print_input_text( + 'min_ff_event_critical', + '', + '', + 5, + 15, + true + ).'
    '; + + $table->data['edit7'][1] .= __('Keep counters').' '; + $table->data['edit7'][1] .= html_print_checkbox( + 'ff_type', + 1, + 0, + true + ); $table->data['edit8'][0] = __('FF interval'); - $table->data['edit8'][1] = html_print_input_text('module_ff_interval', '', '', 5, 10, true).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true); + $table->data['edit8'][1] = html_print_input_text( + 'module_ff_interval', + '', + '', + 5, + 10, + true + ); + $table->data['edit8'][1] .= ui_print_help_tip( + __('Module execution flip flop time interval (in secs).'), + true + ); + $table->data['edit8'][2] = __('FF timeout'); - $table->data['edit8'][3] = html_print_input_text('ff_timeout', '', '', 5, 10, true).ui_print_help_tip(__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), true); + $table->data['edit8'][3] = html_print_input_text( + 'ff_timeout', + '', + '', + 5, + 10, + true + ); + $table->data['edit8'][3] .= ui_print_help_tip( + __('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), + true + ); $table->data['edit9'][0] = __('Historical data'); $table->data['edit9'][1] = html_print_select(['' => __('No change'), '1' => __('Yes'), '0' => __('No')], 'history_data', '', '', '', '', true); @@ -1685,7 +1775,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=' $agents_select = [$agents_select]; } - // List of fields which can be updated + // List of fields which can be updated. $fields = [ 'dynamic_interval', 'dynamic_max', @@ -1730,6 +1820,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=' 'min_ff_event_normal', 'min_ff_event_warning', 'min_ff_event_critical', + 'ff_type', 'each_ff', 'module_ff_interval', 'ff_timeout', diff --git a/pandora_console/include/ajax/snmp_browser.ajax.php b/pandora_console/include/ajax/snmp_browser.ajax.php index 11d233c676..85f8b3e68a 100644 --- a/pandora_console/include/ajax/snmp_browser.ajax.php +++ b/pandora_console/include/ajax/snmp_browser.ajax.php @@ -121,6 +121,7 @@ if (is_ajax()) { 'min_ff_event_normal' => 0, 'min_ff_event_warning' => 0, 'min_ff_event_critical' => 0, + 'ff_type' => 0, 'each_ff' => 0, ] ); diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index e57dd31013..f3dc6efde2 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1,19 +1,36 @@ ;;; - * ;;;;;;;; - * ;;;;;;; - * ;;;;;; - * ;;;; in this order - * and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_) - * example: - * - * api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_| - * - * @param $thrash3 Don't use + * @param string $id Name of agent to add the module. + * @param string $thrash1 Don't use. + * @param array $other It's array, $other as param is ;;; + * ;;;;;;;; + * ;;;;;;; + * ;;;;;; + * ;;;; in this order + * and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_). + * @param string $thrash3 Don't use. + * @example: api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_|* + * @return mixed Return. */ function api_set_create_network_module($id, $thrash1, $other, $thrash3) { @@ -3090,22 +3106,23 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3) 'min_ff_event_critical' => $other['data'][27], 'critical_inverse' => $other['data'][28], 'warning_inverse' => $other['data'][29], + 'ff_type' => $other['data'][30], ]; if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if (! $values['module_macros']) { $values['module_macros'] = ''; - // Column 'module_macros' cannot be null + // Column 'module_macros' cannot be null. } $idModule = modules_create_agent_module($idAgent, $name, $values, true); if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_network_module', __('Error in creation network module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); @@ -3222,6 +3239,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) 'critical_inverse', 'warning_inverse', 'policy_linked', + 'ff_type', ]; $values = []; @@ -3326,22 +3344,23 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3) 'min_ff_event_critical' => $other['data'][32], 'critical_inverse' => $other['data'][33], 'warning_inverse' => $other['data'][34], + 'ff_type' => $other['data'][35], ]; if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if (! $values['module_macros']) { $values['module_macros'] = ''; - // Column 'module_macros' cannot be null + // Column 'module_macros' cannot be null. } $idModule = modules_create_agent_module($idAgent, $name, $values, true); if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_plugin_module', __('Error in creation plugin module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); @@ -3387,7 +3406,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) return; } - // If we want to change the module to a new agent + // If we want to change the module to a new agent. if ($other['data'][0] != '') { if (!util_api_check_agent_and_print_error($other['data'][0], 'string', 'AW')) { return; @@ -3404,7 +3423,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) } } - // Check if agent exists + // Check if agent exists. $check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]); if (!$check_id_agent) { returnError('error_update_data_module', __('Error updating plugin module. Id_agent doesn\'t exist.')); @@ -3448,6 +3467,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) 'critical_inverse', 'warning_inverse', 'policy_linked', + 'ff_type', ]; $values = []; @@ -3546,22 +3566,23 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) 'ff_timeout' => $other['data'][23], 'critical_inverse' => $other['data'][24], 'warning_inverse' => $other['data'][25], + 'ff_type' => $other['data'][26], ]; if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } if (! $values['module_macros']) { $values['module_macros'] = ''; - // Column 'module_macros' cannot be null + // Column 'module_macros' cannot be null. } $idModule = modules_create_agent_module($idAgent, $name, $values, true); if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_data_module', __('Error in creation data module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); @@ -3818,7 +3839,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) return; } - // If we want to change the module to a new agent + // If we want to change the module to a new agent. if ($other['data'][0] != '') { if (!util_api_check_agent_and_print_error($other['data'][0], 'string', 'AW')) { return; @@ -3835,7 +3856,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) } } - // Check if agent exists + // Check if agent exists. $check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]); if (!$check_id_agent) { returnError('error_update_data_module', __('Error updating data module. Id_agent doesn\'t exist.')); @@ -3870,6 +3891,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) 'critical_inverse', 'warning_inverse', 'policy_linked', + 'ff_type', ]; $values = []; @@ -3947,7 +3969,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) $disabled_types_event[EVENTS_GOING_UNKNOWN] = (int) !$other['data'][27]; $disabled_types_event = json_encode($disabled_types_event); - // SNMP version 3 + // SNMP version 3. if ($other['data'][14] == '3') { if ($other['data'][23] != 'AES' and $other['data'][23] != 'DES') { returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ')); @@ -4000,6 +4022,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][31], 'min_ff_event_warning' => $other['data'][32], 'min_ff_event_critical' => $other['data'][33], + 'ff_type' => $other['data'][34], ]; } else { $values = [ @@ -4032,18 +4055,19 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][25], 'min_ff_event_warning' => $other['data'][26], 'min_ff_event_critical' => $other['data'][27], + 'ff_type' => $other['data'][28], ]; } if (! $values['descripcion']) { $values['descripcion'] = ''; - // Column 'descripcion' cannot be null + // Column 'descripcion' cannot be null. } $idModule = modules_create_agent_module($idAgent, $name, $values, true); if (is_error($idModule)) { - // TODO: Improve the error returning more info + // TODO: Improve the error returning more info. returnError('error_create_snmp_module', __('Error in creation SNMP module.')); } else { returnData('string', ['type' => 'string', 'data' => $idModule]); @@ -4091,7 +4115,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) return; } - // If we want to change the module to a new agent + // If we want to change the module to a new agent. if ($other['data'][0] != '') { if (!util_api_check_agent_and_print_error($other['data'][0], 'string', 'AW')) { return; @@ -4108,7 +4132,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) } } - // Check if agent exists + // Check if agent exists. $check_id_agent = db_get_value('id_agente', 'tagente', 'id_agente', $other['data'][0]); if (!$check_id_agent) { returnError('error_update_data_module', __('Error updating snmp module. Id_agent doesn\'t exist.')); @@ -4116,7 +4140,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) } } - // SNMP version 3 + // SNMP version 3. if ($other['data'][13] == '3') { if ($other['data'][22] != 'AES' and $other['data'][22] != 'DES') { returnError( @@ -4180,6 +4204,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) 'min_ff_event_warning', 'min_ff_event_critical', 'policy_linked', + 'ff_type', ]; } else { $snmp_module_fields = [ @@ -4211,6 +4236,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) 'min_ff_event_warning', 'min_ff_event_critical', 'policy_linked', + 'ff_type', ]; } @@ -4308,6 +4334,7 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][20], 'min_ff_event_warning' => $other['data'][21], 'min_ff_event_critical' => $other['data'][22], + 'ff_type' => $other['data'][23], ]; $name_check = db_get_value('name', 'tnetwork_component', 'name', $id); @@ -4408,6 +4435,7 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][24], 'min_ff_event_warning' => $other['data'][25], 'min_ff_event_critical' => $other['data'][26], + 'ff_type' => $other['data'][27], ]; $name_check = db_get_value('name', 'tnetwork_component', 'name', $id); @@ -4543,6 +4571,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][29], 'min_ff_event_warning' => $other['data'][30], 'min_ff_event_critical' => $other['data'][31], + 'ff_type' => $other['data'][32], ]; } else { $values = [ @@ -4574,6 +4603,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) 'min_ff_event_normal' => $other['data'][25], 'min_ff_event_warning' => $other['data'][26], 'min_ff_event_critical' => $other['data'][27], + 'ff_type' => $other['data'][28], ]; } @@ -4654,6 +4684,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2) 'min_ff_event_warning' => $other['data'][8], 'min_ff_event_critical' => $other['data'][9], 'ff_timeout' => $other['data'][10], + 'ff_type' => $other['data'][11], ]; $name_check = enterprise_hook( @@ -6409,6 +6440,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3) $values['min_ff_event_warning'] = $other['data'][21]; $values['min_ff_event_critical'] = $other['data'][22]; $values['ff_timeout'] = $other['data'][23]; + $values['ff_type'] = $other['data'][24]; if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { @@ -6650,6 +6682,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) $values['min_ff_event_normal'] = $other['data'][24]; $values['min_ff_event_warning'] = $other['data'][25]; $values['min_ff_event_critical'] = $other['data'][26]; + $values['ff_type'] = $other['data'][27]; if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { @@ -6859,6 +6892,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) $values['min_ff_event_normal'] = $other['data'][29]; $values['min_ff_event_warning'] = $other['data'][30]; $values['min_ff_event_critical'] = $other['data'][31]; + $values['ff_type'] = $other['data'][32]; if ($name_module_policy !== false) { if ($name_module_policy[0]['name'] == $other['data'][0]) { @@ -7276,6 +7310,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][30], 'min_ff_event_warning' => $other['data'][31], 'min_ff_event_critical' => $other['data'][32], + 'ff_type' => $other['data'][33], ]; } else { $values = [ @@ -7305,6 +7340,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) 'min_ff_event_normal' => $other['data'][24], 'min_ff_event_warning' => $other['data'][25], 'min_ff_event_critical' => $other['data'][26], + 'ff_type' => $other['data'][27], ]; } @@ -13268,6 +13304,7 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras 'min_ff_event_normal' => $row2['min_ff_event_normal'], 'min_ff_event_warning' => $row2['min_ff_event_warning'], 'min_ff_event_critical' => $row2['min_ff_event_critical'], + 'ff_type' => $row2['ff_type'], ]; $name = $row2['name']; diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 9fb0066972..603dd2622c 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -721,6 +721,9 @@ sub print_module { if (! (empty ($data->{min_ff_event_critical}))) { $xml_module .= "\t{min_ff_event_critical} . "]]>\n"; } + if (! (empty ($data->{ff_type}))) { + $xml_module .= "\t{ff_type} . "]]>\n"; + } if (! (empty ($data->{ff_timeout}))) { $xml_module .= "\t{ff_timeout} . "]]>\n"; } From 4fd3aa3a51e90c27bf08908f93dc84bb00723866 Mon Sep 17 00:00:00 2001 From: Fermin Date: Fri, 29 Mar 2019 15:06:26 +0100 Subject: [PATCH 20/60] Avoid to execute non cron complianced modules on creation Former-commit-id: edfb13175ca00bc5aee99609c0eec30e06d5936e --- pandora_console/include/functions_cron.php | 16 +++++++++------- pandora_console/include/functions_modules.php | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_cron.php b/pandora_console/include/functions_cron.php index e56a3d4a52..2823bfc4c6 100644 --- a/pandora_console/include/functions_cron.php +++ b/pandora_console/include/functions_cron.php @@ -20,15 +20,17 @@ function cron_update_module_interval($module_id, $cron) { // Check for a valid cron. if (!cron_check_syntax($cron)) { - return; + return false; } - if ($cron == '* * * * *') { - $module_interval = db_get_value_filter( - 'module_interval', - 'tagente_modulo', - ['id_agente_modulo' => $module_id] - ); + $module_interval = db_get_value( + 'module_interval', + 'tagente_modulo', + 'id_agente_modulo', + $module_id + ); + + if ($cron === '* * * * *') { return db_process_sql( 'UPDATE tagente_estado SET current_interval = '.$module_interval.' WHERE id_agente_modulo = '.(int) $module_id ); diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index ed19c6d2c1..18c89e11c5 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -663,10 +663,11 @@ function modules_create_agent_module( 'estado' => $status, 'known_status' => $status, 'id_agente' => (int) $id_agent, - 'utimestamp' => 0, + 'utimestamp' => (time() - (int) $values['interval']), 'status_changes' => 0, 'last_status' => $status, 'last_known_status' => $status, + 'current_interval' => (int) $values['interval'], ] ); From 69df187ae56ce094c11e2336763bcec0f7aee731 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 30 Mar 2019 00:01:27 +0100 Subject: [PATCH 21/60] Auto-updated build strings. Former-commit-id: 644e5f18004d4faf84b27558b3e3ada13a872dcc --- 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/lib/PandoraFMS/PluginTools.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 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b9646f8787..cbda0cf83a 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.733-190329 +Version: 7.0NG.733-190330 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 fbb03a30e0..4c96acb1eb 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.733-190329" +pandora_version="7.0NG.733-190330" 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 859526fd73..fdabb4e349 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.733'; -use constant AGENT_BUILD => '190329'; +use constant AGENT_BUILD => '190330'; # 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 9fd58997dc..c6b40b98fa 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.733 -%define release 190329 +%define release 190330 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 42df30ad4c..c6a7e2da36 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.733 -%define release 190329 +%define release 190330 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 c42d486127..6711f0a503 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190329" +PI_BUILD="190330" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 258dbfafc1..ccd48b1f43 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190329} +{190330} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 9678ac47e4..a16cc537bf 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.733(Build 190329)") +#define PANDORA_VERSION ("7.0NG.733(Build 190330)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9940dd61fd..a99622f6ed 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.733(Build 190329))" + VALUE "ProductVersion", "(7.0NG.733(Build 190330))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ce7d85e806..af918624fb 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.733-190329 +Version: 7.0NG.733-190330 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 6adb002182..581704aaf2 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.733-190329" +pandora_version="7.0NG.733-190330" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 5f4fdda4ba..0f3ad500a0 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190329'; +$build_version = 'PC190330'; $pandora_version = 'v7.0NG.733'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 8d74e18606..1e98348130 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index bc9516314f..6be563e5c5 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190329 +%define release 190330 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 4f64ac25b3..10a690f5c9 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190329 +%define release 190330 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 50f375f0f3..00e9c88c33 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190329" +PI_BUILD="190330" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 36571a9c2c..bc9004fb11 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.733 PS190329"; +my $version = "7.0NG.733 PS190330"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 0cd7f59554..7145ce044f 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.733 PS190329"; +my $version = "7.0NG.733 PS190330"; # save program name for logging my $progname = basename($0); From 2d26a74f9ee8fbb97de0237c16056137d58b3881 Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 31 Mar 2019 00:01:22 +0100 Subject: [PATCH 22/60] Auto-updated build strings. Former-commit-id: 8b0e13150ea9a6f7f482953aa07b57793359cad1 --- 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/lib/PandoraFMS/PluginTools.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 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index cbda0cf83a..b0a620dced 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.733-190330 +Version: 7.0NG.733-190331 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 4c96acb1eb..3a27816c5d 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.733-190330" +pandora_version="7.0NG.733-190331" 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 fdabb4e349..67ab814341 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.733'; -use constant AGENT_BUILD => '190330'; +use constant AGENT_BUILD => '190331'; # 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 c6b40b98fa..957cb8c94c 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.733 -%define release 190330 +%define release 190331 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 c6a7e2da36..7b189105f1 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.733 -%define release 190330 +%define release 190331 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 6711f0a503..7925f73f10 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190330" +PI_BUILD="190331" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index ccd48b1f43..fdad674f4b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190330} +{190331} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index a16cc537bf..68b17b7f53 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.733(Build 190330)") +#define PANDORA_VERSION ("7.0NG.733(Build 190331)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a99622f6ed..9fd2f053b7 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.733(Build 190330))" + VALUE "ProductVersion", "(7.0NG.733(Build 190331))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index af918624fb..9bdc4bba0e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.733-190330 +Version: 7.0NG.733-190331 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 581704aaf2..389d0bf1e0 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.733-190330" +pandora_version="7.0NG.733-190331" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 0f3ad500a0..aaabea714e 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190330'; +$build_version = 'PC190331'; $pandora_version = 'v7.0NG.733'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 1e98348130..3065b38440 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 6be563e5c5..9e1ea81632 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190330 +%define release 190331 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 10a690f5c9..23f4cc2758 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190330 +%define release 190331 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 00e9c88c33..7ad04e56b1 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190330" +PI_BUILD="190331" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index bc9004fb11..77106af541 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.733 PS190330"; +my $version = "7.0NG.733 PS190331"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 7145ce044f..d5b319651a 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.733 PS190330"; +my $version = "7.0NG.733 PS190331"; # save program name for logging my $progname = basename($0); From 5ca01b02941f8e872e76fb00881adf086c0e9357 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Mon, 1 Apr 2019 10:27:24 +0200 Subject: [PATCH 23/60] add ff_type linux agent Former-commit-id: 0e903a7e304c5a2ea4dcf8570e45663524777748 --- pandora_agents/unix/pandora_agent | 3 +++ pandora_server/lib/PandoraFMS/DataServer.pm | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 093bc078f5..fd710f4c75 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -662,6 +662,8 @@ sub parse_conf_modules($) { $module->{'ff_timeout'} = $1; } elsif ($line =~ /^\s*module_each_ff\s+(\S+)\s*$/) { $module->{'each_ff'} = $1; + } elsif ($line =~ /^\s*module_ff_type\s+(\d+)\s*$/) { + $module->{'ff_type'} = $1; # Macros } elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) { $module->{'macros'}{$1} = $2; @@ -2532,6 +2534,7 @@ sub write_module_xml ($@) { $Xml .= " " . $module->{'min_ff_event_critical'} . "\n" if (defined ($module->{'min_ff_event_critical'})); $Xml .= " " . $module->{'ff_timeout'} . "\n" if (defined ($module->{'ff_timeout'})); $Xml .= " " . $module->{'each_ff'} . "\n" if (defined ($module->{'each_ff'})); + $Xml .= " " . $module->{'ff_type'} . "\n" if (defined ($module->{'ff_type'})); # Data list if ($#data > 0) { diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index bc66eb2d72..8e08a7d482 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -641,7 +641,7 @@ sub process_module_data ($$$$$$$$$$) { 'unknown_instructions' => '', 'tags' => '', 'critical_inverse' => 0, 'warning_inverse' => 0, 'quiet' => 0, 'module_ff_interval' => 0, 'alert_template' => '', 'crontab' => '', 'min_ff_event_normal' => 0, 'min_ff_event_warning' => 0, 'min_ff_event_critical' => 0, 'ff_timeout' => 0, 'each_ff' => 0, 'module_parent' => 0, - 'module_parent_unlink' => 0, 'cron_interval' => 0}; + 'module_parent_unlink' => 0, 'cron_interval' => 0, 'ff_type' => 0}; # Other tags will be saved here $module_conf->{'extended_info'} = ''; From be0f96b5f0ce8fc2b414eed90ffb09a9781855f9 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Mon, 1 Apr 2019 12:52:09 +0200 Subject: [PATCH 24/60] add ff_type Windows agent Former-commit-id: d167449fe305d6a013eb2b2e22ec48a58af1e346 --- .../win32/modules/pandora_module.cc | 18 ++++++++++++++++++ pandora_agents/win32/modules/pandora_module.h | 2 ++ .../win32/modules/pandora_module_factory.cc | 19 ++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index eac38c8fa1..e7c751d367 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -78,6 +78,7 @@ Pandora_Module::Pandora_Module (string name) { this->warning_inverse = ""; this->quiet = ""; this->module_ff_interval = ""; + this->module_ff_type = ""; this->module_alert_template = ""; this->module_crontab = ""; } @@ -733,6 +734,13 @@ Pandora_Module::getXml () { module_xml += this->module_ff_interval; module_xml += "\n"; } + + /* Module FF type */ + if (this->module_ff_type != "") { + module_xml += "\t"; + module_xml += this->module_ff_type; + module_xml += "\n"; + } /* Module Alert template */ if (this->module_alert_template != "") { @@ -1028,6 +1036,16 @@ Pandora_Module::setModuleFFInterval (string value) { this->module_ff_interval = value; } +/** + * Set the module FF type for the module. + * + * @param value module FF type value to set. + */ +void +Pandora_Module::setModuleFFType (string value) { + this->module_ff_type = value; +} + /** * Set the module Alert template for the module. * diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index 9fb29e1183..c766766950 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -176,6 +176,7 @@ namespace Pandora_Modules { string unit, custom_id, str_warning, str_critical; string module_group, warning_inverse, critical_inverse, quiet; string module_ff_interval, module_alert_template, module_crontab; + string module_ff_type; string critical_instructions, warning_instructions, unknown_instructions, tags; protected: @@ -277,6 +278,7 @@ namespace Pandora_Modules { void setWarningInverse (string value); void setQuiet (string value); void setModuleFFInterval (string value); + void setModuleFFType (string value); void setModuleAlertTemplate (string value); void setModuleCrontab (string value); diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index 658ff724fd..b05422f104 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -119,6 +119,7 @@ using namespace Pandora_Strutils; #define TOKEN_WARNING_INVERSE ("module_warning_inverse ") #define TOKEN_QUIET ("module_quiet ") #define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ") +#define TOKEN_MODULE_FF_TYPE ("module_ff_type ") #define TOKEN_MACRO ("module_macro") #define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_ALERT_TEMPLATE ("module_alert_template") @@ -176,7 +177,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical; string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags; string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval; - string module_native_encoding, module_alert_template; + string module_native_encoding, module_alert_template, module_ff_type; string macro; Pandora_Module *module; bool numeric; @@ -254,6 +255,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_warning_inverse = ""; module_quiet = ""; module_ff_interval = ""; + module_ff_type = ""; module_native_encoding = ""; module_alert_template = ""; module_user_session = ""; @@ -507,6 +509,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_ff_interval == "") { module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL); } + + if (module_ff_type == "") { + module_ff_type = parseLine (line, TOKEN_MODULE_FF_TYPE); + } if (module_alert_template == "") { module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE); @@ -1087,6 +1093,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } + if (module_ff_type != "") { + pos_macro = module_ff_type.find(macro_name); + if (pos_macro != string::npos){ + module_ff_type.replace(pos_macro, macro_name.size(), macro_value); + } + } + if (module_alert_template != "") { pos_macro = module_alert_template.find(macro_name); if (pos_macro != string::npos){ @@ -1447,6 +1460,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_ff_interval != "") { module->setModuleFFInterval (module_ff_interval); } + + if (module_ff_type != "") { + module->setModuleFFType (module_ff_type); + } if (module_alert_template != "") { module->setModuleAlertTemplate (module_alert_template); From c07319fb707c27a7643f8143c379e63aff93b23b Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 1 Apr 2019 12:56:10 +0200 Subject: [PATCH 25/60] Insert zero into fires_min an fires_max when null Former-commit-id: de1197159053155d4f962d74179933c46189460e --- pandora_console/include/functions_api.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index e57dd31013..b2ac851e8f 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -8794,7 +8794,14 @@ function api_set_alert_actions($id, $id2, $other, $trash1) } $firesMin = $other['data'][2]; + if (!$firesMin) { + $firesMin = 0; + } + $firesMax = $other['data'][3]; + if (!$firesMax) { + $firesMax = 0; + } $values = [ 'id_alert_template_module' => $idAlertTemplateModule, From 343c6a6edf8e9b5c879042e074934479f4e31c44 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 1 Apr 2019 15:18:56 +0200 Subject: [PATCH 26/60] Fix agent name input to allow '-' Former-commit-id: 8b69d89daa3baeca5126c88c53dbe8323860f95d --- pandora_console/godmode/agentes/configurar_agente.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 9c10099042..74a5c3dc9f 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -160,7 +160,7 @@ $module_macros = []; if ($create_agent) { $mssg_warning = 0; $alias_safe_output = io_safe_output(get_parameter('alias', '')); - $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output))); + $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output))); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); $unique_ip = (int) get_parameter_post('unique_ip', 0); @@ -766,7 +766,7 @@ if ($update_agent) { $id_agente = (int) get_parameter_post('id_agente'); $nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', '')); $alias_safe_output = io_safe_output(get_parameter('alias', '')); - $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output))); + $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output))); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); $direccion_agente = (string) get_parameter_post('direccion', ''); $unique_ip = (int) get_parameter_post('unique_ip', 0); From f67c3d5fc03f2dd7fbcf6e097061a42dfbc4341a Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 2 Apr 2019 00:01:31 +0200 Subject: [PATCH 27/60] Auto-updated build strings. Former-commit-id: 5e2eef78f8e98e69b43dd409c6ba0740c0e7a959 --- 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/lib/PandoraFMS/PluginTools.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 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b0a620dced..9fa2a98d18 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.733-190331 +Version: 7.0NG.733-190402 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 3a27816c5d..1e632346c8 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.733-190331" +pandora_version="7.0NG.733-190402" 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 67ab814341..57d00521cd 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.733'; -use constant AGENT_BUILD => '190331'; +use constant AGENT_BUILD => '190402'; # 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 957cb8c94c..49d1ffb1ac 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.733 -%define release 190331 +%define release 190402 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 7b189105f1..34bb201378 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.733 -%define release 190331 +%define release 190402 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 7925f73f10..72097cde2c 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190331" +PI_BUILD="190402" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index fdad674f4b..02d0b4098e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190331} +{190402} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 68b17b7f53..a77673ee25 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.733(Build 190331)") +#define PANDORA_VERSION ("7.0NG.733(Build 190402)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9fd2f053b7..d881ed70d4 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.733(Build 190331))" + VALUE "ProductVersion", "(7.0NG.733(Build 190402))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 9bdc4bba0e..3a1b872021 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.733-190331 +Version: 7.0NG.733-190402 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 389d0bf1e0..deb3d165bd 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.733-190331" +pandora_version="7.0NG.733-190402" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index aaabea714e..0f0f8d3872 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190331'; +$build_version = 'PC190402'; $pandora_version = 'v7.0NG.733'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 3065b38440..0ddd09fd0b 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 9e1ea81632..5f3bab9ede 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190331 +%define release 190402 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 23f4cc2758..1f5528b358 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190331 +%define release 190402 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 7ad04e56b1..88b98d129e 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190331" +PI_BUILD="190402" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 77106af541..84306a955c 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.733 PS190331"; +my $version = "7.0NG.733 PS190402"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index d5b319651a..2013752186 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.733 PS190331"; +my $version = "7.0NG.733 PS190402"; # save program name for logging my $progname = basename($0); From 7af141258eaa448748597efd5a2542a2115d1852 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 2 Apr 2019 10:30:53 +0200 Subject: [PATCH 28/60] Add a missing configuration option. Former-commit-id: 4a516f1507cba486defb0c6be7b63b12cebc383e --- pandora_server/lib/PandoraFMS/Config.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 539b1a17d8..52aa88a7db 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -175,6 +175,7 @@ sub pandora_get_sharedconfig ($$) { $pa_config->{"provisioning_mode"} = pandora_get_tconfig_token ($dbh, 'provisioning_mode', ''); + $pa_config->{"event_storm_protection"} = pandora_get_tconfig_token ($dbh, 'event_storm_protection', 0); if ($pa_config->{'include_agents'} eq '') { $pa_config->{'include_agents'} = 0; From 89bbbd289315a40483cda5244a8626b7a965f956 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 2 Apr 2019 14:06:05 +0200 Subject: [PATCH 29/60] Revert "fixed IPAM config" This reverts commit 1fe1beb930337770170bce177105020bdb3c06bb [formerly 39b80d2ca41c21a823cdec5948e30109a81eeb2a] Former-commit-id: e11aec8e300db083b7ce04cb74d19de276e69eb7 --- pandora_console/include/functions_config.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index bab701ba50..5435de5b8a 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -81,6 +81,11 @@ function config_update_value($token, $value) $value = ($value); } + if (!isset($config[$token])) { + $config[$token] = $value; + return (bool) config_create_value($token, io_safe_input($value)); + } + // If it has not changed. if ($config[$token] == $value) { return true; @@ -95,18 +100,10 @@ function config_update_value($token, $value) ['token' => $token] ); - if ($result == 0) { + if ($result === 0) { return true; } else { - if (!isset($config[$token])) { - $config[$token] = $value; - return (bool) config_create_value( - $token, - io_safe_input($value) - ); - } else { - return (bool) $result; - } + return (bool) $result; } } From c679751f94a0cb6d9ff4441986d05795e18261e2 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Tue, 2 Apr 2019 16:01:24 +0200 Subject: [PATCH 30/60] fixed error add ff_type Former-commit-id: 177e40f655f309eed3e7d877ffb00172b0105095 --- .../godmode/massive/massive_edit_modules.php | 20 +++++++++++++++---- .../modules/manage_network_components.php | 1 + .../include/javascript/pandora_modules.js | 6 ++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 917117aa1c..ae6b5b1432 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -914,11 +914,23 @@ $table->data['edit1'][1] = '
    '; ).'
    '; $table->data['edit7'][1] .= __('Keep counters').' '; - $table->data['edit7'][1] .= html_print_checkbox( + $table->data['edit7'][1] .= html_print_select( + [ + '' => __('No change'), + '1' => __('Active Counters'), + '0' => __('Inactive Counters'), + ], 'ff_type', - 1, - 0, - true + '', + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 400px;' ); $table->data['edit8'][0] = __('FF interval'); diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index ab2063fe35..906f36be15 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -499,6 +499,7 @@ $url = ui_get_url_refresh( 'ff_event_warning' => false, 'ff_event_critical' => false, 'each_ff' => false, + 'ff_type' => false, ] ); diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index e835f87c24..889fd0f3dd 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -1,3 +1,8 @@ +/* + global $ + global jQuery +*/ + /* Modules ids to check types */ var id_modules_icmp = Array(6, 7); var id_modules_tcp = Array(8, 9, 10, 11); @@ -412,6 +417,7 @@ function configure_modules_form() { "value", data["min_ff_event_critical"] == 0 ? 0 : data["min_ff_event_critical"] ); + $("#checkbox-ff_type").prop("checked", data["ff_type"]); // Shows manual input if post_process field is setted if (data["post_process"] != 0) { From 1fd40447e12e4855878a41ce6c217b89bc87d6bb Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 2 Apr 2019 16:24:29 +0200 Subject: [PATCH 31/60] Custom fields in availability report type Former-commit-id: 1f04e5728cf7d0ed5079c16488493188379d536c --- pandora_console/extras/mr/27.sql | 12 ++ .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 12 ++ .../reporting_builder.item_editor.php | 199 ++++++++++++++++-- .../godmode/reporting/reporting_builder.php | 13 ++ .../include/functions_reporting_html.php | 193 +++++++++++++---- 5 files changed, 370 insertions(+), 59 deletions(-) diff --git a/pandora_console/extras/mr/27.sql b/pandora_console/extras/mr/27.sql index f85064c9eb..a98a94f6d1 100644 --- a/pandora_console/extras/mr/27.sql +++ b/pandora_console/extras/mr/27.sql @@ -2,5 +2,17 @@ START TRANSACTION; UPDATE tuser_task SET parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report"; +ALTER TABLE `treport_content` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; 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 323e7ee0d8..515302d463 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 @@ -1379,6 +1379,18 @@ ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL; ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0'; UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics"; +ALTER TABLE `treport_content` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; -- --------------------------------------------------------------------- -- 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 62d58c9261..85b5ee128d 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -119,6 +119,20 @@ $visual_format = 0; // Others $filter_search = ''; +// Added for select fields. +$total_time = true; +$time_failed = true; +$time_in_ok_status = true; +$time_in_unknown_status = true; +$time_of_not_initialized_module = true; +$time_of_downtime = true; +$total_checks = true; +$checks_failed = true; +$checks_in_ok_status = true; +$unknown_checks = true; +$agent_max_value = true; +$agent_min_value = true; + switch ($action) { case 'new': $actionParameter = 'save'; @@ -501,6 +515,18 @@ switch ($action) { $sunday = $item['sunday']; $time_from = $item['time_from']; $time_to = $item['time_to']; + $total_time = $item['total_time']; + $time_failed = $item['time_failed']; + $time_in_ok_status = $item['time_in_ok_status']; + $time_in_unknown_status = $item['time_in_unknown_status']; + $time_of_not_initialized_module = $item['time_of_not_initialized_module']; + $time_of_downtime = $item['time_of_downtime']; + $total_checks = $item['total_checks']; + $checks_failed = $item['checks_failed']; + $checks_in_ok_status = $item['checks_in_ok_status']; + $unknown_checks = $item['unknown_checks']; + $agent_max_value = $item['agent_max_value']; + $agent_min_value = $item['agent_min_value']; break; case 'group_report': @@ -1597,20 +1623,6 @@ $class = 'databox filters'; REPORT_EXCEPTION_CONDITION_NOT_OK => __('Not OK'), ]; html_print_select($list_exception_condition, 'exception_condition', $exception_condition); - - - /* - echo ; - html_print_radio_button ('radiobutton_exception_condition', 0, '', $exception_condition); - echo __('>='); - html_print_radio_button ('radiobutton_exception_condition', 1, '', $exception_condition); - echo __('<'); - html_print_radio_button ('radiobutton_exception_condition', 2, '', $exception_condition); - echo __('OK'); - html_print_radio_button ('radiobutton_exception_condition', 3, '', $exception_condition); - echo __('Not OK'); - html_print_radio_button ('radiobutton_exception_condition', 4, '', $exception_condition); - */ ?> @@ -1620,6 +1632,65 @@ $class = 'databox filters'; + + + + + + + + + + + + + @@ -2625,6 +2769,17 @@ $(document).ready (function () { } }); + + $("#checkbox-checkbox_show_resume").change(function(){ + if($(this).is(":checked")){ + $("#row_select_fields2").show(); + $("#row_select_fields3").show(); + } + else{ + $("#row_select_fields2").hide(); + $("#row_select_fields3").hide(); + } + }); }); @@ -3139,6 +3294,9 @@ function chooseType() { $("#row_event_type").hide(); $("#row_event_status").hide(); $("#row_source").hide(); + $('#row_select_fields').hide(); + $("#row_select_fields2").hide(); + $("#row_select_fields3").hide(); // SLA list default state $("#sla_list").hide(); @@ -3547,6 +3705,15 @@ function chooseType() { $("#row_show_resume").show(); $("#row_working_time").show(); $('#row_hide_notinit_agents').show(); + $('#row_select_fields').show(); + if($("#checkbox-checkbox_show_resume").is(":checked")){ + $("#row_select_fields2").show(); + $("#row_select_fields3").show(); + } + else{ + $("#row_select_fields2").hide(); + $("#row_select_fields3").hide(); + } $("#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 3acfee7c88..a8fe0f5f91 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1282,6 +1282,19 @@ switch ($action) { $values['friday'] = get_parameter('friday', 0); $values['saturday'] = get_parameter('saturday', 0); $values['sunday'] = get_parameter('sunday', 0); + $values['total_time'] = get_parameter('total_time', 0); + $values['time_failed'] = get_parameter('time_failed', 0); + $values['time_in_ok_status'] = get_parameter('time_in_ok_status', 0); + $values['time_in_unknown_status'] = get_parameter('time_in_unknown_status', 0); + $values['time_of_not_initialized_module'] = get_parameter('time_of_not_initialized_module', 0); + $values['time_of_downtime'] = get_parameter('time_of_downtime', 0); + $values['total_checks'] = get_parameter('total_checks', 0); + $values['checks_failed'] = get_parameter('checks_failed', 0); + $values['checks_in_ok_status'] = get_parameter('checks_in_ok_status', 0); + $values['unknown_checks'] = get_parameter('unknown_checks', 0); + $values['agent_max_value'] = get_parameter('agent_max_value', 0); + $values['agent_min_value'] = get_parameter('agent_min_value', 0); + switch ($config['dbtype']) { case 'mysql': case 'postgresql': diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 7265c721ec..4d9b21e2bb 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2907,7 +2907,24 @@ function reporting_html_availability($table, $item, $pdf=0) io_safe_output($style), true ); - + $sql = 'SELECT + total_time, + time_failed, + time_in_ok_status, + time_in_unknown_status, + time_of_not_initialized_module, + time_of_downtime, + total_checks, + checks_failed, + checks_in_ok_status, + unknown_checks, + agent_max_value, + agent_min_value + FROM treport_content + WHERE id_rc ='.$item['id_rc']; + $fields = db_get_all_rows_sql( + $sql + ); $same_agent_in_resume = ''; global $config; @@ -2927,32 +2944,62 @@ function reporting_html_availability($table, $item, $pdf=0) $table1->head[1] = __('Module'); } - $table1->head[2] = __('Total time'); - $table1->head[3] = __('Time failed'); - $table1->head[4] = __('Time OK'); - $table1->head[5] = __('Time Uknown'); - $table1->head[6] = __('Time Not Init Module'); - $table1->head[7] = __('Time Downtime'); + if ($fields[0]['total_time']) { + $table1->head[2] = __('Total time'); + } else { + $table1->head[2] = __(''); + } + + if ($fields[0]['time_failed']) { + $table1->head[3] = __('Time failed'); + } else { + $table1->head[3] = __(''); + } + + if ($fields[0]['time_in_ok_status']) { + $table1->head[4] = __('Time OK'); + } else { + $table1->head[4] = __(''); + } + + if ($fields[0]['time_in_unknown_status']) { + $table1->head[5] = __('Time Unknown'); + } else { + $table1->head[5] = __(''); + } + + if ($fields[0]['time_of_not_initialized_module']) { + $table1->head[6] = __('Time Not Init Module'); + } else { + $table1->head[6] = __(''); + } + + if ($fields[0]['time_of_downtime']) { + $table1->head[7] = __('Time Downtime'); + } else { + $table1->head[7] = __(''); + } + $table1->head[8] = __('% Ok'); $table1->headstyle = []; $table1->headstyle[0] = 'text-align: left'; $table1->headstyle[1] = 'text-align: left'; - $table1->headstyle[2] = 'text-align: right'; - $table1->headstyle[3] = 'text-align: right'; - $table1->headstyle[4] = 'text-align: right'; - $table1->headstyle[5] = 'text-align: right'; - $table1->headstyle[6] = 'text-align: right'; + $table1->headstyle[2] = 'text-align: center'; + $table1->headstyle[3] = 'text-align: center'; + $table1->headstyle[4] = 'text-align: center'; + $table1->headstyle[5] = 'text-align: center'; + $table1->headstyle[6] = 'text-align: center'; $table1->headstyle[7] = 'text-align: right'; $table1->headstyle[8] = 'text-align: right'; $table1->style[0] = 'text-align: left'; $table1->style[1] = 'text-align: left'; - $table1->style[2] = 'text-align: right'; - $table1->style[3] = 'text-align: right'; - $table1->style[4] = 'text-align: right'; - $table1->style[5] = 'text-align: right'; - $table1->style[6] = 'text-align: right'; + $table1->style[2] = 'text-align: center'; + $table1->style[3] = 'text-align: center'; + $table1->style[4] = 'text-align: center'; + $table1->style[5] = 'text-align: center'; + $table1->style[6] = 'text-align: center'; $table1->style[7] = 'text-align: right'; $table1->style[8] = 'text-align: right'; @@ -2970,10 +3017,29 @@ function reporting_html_availability($table, $item, $pdf=0) $table2->head[1] = __('Module'); } - $table2->head[2] = __('Total checks'); - $table2->head[3] = __('Checks failed'); - $table2->head[4] = __('Checks OK'); - $table2->head[5] = __('Checks Uknown'); + if ($fields[0]['total_checks']) { + $table2->head[2] = __('Total checks'); + } else { + $table2->head[2] = __(''); + } + + if ($fields[0]['checks_failed']) { + $table2->head[3] = __('Checks failed'); + } else { + $table2->head[3] = __(''); + } + + if ($fields[0]['checks_in_ok_status']) { + $table2->head[4] = __('Checks OK'); + } else { + $table2->head[4] = __(''); + } + + if ($fields[0]['unknown_checks']) { + $table2->head[5] = __('Checks Uknown'); + } else { + $table2->head[5] = __(''); + } $table2->headstyle = []; $table2->headstyle[0] = 'text-align: left'; @@ -2995,69 +3061,97 @@ function reporting_html_availability($table, $item, $pdf=0) $table_row[] = $row['agent']; $table_row[] = $row['availability_item']; - if ($row['time_total'] != 0) { + if ($row['time_total'] != 0 && $fields[0]['total_time']) { $table_row[] = human_time_description_raw( $row['time_total'], true ); - } else { + } else if ($row['time_total'] == 0 && $fields[0]['total_time']) { $table_row[] = '--'; - } + } else { + $table_row[] = ''; + }; - if ($row['time_error'] != 0) { + if ($row['time_error'] != 0 && $fields[0]['time_failed']) { $table_row[] = human_time_description_raw( $row['time_error'], true ); - } else { + } else if ($row['time_error'] == 0 && $fields[0]['time_failed']) { $table_row[] = '--'; - } + } else { + $table_row[] = ''; + }; - if ($row['time_ok'] != 0) { + if ($row['time_ok'] != 0 && $fields[0]['time_in_ok_status']) { $table_row[] = human_time_description_raw( $row['time_ok'], true ); - } else { + } else if ($row['time_ok'] == 0 && $fields[0]['time_in_ok_status']) { $table_row[] = '--'; - } + } else { + $table_row[] = ''; + }; - if ($row['time_unknown'] != 0) { + if ($row['time_unknown'] != 0 && $fields[0]['time_in_unknown_status']) { $table_row[] = human_time_description_raw( $row['time_unknown'], true ); - } else { + } else if ($row['time_unknown'] == 0 && $fields[0]['time_in_unknown_status']) { $table_row[] = '--'; - } + } else { + $table_row[] = ''; + }; - if ($row['time_not_init'] != 0) { + if ($row['time_not_init'] != 0 && $fields[0]['time_of_not_initialized_module']) { $table_row[] = human_time_description_raw( $row['time_not_init'], true ); - } else { + } else if ($row['time_not_init'] == 0 && $fields[0]['time_of_not_initialized_module']) { $table_row[] = '--'; - } + } else { + $table_row[] = ''; + }; - if ($row['time_downtime'] != 0) { + if ($row['time_downtime'] != 0 && $fields[0]['time_of_downtime']) { $table_row[] = human_time_description_raw( $row['time_downtime'], true ); - } else { + } else if ($row['time_downtime'] == 0 && $fields[0]['time_of_downtime']) { $table_row[] = '--'; - } + } else { + $table_row[] = ''; + }; $table_row[] = ''.sla_truncate($row['SLA'], $config['graph_precision']).'%'; $table_row2 = []; $table_row2[] = $row['agent']; $table_row2[] = $row['availability_item']; - $table_row2[] = $row['checks_total']; - $table_row2[] = $row['checks_error']; - $table_row2[] = $row['checks_ok']; - $table_row2[] = $row['checks_unknown']; + if ($fields[0]['total_checks']) { + $table_row2[] = $row['checks_total']; + } else { + $table_row2[] = ''; + }; + if ($fields[0]['checks_failed']) { + $table_row2[] = $row['checks_error']; + } else { + $table_row2[] = ''; + }; + if ($fields[0]['checks_in_ok_status']) { + $table_row2[] = $row['checks_ok']; + } else { + $table_row2[] = ''; + }; + if ($fields[0]['unknown_checks']) { + $table_row2[] = $row['checks_unknown']; + } else { + $table_row2[] = ''; + }; $table1->data[] = $table_row; $table2->data[] = $table_row2; @@ -3131,6 +3225,19 @@ function reporting_html_availability($table, $item, $pdf=0) ).'%', 'avg' => ''.sla_truncate($item['resume']['avg'], $config['graph_precision']).'%', ]; + if ($fields[0]['agent_max_value'] == 0) { + $table1->head['max_text'] = ''; + $table1->data[0]['max_text'] = ''; + $table1->head['max'] = ''; + $table1->data[0]['max'] = ''; + } + + if ($fields[0]['agent_min_value'] == 0) { + $table1->head['min_text'] = ''; + $table1->data[0]['min_text'] = ''; + $table1->head['min'] = ''; + $table1->data[0]['min'] = ''; + } if ($pdf === 0) { $table->colspan[3][0] = 3; From a0a250bef77e0d206ff85476123a285fc7be3741 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Tue, 2 Apr 2019 16:45:01 +0200 Subject: [PATCH 32/60] fixed error add ff_type Former-commit-id: b270ec363b84bbfafcea5418b6007aba8217680b --- pandora_console/include/javascript/pandora_modules.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 889fd0f3dd..abc91ce532 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -100,6 +100,7 @@ function configure_modules_form() { $("#text-unit").attr("value", ""); $("#checkbox-critical_inverse").attr("value", 0); $("#checkbox-warning_inverse").attr("value", 0); + $("#checkbox-ff_type").attr("value", 0); $("#textarea_critical_instructions").attr("value", ""); $("#textarea_warning_instructions").attr("value", ""); $("#textarea_unknown_instructions").attr("value", ""); @@ -182,6 +183,8 @@ function configure_modules_form() { "value", data["min_ff_event"] == 0 ? 0 : data["min_ff_event"] ); + + $("#checkbox-ff_type").prop("checked", data["ff_type"]); $("#text-post_process").attr( "value", data["post_process"] == 0 ? 0 : data["post_process"] From 11d8edd88b727e0709a27e285db66874055a381a Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 2 Apr 2019 18:04:33 +0200 Subject: [PATCH 33/60] RHEL specs and build orders (update version) Former-commit-id: 582d1bea42bc41a23fc773cf1d411bb4bdad50aa --- extras/build_rpm_rhel7.sh | 26 +++++++ extras/pandora_update_version.sh | 1 + pandora_console/pandora_console.rhel7.spec | 81 ++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 extras/build_rpm_rhel7.sh create mode 100644 pandora_console/pandora_console.rhel7.spec diff --git a/extras/build_rpm_rhel7.sh b/extras/build_rpm_rhel7.sh new file mode 100644 index 0000000000..6bb65d816d --- /dev/null +++ b/extras/build_rpm_rhel7.sh @@ -0,0 +1,26 @@ +#!/bin/bash +source build_vars.sh + +if [ ! -d $RPMHOME/RPMS ]; then + mkdir -p $RPMHOME/RPMS || exit 1 +fi + +echo "Creating RPM packages in $RPMHOME/RPMS" + +# Console +rpmbuild -ba $CODEHOME/pandora_console/pandora_console.rhel7.spec || exit 1 + +# Server +rpmbuild -ba $CODEHOME/pandora_server/pandora_server.rhel7.spec || exit 1 + +# Unix agent +rpmbuild -ba $CODEHOME/pandora_agents/unix/pandora_agent.rhel7.spec || exit 1 + +# Enterprise console +rpmbuild -ba $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec || exit 1 + +# Enterprise server +rpmbuild -ba $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.rhel7.spec || exit 1 + +exit 0 + diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 7d143f0f03..33e0c891f7 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -26,6 +26,7 @@ $CODEHOME/pandora_server/pandora_server.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \ $CODEHOME/pandora_console/pandora_console.redhat.spec \ +$CODEHOME/pandora_console/pandora_console.rhel7.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \ $CODEHOME/pandora_server/pandora_server.redhat.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \ diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec new file mode 100644 index 0000000000..848408c709 --- /dev/null +++ b/pandora_console/pandora_console.rhel7.spec @@ -0,0 +1,81 @@ +# +# Pandora FMS Console +# +%define name pandorafms_console +%define version 7.0NG.733 +%define release 190329 + +# User and Group under which Apache is running +%define httpd_name httpd +%define httpd_user apache +%define httpd_group apache + +Summary: Pandora FMS Console +Name: %{name} +Version: %{version} +Release: %{release} +License: GPL +Vendor: Artica ST +#Source0: %{name}-%{version}-%{revision}.tar.gz +Source0: %{name}-%{version}.tar.gz +URL: http://www.pandorafms.com +Group: Productivity/Networking/Web/Utilities +Packager: Sancho Lerena +Prefix: /var/www/html +BuildRoot: %{_tmppath}/%{name} +BuildArch: noarch +AutoReq: 0 +Requires: %{httpd_name} >= 2.0.0 +Requires: httpd24-mod_php >= 7.0 +Requires: php-gd, php-ldap, php-snmp, php-session, php-gettext +Requires: php-mysqlnd, php-mbstring, php-zip, php-zlib, php-curl +Requires: xorg-x11-fonts-75dpi, xorg-x11-fonts-misc, php-pecl-zip +Requires: graphviz +Provides: %{name}-%{version} + + +%description +The Web Console is a web application that allows to see graphical reports, state of every agent, also to access to the information sent by the agent, to see every monitored parameter and to see its evolution throughout the time, to form the different nodes, groups and users of the system. It is the part that interacts with the final user, and that will allows you to administer the system. + +%prep +rm -rf $RPM_BUILD_ROOT + +%setup -q -n pandora_console + +%build + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_console +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ +cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_console +rm $RPM_BUILD_ROOT%{prefix}/pandora_console/*.spec +rm $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console_install +install -m 0644 pandora_console_logrotate_centos $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_console + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +# Has an install already been done, if so we only want to update the files +# push install.php aside so that the console works immediately using existing +# configuration. +# +if [ -f %{prefix}/pandora_console/include/config.php ] ; then + mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done +else + echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it." +fi + +%preun + +# Upgrading +if [ "$1" = "1" ]; then + exit 0 +fi + +%files +%defattr(0644,%{httpd_user},%{httpd_group},0755) +%docdir %{prefix}/pandora_console/docs +%{prefix}/pandora_console +%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console From 30e9b67062c4b3315ff55e50dbd8170f167e606c Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 3 Apr 2019 00:01:33 +0200 Subject: [PATCH 34/60] Auto-updated build strings. Former-commit-id: 64d58c7568e01fecd9c4c97a49eeb9df7d55c5dc --- 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/lib/PandoraFMS/PluginTools.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 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 9fa2a98d18..1664603deb 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.733-190402 +Version: 7.0NG.733-190403 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 1e632346c8..cb1a1d0190 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.733-190402" +pandora_version="7.0NG.733-190403" 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 57d00521cd..7f5e835073 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.733'; -use constant AGENT_BUILD => '190402'; +use constant AGENT_BUILD => '190403'; # 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 49d1ffb1ac..59d5899088 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.733 -%define release 190402 +%define release 190403 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 34bb201378..8d68426f00 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.733 -%define release 190402 +%define release 190403 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 72097cde2c..f1c5227a1f 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190402" +PI_BUILD="190403" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 02d0b4098e..25126193f7 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190402} +{190403} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index a77673ee25..a786c2f45f 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.733(Build 190402)") +#define PANDORA_VERSION ("7.0NG.733(Build 190403)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d881ed70d4..aca95f4a6a 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.733(Build 190402))" + VALUE "ProductVersion", "(7.0NG.733(Build 190403))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 3a1b872021..873ee1b735 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.733-190402 +Version: 7.0NG.733-190403 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 deb3d165bd..ab79d5eafb 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.733-190402" +pandora_version="7.0NG.733-190403" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 0f0f8d3872..fcdf7a5ab2 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190402'; +$build_version = 'PC190403'; $pandora_version = 'v7.0NG.733'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 0ddd09fd0b..ab4420d85a 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 5f3bab9ede..dcf8579c0c 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190402 +%define release 190403 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 1f5528b358..422705a663 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.733 -%define release 190402 +%define release 190403 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 88b98d129e..490f608aca 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.733" -PI_BUILD="190402" +PI_BUILD="190403" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 84306a955c..dc72572992 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.733 PS190402"; +my $version = "7.0NG.733 PS190403"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 2013752186..fab618dc8b 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.733 PS190402"; +my $version = "7.0NG.733 PS190403"; # save program name for logging my $progname = basename($0); From 1dcdc1bc79589175c2595a76e4c89ec77696d66f Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 3 Apr 2019 09:53:17 +0200 Subject: [PATCH 35/60] Added alias to windows configuration file Former-commit-id: 52b7462f8b8192a1d9de636a3b13eb7ee3fb9871 --- pandora_agents/win32/bin/pandora_agent.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 12ccb4e91b..0a8191dabd 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-2017 Artica Soluciones Tecnologicas -# Version 7.0NG.733 +# Version 7.0NG.733 # 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 @@ -44,6 +44,8 @@ remote_config 0 #agent_name_cmd cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\agentname.vbs" agent_name_cmd __rand__ +# Agent alias. Name should be unique rather than alias. Hostname by default +# agent_alias $Alias$ #Parent agent_name #parent_agent_name caprica From faecabb1cc1608829c40a69f9e2adcb74e083672 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 3 Apr 2019 12:54:36 +0200 Subject: [PATCH 36/60] Fixed problem with openlayer Former-commit-id: 91eb396d550cd6a90c9c3ba4cbb0ec12c2c51c6e --- pandora_console/include/functions_ui.php | 4 ---- pandora_console/operation/users/user_edit.php | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 7865a1c78a..b2a4a98b36 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1736,10 +1736,6 @@ function ui_process_page_head($string, $bitfield) // Include countdown library $config['jquery']['countdown'] = 'include/javascript/jquery.countdown.js'; - // Include timezone user map library - $config['jquery']['OpenLayers'] = 'include/javascript/OpenLayers.js'; - $config['jquery']['jquery.timezone-picker'] = 'include/javascript/jquery.timezone-picker.js'; - // Then add each script as necessary $loaded = ['']; foreach ($config['jquery'] as $name => $filename) { diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index a5e3390c69..6a74b2e669 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -734,6 +734,10 @@ if (!defined('METACONSOLE')) { '."\n\t"; +echo ''."\n\t"; ?>
    + + + + + + + + + +
    +

    + +

    +
    +

    + +

    +
    +

    + +

    +
    +

    + +

    +
    +

    + +

    +
    +

    + +

    +
    +
    @@ -1629,7 +1700,7 @@ $class = 'databox filters';
    + Select fields to show

    '); + ?> +
    + + + + + +
    +

    + +

    +
    +

    + +

    +
    +

    + +

    +
    +

    + +

    +
    +
    +
    + Select fields to show

    '); + ?> +
    + + + +
    +

    + +

    +
    +

    + +

    +
    +
    +