diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 752edf5936..41321b7837 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.735-190529 +Version: 7.0NG.735-190604 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 2a46a4b2ce..dcd6e1773d 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.735-190529" +pandora_version="7.0NG.735-190604" 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 ee7e608d18..54f76969c7 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.735'; -use constant AGENT_BUILD => '190529'; +use constant AGENT_BUILD => '190604'; # 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 cd93cda48a..432fb23bcc 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.735 -%define release 190529 +%define release 190604 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 eed9c0b196..b60141796d 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.735 -%define release 190529 +%define release 190604 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 8e3b4f662f..b8bae000eb 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.735" -PI_BUILD="190529" +PI_BUILD="190604" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index c1e8908e68..2755e2bdea 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190529} +{190604} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 0c988e2a7c..0686c724f8 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.735(Build 190529)") +#define PANDORA_VERSION ("7.0NG.735(Build 190604)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 57e8a1d67f..8650b54e46 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.735(Build 190529))" + VALUE "ProductVersion", "(7.0NG.735(Build 190604))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 2f275f8c11..6d045e7ee0 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.735-190529 +Version: 7.0NG.735-190604 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 b3f827589c..13cc28aa57 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.735-190529" +pandora_version="7.0NG.735-190604" package_pear=0 package_pandora=1 diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index d8e28223c6..86dccfa53a 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -186,7 +186,7 @@ switch ($login_screen) { echo ''; echo ''; echo '
'; @@ -226,7 +226,7 @@ switch ($login_screen) { ); echo '
'; echo '
'; - html_print_submit_button(__('Login'), 'login_button', false, 'class="sub next_login"'); + html_print_submit_button(__('Login'), 'login_button', false, 'class="next_login"'); echo '
'; } break; @@ -245,7 +245,7 @@ switch ($login_screen) { html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true); echo ''; echo '
'; - html_print_submit_button(__('Check code').'  >', 'login_button', false, 'class="sub next_login"'); + html_print_submit_button(__('Check code').'  >', 'login_button', false, 'class="next_login"'); echo '
'; break; @@ -319,7 +319,7 @@ echo ''; echo '
'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'
'; echo ''; -if (!isset($process_error_message) && isset($mail)) { +if (empty($process_error_message) && isset($mail)) { echo '
'; echo '
'; echo '
'; @@ -336,7 +336,7 @@ if (!isset($process_error_message) && isset($mail)) { echo '
'; echo '
'; echo '
'; -} else if (isset($process_error_message)) { +} else if (isset($process_error_message) && !empty($process_error_message)) { echo '
'; echo '
'; echo '
'; diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 5dc3118def..dfdd7390c3 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -1,17 +1,32 @@ $value) { - // Check if it has "ifXXXX" syntax and skip it + // Check if it has "ifXXXX" syntax and skip it. if (! preg_match('/if/', $key)) { continue; } @@ -98,7 +109,7 @@ if (is_ajax()) { echo io_json_mb_encode($out); } - // And and remove groups use the same function + // And and remove groups use the same function. $add_secondary_groups = get_parameter('add_secondary_groups'); $remove_secondary_groups = get_parameter('remove_secondary_groups'); if ($add_secondary_groups || $remove_secondary_groups) { @@ -114,12 +125,12 @@ if (is_ajax()) { 'agents_update_secondary_groups', [ $id_agent, - $add_secondary_groups ? $groups_to_add : [], - $remove_secondary_groups ? $groups_to_add : [], + ($add_secondary_groups) ? $groups_to_add : [], + ($remove_secondary_groups) ? $groups_to_add : [], ] ); // Echo 0 in case of error. 0 Otherwise. - echo $ret ? 1 : 0; + echo ($ret) ? 1 : 0; } } @@ -149,7 +160,7 @@ if ($new_agent) { } if (!$new_agent) { - // Agent remote configuration editor + // Agent remote configuration editor. enterprise_include_once('include/functions_config_agents.php'); if (enterprise_installed()) { $filename = config_agents_get_agent_config_filenames($id_agente); @@ -157,27 +168,41 @@ if (!$new_agent) { } $disk_conf_delete = (bool) get_parameter('disk_conf_delete'); -// Agent remote configuration DELETE +// Agent remote configuration DELETE. if ($disk_conf_delete) { // TODO: Get this working on computers where the Pandora server(s) are not on the webserver - // TODO: Get a remote_config editor working in the open version + // TODO: Get a remote_config editor working in the open version. @unlink($filename['md5']); @unlink($filename['conf']); } -echo '
'; +echo ''; + +// Custom ID. +$custom_id_div = '
'; +$custom_id_div .= '

'.__('Custom ID').':

'; +$custom_id_div .= html_print_input_text( + 'custom_id', + $custom_id, + '', + 16, + 255, + true, + false, + false, + '', + 'agent_custom_id' +).'
'; if (!$new_agent && $alias != '') { $table_agent_name = '

'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'

'; $table_agent_name .= '
'; - $table_agent_name .= '
'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'
'; - $table_agent_name .= '
'; - - $table_qr_code = '

'.__('QR Code Agent view').':

'; + $table_agent_name .= '
'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'
'; + $table_agent_name .= '
'; + + // QR code div. + $table_qr_code = '
'; + $table_qr_code .= '

'.__('QR Code Agent view').':

'; + $table_qr_code .= '
'; + if ($id_agente) { + $table_qr_code .= "
"; + } + + // Add Custom id div. + $table_qr_code .= '
'; + $table_qr_code .= $custom_id_div; + $table_qr_code .= '
'; } if ($new_agent) { @@ -257,14 +295,6 @@ if ($id_agente) { } "; - } - - $table_qr_code .= '
'; -} - $groups = users_get_groups($config['id_user'], 'AR', false); $modules = db_get_all_rows_sql( @@ -295,7 +325,21 @@ $table_primary_group .= '
'; $table_interval = '

'.__('Interval').':

'; $table_interval .= '
'; -$table_interval .= html_print_extended_select_for_time('intervalo', $intervalo, '', '', '0', 10, true); +$table_interval .= html_print_extended_select_for_time( + 'intervalo', + $intervalo, + '', + '', + '0', + 10, + true, + false, + true, + 'w40p' +); + + + if ($intervalo < SECONDS_5MINUTES) { $table_interval .= clippy_context_help('interval_agent_min'); } @@ -345,16 +389,17 @@ $table_server .= html_print_select( // Description. $table_description = '

'.__('Description').':

'; -$table_description .= html_print_input_text( +$table_description .= html_print_textarea( 'comentarios', + 3, + 10, $comentarios, '', - 45, - 200, - true + true, + 'agent_description' ).'
'; - +// QR code. echo '
'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'
@@ -368,46 +413,46 @@ echo '
'; if (enterprise_installed()) { $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]); - $table_adv_secondary_groups = '

'.__('Secondary groups').':

'; + $table_adv_secondary_groups = '

'.__('Secondary groups').':

'; $table_adv_secondary_groups_left = html_print_select_groups( false, - // Use the current user to select the groups + // Use the current user to select the groups. 'AR', - // ACL permission + // ACL permission. false, - // Not all group + // Not all group. 'secondary_groups', - // HTML id + // HTML id. '', - // No select any by default + // No select any by default. '', - // Javascript onChange code + // Javascript onChange code. '', - // Do not user no selected value + // Do not user no selected value. 0, - // Do not use no selected value + // Do not use no selected value. true, - // Return HTML (not echo) + // Return HTML (not echo). true, - // Multiple selection + // Multiple selection. true, - // Sorting by default + // Sorting by default. '', - // CSS classnames (default) + // CSS classnames (default). false, - // Not disabled (default) - 'width:50%; min-width:170px; text-align:center', - // Inline styles (default) + // Not disabled (default). + 'width:50%; min-width:170px;', + // Inline styles (default). false, - // Option style select (default) + // Option style select (default). false, - // Do not truncate the users tree (default) + // Do not truncate the users tree (default). 'id_grupo', - // Key to get as value (default) + // Key to get as value (default). false, - // Not strict user (default) + // Not strict user (default). $secondary_groups_selected['plain'] - // Do not show the primary group in this selection + // Do not show the primary group in this selection. ); $table_adv_secondary_groups_arrows = html_print_input_image( @@ -436,32 +481,32 @@ if (enterprise_installed()) { $table_adv_secondary_groups_right .= html_print_select( $secondary_groups_selected['for_select'], - // Values + // Values. 'secondary_groups_selected', - // HTML id + // HTML id. '', - // Selected + // Selected. '', - // Javascript onChange code + // Javascript onChange code. '', - // Nothing selected + // Nothing selected. 0, - // Nothing selected + // Nothing selected. true, - // Return HTML (not echo) + // Return HTML (not echo). true, - // Multiple selection + // Multiple selection. true, - // Sort + // Sort. '', - // Class + // Class. false, - // Disabled - 'width:50%; min-width:170px; text-align:center' - // Style + // Disabled. + 'width:50%; min-width:170px;' + // Style. ); - // safe operation mode + // Safe operation mode. if ($id_agente) { $sql_modules = db_get_all_rows_sql( 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo @@ -485,13 +530,13 @@ if (enterprise_installed()) { $table_adv_safe .= __('Module').' '.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true).'
'; } - // Remote configuration + // Remote configuration. $table_adv_remote = '

'.__('Remote configuration').':

'; if (!$new_agent && isset($filename) && file_exists($filename['md5'])) { $table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5'])); - // Delete remote configuration - $table_adv_remote .= ''; + // Delete remote configuration. + $table_adv_remote .= ''; $table_adv_remote .= html_print_image( 'images/cross.png', true, @@ -510,26 +555,29 @@ if (enterprise_installed()) { $table_adv_remote .= '
'; - $cps_array[-1] = __('Disabled'); - if ($cps > 0) { - $cps_array[$cps] = __('Enabled'); - } else { - $cps_inc = 0; - if ($id_agente) { - $cps_inc = service_agents_cps($id_agente); - } - $cps_array[$cps_inc] = __('Enabled'); + // Calculate cps value - agents. + if ($id_agente) { + $cps_val = service_agents_cps($id_agente); + } else { + // No agent defined, use received cps as base value. + if ($cps >= 0) { + $cps_val = $cps; + } } - $table_adv_cascade = '

'.__('Cascade protection services').': '; - $table_adv_cascade .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true).'

'; - $table_adv_cascade .= html_print_select($cps_array, 'cps', $cps, '', '', 0, true).'
'; + $cps_html = '
'; + $cps_html .= html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true); + $cps_html .= __('Cascade protection services').' '; + $cps_html .= ui_print_help_tip( + __('Alerts and events will be managed by the service joined by this agent.'), + true + ); + $cps_html .= '
'; + + $table_adv_cascade .= $cps_html; } -// Custom ID -$table_adv_custom_id = '

'.__('Custom ID').':

'; -$table_adv_custom_id .= html_print_input_text('custom_id', $custom_id, '', 16, 255, true).'
'; $table_adv_parent = '

'.__('Parent').':

'; $params = []; @@ -546,13 +594,26 @@ $params['cascade_protection'] = true; $table_adv_parent .= '
'; $table_adv_parent .= ui_print_agent_autocomplete_input($params); if (enterprise_installed()) { - $table_adv_parent .= html_print_checkbox_switch('cascade_protection', 1, $cascade_protection, true).__('Cascade protection').' '; + $table_adv_parent .= html_print_checkbox_switch( + 'cascade_protection', + 1, + $cascade_protection, + true + ).__('Cascade protection').' '; } -$table_adv_parent .= __('Module').' '.html_print_select($modules_values, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true).'
'; +$table_adv_parent .= __('Module').' '.html_print_select( + $modules_values, + 'cascade_protection_module', + $cascade_protection_module, + '', + '', + 0, + true +).'
'; -// Learn mode / Normal mode -$table_adv_module_mode = '

'.__('Module definition').':

'; +// Learn mode / Normal mode. +$table_adv_module_mode = '

'.__('Module definition').':

'; $table_adv_module_mode .= '
'; $table_adv_module_mode .= html_print_radio_button_extended( 'modo', @@ -586,9 +647,14 @@ $table_adv_module_mode .= html_print_radio_button_extended( ); $table_adv_module_mode .= '
'; -// Status (Disabled / Enabled) +// Status (Disabled / Enabled). $table_adv_status = '

'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'

'; -$table_adv_status .= html_print_checkbox_switch('disabled', 1, $disabled, true).'
'; +$table_adv_status .= html_print_checkbox_switch( + 'disabled', + 1, + $disabled, + true +).'
'; // Url address. if (enterprise_installed()) { @@ -625,11 +691,11 @@ foreach ($listIcons as $index => $value) { } $path = 'images/gis_map/icons/'; -// TODO set better method the path +// TODO set better method the path. $table_adv_agent_icon = '

'.__('Agent icon').': '.ui_print_help_tip(__('Agent icon for GIS Maps.'), true).'

'; if ($icon_path == '') { $display_icons = 'none'; - // Hack to show no icon. Use any given image to fix not found image errors + // Hack to show no icon. Use any given image to fix not found image errors. $path_without = 'images/spinner.png'; $path_default = 'images/spinner.png'; $path_ok = 'images/spinner.png'; @@ -686,6 +752,7 @@ if ($config['activate_gis']) { +// General display distribution. $table_adv_options = $table_adv_secondary_groups.'
'.$table_adv_secondary_groups_left.' @@ -698,7 +765,14 @@ $table_adv_options = $table_adv_secondary_groups.'
-
'.$table_adv_parent.$table_adv_custom_id.$table_adv_module_mode.$table_adv_cascade.$table_adv_gis.'
+
'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade; + +if ($new_agent) { + // If agent is new, show custom id as old style format. + $table_adv_options .= $custom_id_div; +} + +$table_adv_options .= $table_adv_gis.'
'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
'; @@ -711,10 +785,17 @@ $table = new stdClass(); $table->width = '100%'; $table->class = 'custom_fields_table'; -$table->head = []; +$table->head = [ + 0 => __('Click to display').ui_print_help_tip( + __('This field allows url insertion using the BBCode\'s url tag').'.
'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.

'.__('e.g.: [url=google.com]Google web search[/url]'), + true + ), +]; +$table->class = 'info_table'; $table->style = []; $table->style[0] = 'font-weight: bold;'; $table->data = []; +$table->rowstyle = []; $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -722,15 +803,12 @@ if ($fields === false) { $fields = []; } +$i = 0; foreach ($fields as $field) { $id_custom_field = $field['id_field']; $data[0] = '
'; $data[0] .= ''.$field['name'].''; - $data[0] .= ui_print_help_tip( - __('This field allows url insertion using the BBCode\'s url tag').'.
'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.

'.__('e.g.: [url=google.com]Google web search[/url]'), - true - ); $data[0] .= '
'; $combo = []; $combo = $field['combo_values']; @@ -753,6 +831,13 @@ foreach ($fields as $field) { $custom_value = ''; } + $table->rowstyle[$i] = 'cursor: pointer;'; + if (!empty($custom_value)) { + $table->rowstyle[($i + 1)] = 'display: table-row;'; + } else { + $table->rowstyle[($i + 1)] = 'display: none;'; + } + if ($field['is_password_type']) { $data_field[1] = html_print_input_text_extended( 'customvalue_'.$field['id_field'], @@ -801,21 +886,28 @@ foreach ($fields as $field) { }; $table->rowid[] = 'name_field-'.$id_custom_field; - array_push($table->data, $data); + $table->data[] = $data; $table->rowid[] = 'field-'.$id_custom_field; - array_push($table->data, $data_field); + $table->data[] = $data_field; + $i += 2; } if (!empty($fields)) { echo '
'; - ui_toggle(html_print_table($table, true), __('Custom fields'), '', true, false, 'white_box white_box_opened'); + ui_toggle( + html_print_table($table, true), + __('Custom fields'), + '', + true, + false, + 'white_box white_box_opened' + ); echo '
'; } echo '
'; - // The context help about the learning mode. if ($modo == 0) { echo ""; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 9795fff190..22410b0e23 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1,17 +1,32 @@ '.html_print_image( + $remote_configuration_tab['text'] = ''.html_print_image( 'images/remote_configuration.png', true, ['title' => __('Remote configuration')] @@ -575,20 +591,24 @@ if ($id_agente) { } $help_header = ''; + $tab_name = ''; // This add information to the header. switch ($tab) { case 'main': $tab_description = '- '.__('Setup'); $help_header = 'main_tab'; + $tab_name = 'Setup'; break; case 'collection': $tab_description = '- '.__('Collection'); + $tab_name = 'Collection'; break; case 'inventory': $tab_description = '- '.__('Inventory'); $help_header = 'inventory_tab'; + $tab_name = 'Inventory'; break; case 'plugins': @@ -599,6 +619,7 @@ if ($id_agente) { case 'module': $type_module_t = get_parameter('moduletype', ''); $tab_description = '- '.__('Modules'); + $tab_name = 'Modules'; if ($type_module_t == 'webux') { $help_header = 'wux_console'; } else { @@ -609,10 +630,12 @@ if ($id_agente) { case 'alert': $tab_description = '- '.__('Alert'); $help_header = 'manage_alert_list'; + $tab_name = 'Alerts'; break; case 'template': $tab_description = '- '.__('Templates'); + $tab_name = 'Module templates'; break; case 'gis': @@ -633,16 +656,19 @@ if ($id_agente) { case 'snmp_explorer': $tab_description = '- '.__('SNMP Wizard'); $help_header = 'agent_snmp_explorer_tab'; + $tab_name = 'SNMP Wizard'; break; case 'snmp_interfaces_explorer': $tab_description = '- '.__('SNMP Interfaces wizard'); $help_header = 'agent_snmp_interfaces_explorer_tab'; + $tab_name = 'SNMP Interfaces wizard'; break; case 'wmi_explorer': $tab_description = '- '.__('WMI Wizard'); $help_header = 'agent_snmp_wmi_explorer_tab'; + $tab_name = 'WMI Wizard'; break; default: @@ -679,7 +705,15 @@ if ($id_agente) { $onheader, false, '', - $config['item_title_size_text'] + $config['item_title_size_text'], + '', + ui_print_breadcrums( + [ + __('Resources'), + __('Manage agents'), + ''.$tab_name.'', + ] + ) ); } else { // Create agent. @@ -688,7 +722,19 @@ if ($id_agente) { 'images/bricks.png', false, 'create_agent', - true + true, + '', + false, + '', + GENERIC_SIZE_TEXT, + '', + ui_print_breadcrums( + [ + __('Resources'), + __('Manage agents'), + ''.__('Create agent').'', + ] + ) ); } @@ -829,8 +875,7 @@ if ($update_agent) { $update_gis_data = (int) get_parameter_post('update_gis_data', 0); $url_description = (string) get_parameter('url_description'); $quiet = (int) get_parameter('quiet', 0); - $cps = (int) get_parameter('cps', 0); - + $cps = get_parameter_switch('cps', -1); $old_values = db_get_row('tagente', 'id_agente', $id_agente); $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -978,7 +1023,7 @@ if ($update_agent) { [ $id_agente, 'standby', - $disabled ? '1' : '0', + ($disabled) ? '1' : '0', ] ); // Validate alerts for disabled agents. @@ -1064,7 +1109,7 @@ if ($update_agent) { ui_print_success_message(__('Successfully updated')); db_pandora_audit( 'Agent management', - "Updated agent $alias", + 'Updated agent '.$alias, false, false, $info @@ -1206,7 +1251,7 @@ if ($update_module || $create_module) { } if ($id_module_type == 25) { - // web analysis, from MODULE_WUX. + // Web analysis, from MODULE_WUX. $custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default)); $custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default); } else { @@ -1252,12 +1297,11 @@ if ($update_module || $create_module) { foreach ($conf_array as $line) { if (preg_match('/^module_name\s*(.*)/', $line, $match)) { - $new_configuration_data .= 'module_name '.io_safe_output($name)."\n"; - } - - // We delete from conf all the module macros starting with _field. - else if (!preg_match('/^module_macro_field.*/', $line, $match)) { - $new_configuration_data .= "$line\n"; + $new_configuration_data .= 'module_name '; + $new_configuration_data .= io_safe_output($name)."\n"; + } else if (!preg_match('/^module_macro_field.*/', $line, $match)) { + // We delete from conf all the module macros starting with _field. + $new_configuration_data .= $line."\n"; } } @@ -1419,9 +1463,13 @@ if ($update_module || $create_module) { } $active_snmp_v3 = get_parameter('active_snmp_v3'); - if ($active_snmp_v3) { - // LOST CODE? - } + + /* + * if ($active_snmp_v3) { + * // LOST CODE?. + * + * } + */ $throw_unknown_events = (bool) get_parameter('throw_unknown_events', false); // Set the event type that can show. @@ -1586,7 +1634,7 @@ if ($update_module) { db_pandora_audit( 'Agent management', - "Fail to try update module '$name' for agent ".$agent['alias'] + "Fail to try update module '".$name."' for agent ".$agent['alias'] ); } else { if ($prediction_module == 3) { @@ -1610,7 +1658,7 @@ if ($update_module) { db_pandora_audit( 'Agent management', - "Updated module '$name' for agent ".$agent['alias'], + "Updated module '".$name."' for agent ".$agent['alias'], false, false, io_json_mb_encode($values) @@ -1764,7 +1812,7 @@ if ($create_module) { $moduletype = $id_module; db_pandora_audit( 'Agent management', - 'Fail to try added module '.$name.' for agent '.$agent['alias'] + "Fail to try added module '".$name."' for agent ".$agent['alias'] ); } else { if ($prediction_module == 3) { @@ -1789,7 +1837,7 @@ if ($create_module) { $agent = db_get_row('tagente', 'id_agente', $id_agente); db_pandora_audit( 'Agent management', - "Added module '$name' for agent ".$agent['alias'], + "Added module '".$name."' for agent ".$agent['alias'], false, true, io_json_mb_encode($values) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 902d074f21..0e08a3728f 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -118,7 +118,7 @@ if ($enable_agent) { enterprise_include_once('include/functions_agents.php'); $values = ['disabled' => 0]; enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]); - + config_agents_update_config_token($enable_agent, 'standby', 0); db_pandora_audit('Agent management', 'Enable '.$alias); } else { db_pandora_audit('Agent management', 'Fail to enable '.$alias); @@ -140,6 +140,7 @@ if ($disable_agent) { enterprise_include_once('include/functions_agents.php'); $values = ['disabled' => 1]; enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]); + config_agents_update_config_token($disable_agent, 'standby', 1); db_pandora_audit('Agent management', 'Disable '.$alias); } else { diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index dfd2fbc30d..ee61cdaf79 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -516,14 +516,22 @@ if ($tab == 'tree') { $table = new StdClass(); $table->width = '100%'; $table->class = 'info_table'; + $table->headstyle = []; $table->head = []; $table->head[0] = __('ID'); + $table->headstyle[0] = 'min-width: 100px;'; $table->head[1] = __('Name'); + $table->headstyle[1] = 'min-width: 100px;'; $table->head[2] = __('Icon'); + $table->headstyle[2] = 'min-width: 100px;'; $table->head[3] = __('Alerts'); + $table->headstyle[3] = 'min-width: 100px;'; $table->head[4] = __('Parent'); + $table->headstyle[4] = 'min-width: 100px;'; $table->head[5] = __('Description'); + $table->headstyle[5] = 'min-width: 100px;'; $table->head[6] = __('Actions'); + $table->headstyle[6] = 'min-width: 100px;'; $table->align = []; $table->align[0] = 'left'; $table->align[2] = 'left'; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index e8af78ed62..44e616977d 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -760,6 +760,9 @@ switch ($action) { $table->head = []; $table->align = []; + $table->headstyle = []; + $table->style = []; + $table->align[2] = 'left'; $table->align[3] = 'left'; $table->align[4] = 'left'; @@ -771,11 +774,21 @@ switch ($action) { $table->size[0] = '20%'; $table->size[1] = '30%'; $table->size[2] = '2%'; + $table->headstyle[2] = 'min-width: 35px;'; $table->size[3] = '2%'; + $table->headstyle[3] = 'min-width: 35px;'; $table->size[4] = '2%'; + $table->headstyle[4] = 'min-width: 35px;'; $table->size[5] = '2%'; + $table->headstyle[5] = 'min-width: 35px;'; $table->size[6] = '2%'; - $table->size['csv'] = '5%'; + $table->headstyle[6] = 'min-width: 35px;'; + $table->size[7] = '5%'; + $table->headstyle['csv'] = 'min-width: 65px;'; + $table->style[7] = 'text-align: center;'; + + $table->headstyle[9] = 'min-width: 100px;'; + $table->style[9] = 'text-align: center;'; $next = 4; // Calculate dinamically the number of the column. @@ -814,7 +827,6 @@ switch ($action) { // $table->size = array (); $table->size[$next] = '10%'; $table->align[$next] = 'left'; - $table->headstyle[$next] = 'text-align:left;'; } $columnview = false; @@ -996,7 +1008,6 @@ switch ($action) { $table->head[$next] = ''.__('Op.').''.html_print_checkbox('all_delete', 0, false, true, false); $table->size = []; // $table->size[$next] = '80px'; - $table->style[$next] = 'text-align:left;'; } if ($edit) { diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 2ab1b8d967..1b5486b570 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -231,7 +231,12 @@ if ($tiny) { } if ($tiny) { - ui_toggle(html_print_table($table, true), __('Tactical server information'), false, $hidden_toggle); + ui_toggle( + html_print_table($table, true), + __('Tactical server information'), + false, + $hidden_toggle + ); } else { html_print_table($table); } diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index f0e2359be4..af414d6ab3 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -247,8 +247,7 @@ $table->style[0] = 'font-weight: bold'; $table->size[0] = '70%'; $table->size[1] = '30%'; -enterprise_hook('enterprise_warnings_history_days'); - +// enterprise_hook('enterprise_warnings_history_days'); $table->data[1][0] = __('Max. days before delete events'); $table->data[1][0] .= ui_print_help_tip( __('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index da163406ee..9392d03ad4 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -361,50 +361,61 @@ class DiscoveryTaskList extends Wizard $recon_tasks = []; } - $url_ajax = $config['homeurl'].'ajax.php'; + $url_ajax = $config['homeurl'].'ajax.php'; - $table = new StdClass(); - $table->cellpadding = 0; - $table->cellspacing = 0; - $table->width = '100%'; - $table->class = 'info_table'; - $table->head = []; - $table->data = []; - $table->align = []; - $table->headstyle = []; + $table = new StdClass(); + $table->cellpadding = 0; + $table->cellspacing = 0; + $table->width = '100%'; + $table->class = 'info_table'; + $table->head = []; + $table->data = []; + $table->align = []; + $table->headstyle = []; for ($i = 0; $i < 9; $i++) { $table->headstyle[$i] = 'text-align: left;'; } - $table->head[0] = __('Force'); - $table->align[0] = 'left'; + // Status. + $table->headstyle[5] .= 'min-width: 100px; width: 100px;'; + // Task type. + $table->headstyle[6] .= 'min-width: 200px; width: 150px;'; + // Progress. + $table->headstyle[7] .= 'min-width: 150px; width: 150px;'; + // Updated at. + $table->headstyle[8] .= 'min-width: 150px; width: 150px;'; + // Operations. + $table->headstyle[9] .= 'min-width: 150px; width: 150px;'; - $table->head[1] = __('Task name'); - $table->align[1] = 'left'; + $table->head[0] = __('Force'); + $table->align[0] = 'left'; - $table->head[2] = __('Server name'); - $table->align[2] = 'left'; + $table->head[1] = __('Task name'); + $table->align[1] = 'left'; - $table->head[3] = __('Interval'); - $table->align[3] = 'left'; + $table->head[2] = __('Server name'); + $table->align[2] = 'left'; - $table->head[4] = __('Network'); - $table->align[4] = 'left'; + $table->head[3] = __('Interval'); + $table->align[3] = 'left'; - $table->head[5] = __('Status'); - $table->align[5] = 'left'; + $table->head[4] = __('Network'); + $table->align[4] = 'left'; - $table->head[6] = __('Task type'); - $table->align[6] = 'left'; + $table->head[5] = __('Status'); + $table->align[5] = 'left'; - $table->head[7] = __('Progress'); - $table->align[7] = 'left'; + $table->head[6] = __('Task type'); + $table->align[6] = 'left'; - $table->head[8] = __('Updated at'); - $table->align[8] = 'left'; + $table->head[7] = __('Progress'); + $table->align[7] = 'left'; - $table->head[9] = __('Operations'); - $table->align[9] = 'left'; + $table->head[8] = __('Updated at'); + $table->align[8] = 'left'; + + $table->head[9] = __('Operations'); + $table->align[9] = 'left'; foreach ($recon_tasks as $task) { $data = []; @@ -553,13 +564,7 @@ class DiscoveryTaskList extends Wizard if ($task['status'] <= 0 || $task['status'] > 100) { $data[7] = '-'; } else { - $data[7] = progress_bar( - $task['status'], - 100, - 20, - __('Progress').':'.$task['status'].'%', - 1 - ); + $data[7] = ui_progress($task['status'], '100%', 1.5); } if ($task['utimestamp'] > 0) { diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 6468f1d2ac..f76678ffb6 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -783,20 +783,24 @@ class Wizard /** * Print a form. * - * @param array $data Definition of target form to be printed. - * @param boolean $return Return as string or direct output. + * @param array $data Definition of target form to be printed. + * @param boolean $return Return as string or direct output. + * @param boolean $print_white_box Print a white box. * * @return string HTML code. */ - public function printForm(array $data, bool $return=false, bool $print_white_box=false) - { + public function printForm( + array $data, + bool $return=false, + bool $print_white_box=false + ) { $form = $data['form']; $inputs = $data['inputs']; $js = $data['js']; $cb_function = $data['cb_function']; $cb_args = $data['cb_args']; - $output_head = ''; if ($return === false) { @@ -868,7 +872,7 @@ class Wizard $cb_function = $data['cb_function']; $cb_args = $data['cb_args']; - $output_head = ''; if ($return === false) { @@ -963,7 +967,7 @@ class Wizard $cb_function = $data['cb_function']; $cb_args = $data['cb_args']; - $output_head = ''; if ($return === false) { diff --git a/pandora_console/images/arrow_right_green.png b/pandora_console/images/arrow_right_green.png new file mode 100644 index 0000000000..a772cd6cf4 Binary files /dev/null and b/pandora_console/images/arrow_right_green.png differ diff --git a/pandora_console/images/status_sets/default/module_alertsfired_rounded.png b/pandora_console/images/status_sets/default/module_alertsfired_rounded.png new file mode 100644 index 0000000000..7a9b5ae0cd Binary files /dev/null and b/pandora_console/images/status_sets/default/module_alertsfired_rounded.png differ diff --git a/pandora_console/images/status_sets/default/module_critical_rounded.png b/pandora_console/images/status_sets/default/module_critical_rounded.png new file mode 100644 index 0000000000..7fceda18da Binary files /dev/null and b/pandora_console/images/status_sets/default/module_critical_rounded.png differ diff --git a/pandora_console/images/status_sets/default/module_no_data_rounded.png b/pandora_console/images/status_sets/default/module_no_data_rounded.png new file mode 100644 index 0000000000..fd5e433ece Binary files /dev/null and b/pandora_console/images/status_sets/default/module_no_data_rounded.png differ diff --git a/pandora_console/images/status_sets/default/module_ok_rounded.png b/pandora_console/images/status_sets/default/module_ok_rounded.png new file mode 100644 index 0000000000..d47f2ef4ff Binary files /dev/null and b/pandora_console/images/status_sets/default/module_ok_rounded.png differ diff --git a/pandora_console/images/status_sets/default/module_unknown_rounded.png b/pandora_console/images/status_sets/default/module_unknown_rounded.png new file mode 100644 index 0000000000..2ec6d98f39 Binary files /dev/null and b/pandora_console/images/status_sets/default/module_unknown_rounded.png differ diff --git a/pandora_console/images/status_sets/default/module_warning_rounded.png b/pandora_console/images/status_sets/default/module_warning_rounded.png new file mode 100644 index 0000000000..c28924178d Binary files /dev/null and b/pandora_console/images/status_sets/default/module_warning_rounded.png differ diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index ed73c58aa5..b58a3c2386 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -717,9 +717,15 @@ if ($table_events) { 'event_condition', 'AND' ); - echo '
'; - echo ''; - echo html_print_checkbox('all_events_24h', $all_events_24h, $all_events_24h, true, false, '', true); + echo '
'; + echo ''; + echo html_print_switch( + [ + 'name' => 'all_events_24h', + 'value' => $all_events_24h, + 'id' => 'checkbox-all_events_24h', + ] + ); echo '
'; $date_subtract_day = (time() - (24 * 60 * 60)); diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 7b11249f18..76dc24e145 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1,17 +1,33 @@ 'tagente_modulo.id_modulo', @@ -583,6 +601,10 @@ if (check_login()) { 'order' => 'DESC', ]; break; + + default: + // Ignore. + break; } break; @@ -603,6 +625,10 @@ if (check_login()) { 'order' => '', ]; break; + + default: + // Ignore. + break; } break; @@ -623,6 +649,10 @@ if (check_login()) { 'order' => 'DESC', ]; break; + + default: + // Ignore. + break; } break; @@ -645,7 +675,8 @@ if (check_login()) { break; } - // Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!) + // Fix: for tag functionality groups have to be all user_groups + // (propagate ACL funct!). $groups = users_get_groups($config['id_user'], $access); $tags_join = ''; @@ -669,7 +700,7 @@ if (check_login()) { $status_filter_sql = '1 = 1'; if ($status_filter_monitor == AGENT_MODULE_STATUS_NOT_NORMAL) { - // Not normal + // Not normal. $status_filter_sql = ' tagente_estado.estado <> 0'; } else if ($status_filter_monitor != -1) { $status_filter_sql = 'tagente_estado.estado = '.$status_filter_monitor; @@ -693,7 +724,7 @@ if (check_login()) { } // Count monitors/modules - // Build the order sql + // Build the order sql. $first = true; foreach ($order as $ord) { if ($first) { @@ -769,6 +800,7 @@ if (check_login()) { $table = new stdClass(); $table->width = '100%'; + $table->styleTable = 'border: 0;border-radius: 0;'; $table->cellpadding = 0; $table->cellspacing = 0; $table->class = 'info_table'; @@ -791,7 +823,6 @@ if (check_login()) { $table->head[6] = __('Thresholds'); $table->head[7] = __('Data'); $table->head[8] = __('Graph'); - $table->headstyle[8] = 'min-width: 60px'; $table->head[9] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown); $table->align = [ 'left', @@ -805,6 +836,12 @@ if (check_login()) { 'left', ]; + $table->headstyle[2] = 'min-width: 60px'; + $table->headstyle[3] = 'min-width: 100px'; + $table->headstyle[5] = 'min-width: 60px'; + $table->headstyle[8] = 'min-width: 85px'; + $table->headstyle[9] = 'min-width: 100px'; + $last_modulegroup = 0; $rowIndex = 0; @@ -936,12 +973,12 @@ if (check_login()) { } } - // Adds tag context information + // Adds tag context information. if (tags_get_modules_tag_count($module['id_agente_modulo']) > 0) { $data[3] .= '
'.html_print_image('images/tag_red.png', true, ['id' => 'tag-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).' '; } - // Adds relations context information + // Adds relations context information. if (modules_relation_exists($module['id_agente_modulo'])) { $data[3] .= ' '.html_print_image('images/link2.png', true, ['id' => 'relations-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).' '; } @@ -964,7 +1001,7 @@ if (check_login()) { $title ); - $data[5] = ui_print_status_image($status, $title, true); + $data[5] = ui_print_module_status($module['estado'], $title, true, false, true); if (!$show_context_help_first_time) { $show_context_help_first_time = true; @@ -973,122 +1010,85 @@ if (check_login()) { } } - if ($module['id_tipo_modulo'] == 24) { - // log4x - switch ($module['datos']) { - case 10: - $salida = 'TRACE'; - $style = 'font-weight:bold; color:darkgreen;'; - break; + if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) { + if ($config['render_proc']) { + switch ($module['id_tipo_modulo']) { + case 2: + case 6: + case 9: + case 18: + case 21: + case 31: + if ($module['datos'] >= 1) { + $salida = $config['render_proc_ok']; + } else { + $salida = $config['render_proc_fail']; + } + break; - case 20: - $salida = 'DEBUG'; - $style = 'font-weight:bold; color:darkgreen;'; - break; - - case 30: - $salida = 'INFO'; - $style = 'font-weight:bold; color:darkgreen;'; - break; - - case 40: - $salida = 'WARN'; - $style = 'font-weight:bold; color:darkorange;'; - break; - - case 50: - $salida = 'ERROR'; - $style = 'font-weight:bold; color:red;'; - break; - - case 60: - $salida = 'FATAL'; - $style = 'font-weight:bold; color:red;'; - break; - } - - $salida = "$salida"; - } else { - if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) { - if ($config['render_proc']) { - switch ($module['id_tipo_modulo']) { - case 2: - case 6: - case 9: - case 18: - case 21: - case 31: - if ($module['datos'] >= 1) { - $salida = $config['render_proc_ok']; - } else { - $salida = $config['render_proc_fail']; - } - break; - - default: - switch ($module['id_tipo_modulo']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { - if ($module['post_process'] > 0) { - $salida = human_milliseconds_to_string(($module['datos'] / $module['post_process'])); - } else { - $salida = human_milliseconds_to_string($module['datos']); - } + default: + switch ($module['id_tipo_modulo']) { + case 15: + $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); + if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { + if ($module['post_process'] > 0) { + $salida = human_milliseconds_to_string(($module['datos'] / $module['post_process'])); } else { - $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); + $salida = human_milliseconds_to_string($module['datos']); } - break; - - default: - $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); - break; - } - break; - } - } else { - switch ($module['id_tipo_modulo']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { - if ($module['post_process'] > 0) { - $salida = human_milliseconds_to_string(($module['datos'] / $module['post_process'])); } else { - $salida = human_milliseconds_to_string($module['datos']); + $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); } - } else { + break; + + default: $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); - } - break; - - default: - $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); - break; - } - } - - // Show units ONLY in numeric data types - if (isset($module['unit'])) { - $data_macro = modules_get_unit_macro($module['datos'], $module['unit']); - if ($data_macro) { - $salida = $data_macro; - } else { - $salida .= ' '.''.io_safe_output($module['unit']).''; - } + break; + } + break; } } else { + switch ($module['id_tipo_modulo']) { + case 15: + $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); + if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { + if ($module['post_process'] > 0) { + $salida = human_milliseconds_to_string(($module['datos'] / $module['post_process'])); + } else { + $salida = human_milliseconds_to_string($module['datos']); + } + } else { + $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); + } + break; + + default: + $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); + break; + } + } + + // Show units ONLY in numeric data types + if (isset($module['unit'])) { $data_macro = modules_get_unit_macro($module['datos'], $module['unit']); if ($data_macro) { $salida = $data_macro; } else { - $salida = ui_print_module_string_value( - $module['datos'], - $module['id_agente_modulo'], - $module['current_interval'], - $module['module_name'] - ); + $salida .= ' '.''.io_safe_output($module['unit']).''; } } + } else { + $data_macro = modules_get_unit_macro($module['datos'], $module['unit']); + if ($data_macro) { + $salida = $data_macro; + } else { + $salida = ui_print_module_string_value( + $module['datos'], + $module['id_agente_modulo'], + $module['current_interval'], + $module['module_name'] + ); + } } if ($module['id_tipo_modulo'] != 25) { @@ -1230,5 +1230,3 @@ if (check_login()) { return; } } - - diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 1ab383b672..b9a5ede1e5 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -282,39 +282,42 @@ function process_user_login_remote($login, $pass, $api=false) } } } else if ($config['auth'] === 'ldap') { - if ($config['ldap_save_password']) { - $update_credentials = change_local_user_pass_ldap($login, $pass); + // Check if autocreate remote users is active. + if ($config['autocreate_remote_users'] == 1) { + if ($config['ldap_save_password']) { + $update_credentials = change_local_user_pass_ldap($login, $pass); - if ($update_credentials) { - $config['auth_error'] = __('Your permissions have changed. Please, login again.'); - return false; - } - } else { - delete_user_pass_ldap($login); - } - - $permissions = fill_permissions_ldap($sr); - if (empty($permissions)) { - $config['auth_error'] = __('User not found in database or incorrect password'); - return false; - } else { - // check permissions - $result = check_permission_ad( - $login, - $pass, - false, - $permissions, - defined('METACONSOLE') - ); - - if ($return === 'error_permissions') { - $config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); - return false; - } else { - if ($return === 'permissions_changed') { + if ($update_credentials) { $config['auth_error'] = __('Your permissions have changed. Please, login again.'); return false; } + } else { + delete_user_pass_ldap($login); + } + + $permissions = fill_permissions_ldap($sr); + if (empty($permissions)) { + $config['auth_error'] = __('User not found in database or incorrect password'); + return false; + } else { + // check permissions + $result = check_permission_ad( + $login, + $pass, + false, + $permissions, + defined('METACONSOLE') + ); + + if ($return === 'error_permissions') { + $config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); + return false; + } else { + if ($return === 'permissions_changed') { + $config['auth_error'] = __('Your permissions have changed. Please, login again.'); + return false; + } + } } } } @@ -1337,8 +1340,9 @@ function fill_permissions_ldap($sr) 'tags' => implode(',', $ldap_adv_perm['tags']), 'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0, ]; - return $permissions; } + + return $permissions; } foreach ($result as $perms) { diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 90e2f2a0d4..7bf232e068 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -1519,43 +1519,8 @@ class NetworkMap */ public static function getColorByStatus($status) { - if (isset($status) === false) { - return COL_UNKNOWN; - } - - switch ($status) { - case AGENT_MODULE_STATUS_NORMAL: - case AGENT_STATUS_NORMAL: - return COL_NORMAL; - - case AGENT_MODULE_STATUS_NOT_INIT: - case AGENT_STATUS_NOT_INIT: - return COL_NOTINIT; - - case AGENT_MODULE_STATUS_CRITICAL_BAD: - case AGENT_STATUS_CRITICAL: - return COL_CRITICAL; - - case AGENT_MODULE_STATUS_WARNING: - case AGENT_STATUS_WARNING: - return COL_WARNING; - - case AGENT_MODULE_STATUS_CRITICAL_ALERT: - case AGENT_MODULE_STATUS_WARNING_ALERT: - case AGENT_STATUS_ALERT_FIRED: - return COL_ALERTFIRED; - - case AGENT_MODULE_STATUS_UNKNOWN: - case AGENT_STATUS_UNKNOWN: - return COL_UNKNOWN; - - default: - // Ignored. - break; - } - - return COL_IGNORED; - + include_once __DIR__.'/../functions_modules.php'; + return modules_get_color_status($status); } diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index d671f0bb81..a91ee7173c 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 = 'PC190529'; +$build_version = 'PC190604'; $pandora_version = 'v7.0NG.735'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 73b787ff99..f299153da6 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -871,12 +871,13 @@ function get_parameter_switch($name, $default='') $data = get_parameter($name, null); if ($data === null) { - return 0; + return (isset($default) ? $default : 0); } else if ($data == 'on') { return 1; } - return 0; + // Return value assigned to switch. + return $data; } @@ -4945,6 +4946,14 @@ function get_help_info($section_name) } break; + case 'create_agent': + if ($es) { + $result .= 'Intro_Monitorizacion&printable=yes#Configuraci.C3.B3n_del_agente_en_consola'; + } else { + $result .= 'Intro_Monitoring&printable=yes#Agent_configuration_in_the_console'; + } + break; + case 'agent_snmp_explorer_tab': if ($es) { $result .= 'Monitorizacion_remota&printable=yes#Wizard_SNMP'; diff --git a/pandora_console/include/functions_clippy.php b/pandora_console/include/functions_clippy.php index f3bc6a5967..67999a75e0 100644 --- a/pandora_console/include/functions_clippy.php +++ b/pandora_console/include/functions_clippy.php @@ -296,7 +296,7 @@ function clippy_context_help($help=null) $code = str_replace('{clippy}', '#'.$id, $code); $code = str_replace('{clippy_obj}', 'intro_'.$id, $code); - $return = $code.'
'.html_print_image( + $return = $code.' diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 4ef3800fca..488d6a28cd 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -270,7 +270,7 @@ function config_update_config() $error_update[] = __('Referer security'); } - if (!config_update_value('event_storm_protection', get_parameter('event_storm_protection'))) { + if (!config_update_value('event_storm_protection', get_parameter('event_storm_protection', 0))) { $error_update[] = __('Event storm protection'); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index fc874f2841..3feceb847b 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -959,6 +959,8 @@ function events_print_event_table( ) { global $config; + ui_require_css_file('events'); + if ($agent_id == 0) { $agent_condition = ''; } else { @@ -997,7 +999,7 @@ function events_print_event_table( $table->cellpadding = 0; $table->cellspacing = 0; $table->width = $width; - $table->class = 'databox data'; + $table->class = 'info_table no-td-padding'; if (!$tactical_view) { $table->title = __('Latest events'); } @@ -1010,36 +1012,38 @@ function events_print_event_table( $table->cellclass = []; $table->data = []; $table->align = []; - $table->style[0] = 'width:25px;'; - $table->style[1] = 'width:25px;'; - $table->style[2] = 'width:25px;'; - if ($agent_id == 0) { - $table->style[3] = 'word-break: break-all;'; - } + $table->style = []; - $table->style[4] = 'width:120px; word-break: break-all;'; + $i = 0; + $table->head[$i] = "".__('S.').''; + $table->headstyle[$i] = 'width: 1%;text-align: center;'; + $table->style[$i++] = 'text-align: center;'; - $table->head[0] = "".__('V.').''; - $table->align[0] = 'center'; + $table->head[$i] = __('Type'); + $table->headstyle[$i] = 'width: 3%;text-align: center;'; + $table->style[$i++] = 'text-align: center;'; - $table->head[1] = "".__('S.').''; - $table->align[1] = 'center'; - - $table->head[2] = __('Type'); - $table->headclass[2] = 'datos3 f9'; - $table->align[2] = 'center'; - - $table->head[3] = __('Event name'); + $table->head[$i] = __('Event name'); + $table->headstyle[$i] = ''; + $table->style[$i++] = 'word-break: break-word;'; if ($agent_id == 0) { - $table->head[4] = __('Agent name'); - $table->size[4] = '15%'; + $table->head[$i] = __('Agent name'); + $table->headstyle[$i] = ''; + $table->style[$i++] = 'word-break: break-all;'; } - $table->head[5] = __('Timestamp'); - $table->headclass[5] = 'datos3 f9'; - $table->align[5] = 'left'; - $table->size[5] = '15%'; + $table->head[$i] = __('Timestamp'); + $table->headstyle[$i] = 'width: 120px;'; + $table->style[$i++] = 'word-break: break-word;'; + + $table->head[$i] = __('Status'); + $table->headstyle[$i] = 'width: 150px;text-align: center;'; + $table->style[$i++] = 'text-align: center;'; + + $table->head[$i] = "".__('V.').''; + $table->headstyle[$i] = 'width: 1%;text-align: center;'; + $table->style[$i++] = 'text-align: center;'; $all_groups = []; if ($agent_id != 0) { @@ -1078,53 +1082,15 @@ function events_print_event_table( break; } - $data[0] = html_print_image( - $img, - true, - [ - 'class' => 'image_status', - 'title' => $title, - ] - ); - - switch ($event['criticity']) { - default: - case EVENT_CRIT_MAINTENANCE: - $img = 'images/status_sets/default/severity_maintenance.png'; - break; - case EVENT_CRIT_INFORMATIONAL: - $img = 'images/status_sets/default/severity_informational.png'; - break; - - case EVENT_CRIT_NORMAL: - $img = 'images/status_sets/default/severity_normal.png'; - break; - - case EVENT_CRIT_WARNING: - $img = 'images/status_sets/default/severity_warning.png'; - break; - - case EVENT_CRIT_CRITICAL: - $img = 'images/status_sets/default/severity_critical.png'; - break; - } - - $data[1] = html_print_image( - $img, - true, - [ - 'class' => 'image_status', - 'width' => 12, - 'height' => 12, - 'title' => get_priority_name($event['criticity']), - ] - ); + $i = 0; + // Criticity. + $data[$i++] = ui_print_event_priority($event['criticity'], true, true); // Event type. - $data[2] = events_print_type_img($event['event_type'], true); + $data[$i++] = events_print_type_img($event['event_type'], true); // Event text. - $data[3] = ui_print_string_substr( + $data[$i++] = ui_print_string_substr( strip_tags(io_safe_output($event['evento'])), 75, true, @@ -1135,33 +1101,32 @@ function events_print_event_table( if ($event['id_agente'] > 0) { // Agent name. // Get class name, for the link color, etc. - $myclass = get_priority_class($event['criticity']); - - $data[4] = "".agents_get_alias($event['id_agente']).''; + $data[$i] = "".agents_get_alias($event['id_agente']).''; // For System or SNMP generated alerts. } else if ($event['event_type'] == 'system') { - $data[4] = __('System'); + $data[$i] = __('System'); } else { - $data[4] = __('Alert').'SNMP'; + $data[$i] = __('Alert').'SNMP'; } + + $i++; } // Timestamp. - $data[5] = ui_print_timestamp($event['timestamp'], true, ['style' => 'font-size: 7.5pt; letter-spacing: 0.3pt;']); + $data[$i++] = ui_print_timestamp($event['timestamp'], true, ['style' => 'font-size: 7.5pt; letter-spacing: 0.3pt;']); - $class = get_priority_class($event['criticity']); - $cell_classes[3] = $class; - $cell_classes[4] = $class; - $cell_classes[5] = $class; + // Status. + $data[$i++] = ui_print_event_type($event['event_type'], true); - array_push($table->cellclass, $cell_classes); - - /* - Commented out (old). - // array_push ($table->rowclass, get_priority_class ($event["criticity"])); - */ - - array_push($table->data, $data); + $data[$i++] = html_print_image( + $img, + true, + [ + 'class' => 'image_status', + 'title' => $title, + ] + ); + $table->data[] = $data; } $events_table = html_print_table($table, true); @@ -2293,7 +2258,7 @@ function events_get_response_target( global $config; // If server_id > 0, it's a metaconsole query. - $meta = $server_id > 0; + $meta = $server_id > 0 || is_metaconsole(); $event_table = events_get_events_table($meta, $history); $event = db_get_row($event_table, 'id_evento', $event_id); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 81a3365fc5..86de873965 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2479,7 +2479,7 @@ function truncate_negatives(&$element) * @param bool return or echo flag * @param bool show_not_init flag */ -function graph_agent_status($id_agent=false, $width=300, $height=200, $return=false, $show_not_init=false, $data_agents=false) +function graph_agent_status($id_agent=false, $width=300, $height=200, $return=false, $show_not_init=false, $data_agents=false, $donut_narrow_graph=false) { global $config; @@ -2545,25 +2545,37 @@ function graph_agent_status($id_agent=false, $width=300, $height=200, $return=fa $data = []; } - $out = pie_graph( - $data, - $width, - $height, - __('other'), - ui_get_full_url(false, false, false, false), - '', - $config['fontpath'], - $config['font_size'], - 1, - 'hidden', - $colors, - 0 - ); - - if ($return) { + if ($donut_narrow_graph == true) { + $data_total = array_sum($data); + $out = print_donut_narrow_graph( + $colors, + $width, + $height, + $data, + $data_total + ); return $out; } else { - echo $out; + $out = pie_graph( + $data, + $width, + $height, + __('other'), + ui_get_full_url(false, false, false, false), + '', + $config['fontpath'], + $config['font_size'], + 1, + 'hidden', + $colors, + 0 + ); + + if ($return) { + return $out; + } else { + echo $out; + } } } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 6ce6a5d57c..010845caf6 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -660,7 +660,7 @@ function html_print_select( } if ($optlabel === '') { - $output .= '>'.$value.''; + $output .= '>None'; } else { $output .= '>'.$optlabel.''; } @@ -1079,7 +1079,7 @@ function html_print_extended_select_for_time( 'class' => $uniq_name.'_toggler '.$class, 'alt' => __('Custom'), 'title' => __('Custom'), - 'style' => 'width: 18px;'.$style_icon, + 'style' => 'width: 18px; margin-bottom: -5px;'.$style_icon, ], false, false, @@ -1114,7 +1114,7 @@ function html_print_extended_select_for_time( 'class' => $uniq_name.'_toggler', 'alt' => __('List'), 'title' => __('List'), - 'style' => 'width: 18px;'.$style_icon, + 'style' => 'width: 18px;margin-bottom: -5px;'.$style_icon, ] ).''; echo '
'; @@ -2989,6 +2989,7 @@ function html_print_switch($attributes=[]) 'class', 'name', 'onclick', + 'onchange', ]; foreach ($valid_attrs as $va) { if (!isset($attributes[$va])) { @@ -2998,7 +2999,11 @@ function html_print_switch($attributes=[]) $html_expand .= ' '.$va.'="'.$attributes[$va].'"'; } - return "