diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 271486bbcb..a9a94df621 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.742-200110 +Version: 7.0NG.742-200127 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 03e9c40c3b..88f38e9f91 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.742-200110" +pandora_version="7.0NG.742-200127" 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 d586df1175..0ab1a0ceb9 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.742'; -use constant AGENT_BUILD => '200110'; +use constant AGENT_BUILD => '200127'; # 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 a4348b972d..1ac19db027 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.742 -%define release 200110 +%define release 200127 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 ecb260d1bd..85558eabca 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.742 -%define release 200110 +%define release 200127 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 6367b03824..e63aeaad06 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="200110" +PI_BUILD="200127" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 4f959dbb5e..28bf962de1 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{200110} +{200127} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index fe1e45b5cc..9edd1881d0 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.742(Build 200110)") +#define PANDORA_VERSION ("7.0NG.742(Build 200127)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 4bda8a6719..a93618b724 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.742(Build 200110))" + VALUE "ProductVersion", "(7.0NG.742(Build 200127))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 71905b7ebf..235f5c5260 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.742-200110 +Version: 7.0NG.742-200127 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 f6550f8dbe..875c180529 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.742-200110" +pandora_version="7.0NG.742-200127" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 80de4563ae..e0ca07366d 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -64,9 +64,11 @@ if (!empty($files)) { $document_root = str_replace('\\', '/', io_safe_output($_SERVER['DOCUMENT_ROOT'])); $file['location'] = str_replace('\\', '/', io_safe_output($file['location'])); $relative_path = str_replace($document_root, '', $file['location']); - $file_path = base64_encode($relative_path); - $hash = md5($relative_path.$config['dbpass']); - $url = ui_get_full_url("include/get_file.php?file=$file_path&hash=$hash"); + $file_name = explode('/', $file['location']); + $file_decoded = $file_name[(count($file_name) - 1)]; + $file_path = base64_encode($file_decoded); + $hash = md5($file_path.$config['dbpass']); + $url = ui_get_full_url('include/get_file.php?file='.urlencode($file_path).'&hash='.$hash); $date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m'; $data[0] = "".$file['name'].''; diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index 73d3c20748..dea94a5753 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -109,6 +109,6 @@ if (empty($data)) { } echo '{ - "label": "'.$graph_title.'", - "data": [["'.time().'", '.$data.']] + "label": "'.htmlspecialchars($graph_title, ENT_QUOTES).'", + "data": [["'.time().'", '.htmlspecialchars($data, ENT_QUOTES).']] }'; diff --git a/pandora_console/extras/mr/35.sql b/pandora_console/extras/mr/35.sql new file mode 100644 index 0000000000..94580edb15 --- /dev/null +++ b/pandora_console/extras/mr/35.sql @@ -0,0 +1,9 @@ +START TRANSACTION; + +INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'); +ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0; +ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0; +ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL; +ALTER TABLE `treport_content_item` ADD `id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0; + +COMMIT; 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 ca415cd52a..95a0e4ba80 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 @@ -1195,6 +1195,8 @@ CREATE TABLE IF NOT EXISTS `tmap` ( `generation_method` INTEGER UNSIGNED NOT NULL default 0, `generated` INTEGER UNSIGNED NOT NULL default 0, `filter` TEXT, + `id_group_map` INT(10) UNSIGNED NOT NULL default 0, + PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -1401,6 +1403,7 @@ ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL; ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL; ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10); ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL; +ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL; -- --------------------------------------------------------------------- -- Table `tusuario` @@ -1775,6 +1778,7 @@ ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) NOT NULL defau -- Table `tserver` -- --------------------------------------------------------------------- ALTER TABLE tserver ADD COLUMN exec_proxy tinyint(1) UNSIGNED NOT NULL default 0; +ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0; -- --------------------------------------------------------------------- -- Table `tevent_response` @@ -2433,6 +2437,21 @@ CREATE TABLE `tagent_repository` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ---------------------------------------------------------------------- +-- Table `treport_content_item` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `treport_content_item` ( + `id` INTEGER UNSIGNED NOT NULL auto_increment, + `id_report_content` INTEGER UNSIGNED NOT NULL, + `id_agent_module` int(10) unsigned NOT NULL, + `id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0, + `server_name` text, + `operation` text, + PRIMARY KEY(`id`), + FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) + ON UPDATE CASCADE ON DELETE CASCADE +) ENGINE = InnoDB DEFAULT CHARSET=utf8; + -- ---------------------------------------------------------------------- -- Table `tdeployment_hosts` -- ---------------------------------------------------------------------- diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index b0bc0bf1d1..8a29ff44a3 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -703,8 +703,7 @@ if ($config['menu_type'] == 'classic') { }, success: function (data) { $('#result_order').html(data); - console.log(data); - }, + }, error: function (data) { console.error("Fatal error in AJAX call to interpreter order", data) } diff --git a/pandora_console/general/mysqlerr.php b/pandora_console/general/mysqlerr.php index 4f28f42c84..539508e7ef 100644 --- a/pandora_console/general/mysqlerr.php +++ b/pandora_console/general/mysqlerr.php @@ -95,7 +95,12 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%; /images/mysqlerr.png'>
@@ -134,4 +139,4 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
- \ No newline at end of file + diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index c86692e7c3..d4292bc465 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -208,7 +208,7 @@ 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_agent_name .= '
'; if ($id_agente) { $table_agent_name .= ''; diff --git a/pandora_console/godmode/agentes/agent_wizard.php b/pandora_console/godmode/agentes/agent_wizard.php index 949e1c3a94..c04edf4d66 100644 --- a/pandora_console/godmode/agentes/agent_wizard.php +++ b/pandora_console/godmode/agentes/agent_wizard.php @@ -45,3 +45,22 @@ switch ($wizard_section) { */ require 'agent_wizard.'.$wizard_section.'.php'; + +?> + \ No newline at end of file diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php index fbb03c6e02..21cb4eb378 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php @@ -738,11 +738,16 @@ $servers_to_exec[0] = __('Local console'); if (enterprise_installed()) { enterprise_include_once('include/functions_satellite.php'); - $rows = get_proxy_servers(true); + $rows = get_proxy_servers(); + + // Check if satellite server has remote configuration enabled. + $satellite_remote = config_agents_has_remote_configuration($id_agent); + foreach ($rows as $row) { if ($row['server_type'] != 13) { $s_type = ' (Standard)'; } else { + $id_satellite = $row['id_server']; $s_type = ' (Satellite)'; } @@ -750,8 +755,16 @@ if (enterprise_installed()) { } } -$table->data[1][2] = ''.__('Server to execute command').''; -$table->data[1][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true); +$table->data[1][2] = ''.__('Server to execute command').''.ui_print_help_icon('agent_snmp_explorer_tab', true); +$table->data[1][3] = html_print_select( + $servers_to_exec, + 'server_to_exec', + $server_to_exec, + 'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')', + '', + '', + true +); $snmp_versions['1'] = 'v. 1'; $snmp_versions['2'] = 'v. 2'; @@ -1020,6 +1033,8 @@ ui_require_javascript_file('pandora_modules'); var separator = ''; $(document).ready (function () { + $('#server_to_exec option').trigger('change'); + $("#walk_form").submit(function() { $("#oid_loading").show (); }); diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php index 3eb404340e..40c4e7fc84 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -492,7 +492,7 @@ if (enterprise_installed()) { } } -$table->data[1][2] = ''.__('Server to execute command').''; +$table->data[1][2] = ''.__('Server to execute command').''.ui_print_help_icon('agent_snmp_explorer_tab', true); $table->data[1][2] .= ''.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').''; $table->data[1][4] = html_print_select( $servers_to_exec, @@ -734,20 +734,5 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) { "json"); } - -function satellite_remote_warn(id_satellite, remote) -{ - if(!remote) - { - $('#server_to_exec option[value='+id_satellite+']').prop('disabled', true); - $('#satellite_remote_tip').removeAttr("style").show(); - } - else - { - $('#satellite_remote_tip').removeAttr("style").hide(); - } - -} - /* ]]> */ diff --git a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php index 5d889178bb..c7eb716e80 100644 --- a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php @@ -64,12 +64,22 @@ if ($wmiexplore) { $processes_name_field = 1; if (enterprise_installed() && (int) $server_to_exec != 0) { $server_data = db_get_row('tserver', 'id_server', $server_to_exec); - exec( - 'ssh pandora_exec_proxy@'.$server_data['ip_address']." - '".$wmi_processes."'", - $output, - $rc - ); + + if (empty($server_data['port'])) { + exec( + 'ssh pandora_exec_proxy@'.$server_data['ip_address']." + '".$wmi_processes."'", + $output, + $rc + ); + } else { + exec( + 'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']." + '".$wmi_processes."'", + $output, + $rc + ); + } } else { exec($wmi_processes, $output); } @@ -110,12 +120,21 @@ if ($wmiexplore) { 'id_server', $server_to_exec ); + if (empty($server_data['port'])) { exec( 'ssh pandora_exec_proxy@'.$server_data['ip_address']." - '".$wmi_services."'", + '".$wmi_services."'", $output, $rc ); + } else { + exec( + 'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']." + '".$wmi_services."'", + $output, + $rc + ); + } } else { exec($wmi_services, $output); } @@ -145,12 +164,22 @@ if ($wmiexplore) { if (enterprise_installed() && (int) $server_to_exec != 0) { $server_data = db_get_row('tserver', 'id_server', $server_to_exec); - exec( - 'ssh pandora_exec_proxy@'.$server_data['ip_address']." - '".$wmi_disks."'", - $output, - $rc - ); + + if (empty($server_data['port'])) { + exec( + 'ssh pandora_exec_proxy@'.$server_data['ip_address']." + '".$wmi_disks."'", + $output, + $rc + ); + } else { + exec( + 'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']." + '".$wmi_disks."'", + $output, + $rc + ); + } } else { exec($wmi_disks, $output); } @@ -469,7 +498,7 @@ if (enterprise_installed()) { } } -$table->data[2][0] = ''.__('Server to execute command').''; +$table->data[2][0] = ''.__('Server to execute command').''.ui_print_help_icon('agent_snmp_explorer_tab', true); $table->data[2][1] = html_print_select( $servers_to_exec, 'server_to_exec', diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 545ceefa35..4e9772b6d6 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -163,8 +163,23 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { } $table->data[3][0] = __('Threshold'); - $table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true); - $table->data[3][1] .= ''.__('seconds').''; + $table->data[3][1] = html_print_extended_select_for_time( + 'module_action_threshold', + 0, + '', + '', + '', + false, + true, + false, + true, + '', + false, + false, + '', + false, + true + ); if (!isset($step)) { echo '
'; diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index f830f47dbd..59b78c9e02 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -412,65 +412,56 @@ $url_up_template = $url.'&sort_field=template&sort=up&pure='.$pure; $url_down_template = $url.'&sort_field=template&sort=down&pure='.$pure; -$table = new stdClass(); +$table_alert_list = new stdClass(); if (is_metaconsole()) { - $table->class = 'alert_list databox'; + $table_alert_list->class = 'alert_list databox'; } else { - $table->class = 'info_table'; + $table_alert_list->class = 'info_table'; } -$table->width = '100%'; -$table->cellpadding = 0; -$table->cellspacing = 0; -$table->size = []; +$table_alert_list->width = '100%'; +$table_alert_list->cellpadding = 0; +$table_alert_list->cellspacing = 0; +$table_alert_list->size = []; -$table->align = []; -$table->align[0] = 'left'; -$table->align[1] = 'left'; -$table->align[2] = 'left'; -$table->align[3] = 'left'; -$table->align[4] = 'left'; +$table_alert_list->align = []; +$table_alert_list->align[0] = 'left'; +$table_alert_list->align[1] = 'left'; +$table_alert_list->align[2] = 'left'; +$table_alert_list->align[3] = 'left'; +$table_alert_list->align[4] = 'left'; -$table->head = []; +$table_alert_list->head = []; if (! $id_agente) { - $table->style = []; - $table->style[0] = 'font-weight: bold;'; - $table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown); - $table->headstyle[0] = 'width: 100%; min-width: 12em;'; - $table->headstyle[1] = 'min-width: 15em;'; - $table->headstyle[2] = 'min-width: 20em;'; - $table->headstyle[3] = 'min-width: 1em;'; - $table->headstyle[4] = 'min-width: 15em;'; - - /* - if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { - $table->size[4] = '8%'; - }*/ + $table_alert_list->style = []; + $table_alert_list->style[0] = 'font-weight: bold;'; + $table_alert_list->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown); } else { - $table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); - $table->headstyle[0] = 'width: 100%; min-width: 15em;'; - $table->headstyle[1] = 'min-width: 15em;'; - $table->headstyle[2] = 'min-width: 20em;'; - $table->headstyle[3] = 'min-width: 1em;'; - $table->headstyle[4] = 'min-width: 15em;'; + $table_alert_list->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); } -$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); -$table->head[2] = __('Actions'); -$table->head[3] = __('Status'); -$table->head[4] = "".__('Op.').''; +$table_alert_list->head[1] = __('Status'); +$table_alert_list->head[2] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); +$table_alert_list->head[3] = __('Actions'); +$table_alert_list->head[4] = "".__('Op.').''; -$table->valign[0] = 'middle'; -$table->valign[1] = 'middle'; -$table->valign[2] = 'middle'; -$table->valign[3] = 'middle'; -$table->valign[4] = 'middle'; +$table_alert_list->headstyle[0] = 'min-width: 200px; width:30%;'; +$table_alert_list->headstyle[1] = 'min-width: 50px; width:8%'; +$table_alert_list->headstyle[2] = 'min-width: 150px; width:22%;'; +$table_alert_list->headstyle[3] = 'min-width: 200px; width:30%;'; +$table_alert_list->headstyle[4] = 'min-width: 150px; width:10%;'; -$table->style[4] = 'min-width:80px'; +$table_alert_list->valign[0] = 'middle'; +$table_alert_list->valign[1] = 'middle'; +$table_alert_list->valign[2] = 'middle'; +$table_alert_list->valign[3] = 'middle'; +$table_alert_list->valign[4] = 'middle'; -$table->data = []; +$table_alert_list->cellstyle = []; + +$table_alert_list->data = []; $url .= $sort_params; @@ -479,14 +470,14 @@ $iterator = 0; foreach ($simple_alerts as $alert) { if ($alert['disabled']) { - $table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;'; - $table->style[$iterator][1] = 'font-style: italic; color: #aaaaaa;'; + $table_alert_list->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;'; + $table_alert_list->style[$iterator][2] = 'font-style: italic; color: #aaaaaa;'; } if ($rowPair) { - $table->rowclass[$iterator] = 'rowPair'; + $table_alert_list->rowclass[$iterator] = 'rowPair'; } else { - $table->rowclass[$iterator] = 'rowOdd'; + $table_alert_list->rowclass[$iterator] = 'rowOdd'; } $rowPair = !$rowPair; @@ -523,38 +514,53 @@ foreach ($simple_alerts as $alert) { $all_groups = agents_get_all_groups_agent($id_agente); } - $module_name = modules_get_agentmodule_name($alert['id_agent_module']); - $data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[…]', 'display:block;font-size: 7.2pt').'
'; + $status = STATUS_ALERT_NOT_FIRED; + $title = ''; + if ($alert['times_fired'] > 0) { + $status = STATUS_ALERT_FIRED; + $title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)'); + } else if ($alert['disabled'] > 0) { + $status = STATUS_ALERT_DISABLED; + $title = __('Alert disabled'); + } else { + $status = STATUS_ALERT_NOT_FIRED; + $title = __('Alert not fired'); + } + + $module_name = modules_get_agentmodule_name($alert['id_agent_module']); + $data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[…]', 'display:block;font-weight:normal;').'
'; + + $data[1] = ui_print_status_image($status, $title, true); $template_group = db_get_value('id_group', 'talert_templates', 'id', $alert['id_alert_template']); // The access to the template manage page is necessary have LW permissions on template group if (check_acl($config['id_user'], $template_group, 'LW')) { - $data[1] .= ""; + $data[2] .= ""; } - $data[1] .= ui_print_truncate_text( + $data[2] .= ui_print_truncate_text( alerts_get_alert_template_name($alert['id_alert_template']), 'module_medium', false, true, true, '[…]', - 'font-size: 7.1pt' + '' ); - $data[1] .= ' '; - $data[1] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help']); - $data[1] .= ' '; + $data[2] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help action_button_img']); + $data[2] .= ' '; if (check_acl($config['id_user'], $template_group, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) { - $data[1] .= ''; + $data[2] .= ''; } $actions = alerts_get_alert_agent_module_actions($alert['id']); - $data[2] = ""; + $data[3] = "
"; // Get and show default actions for this alert $default_action = db_get_sql( 'SELECT id_alert_action @@ -562,69 +568,74 @@ foreach ($simple_alerts as $alert) { WHERE id = '.$alert['id_alert_template'] ); if ($default_action != '') { - $data[2] .= "'; - $data[2] .= ''; - $data[2] .= ''; + $data[3] .= "'; + $data[3] .= ''; } foreach ($actions as $action_id => $action) { - $data[2] .= ''; - $data[2] .= ''; + $data[3] .= ''; + + $data[3] .= ''; - $data[2] .= ''; + $data[3] .= ''; + $data[3] .= ''; } - $data[2] .= ''; - $data[2] .= '
  • "; - $data[2] .= db_get_sql("SELECT name FROM talert_actions WHERE id = $default_action").' ('.__('Default').')'; - $data[2] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true); - $data[2] .= '
  • "; + $data[3] .= db_get_sql("SELECT name FROM talert_actions WHERE id = $default_action").' ('.__('Default').')'; + $data[3] .= '
'; - $data[2] .= '
    '; - $data[2] .= '
  • '; + $data[3] .= '
'; + $data[3] .= '
    '; + $data[3] .= '
  • '; if ($alert['disabled']) { - $data[2] .= ''; + $data[3] .= ''; } else { - $data[2] .= ''; + $data[3] .= ''; } - $data[2] .= ui_print_truncate_text($action['name'], (GENERIC_SIZE_TEXT + 20), false); - $data[2] .= ' ('; + $data[3] .= ui_print_truncate_text($action['name'], (GENERIC_SIZE_TEXT + 20), false); + $data[3] .= ' ('; if ($action['fires_min'] == $action['fires_max']) { if ($action['fires_min'] == 0) { - $data[2] .= __('Always'); + $data[3] .= __('Always'); } else { - $data[2] .= __('On').' '.$action['fires_min']; + $data[3] .= __('On').' '.$action['fires_min']; } } else if ($action['fires_min'] < $action['fires_max']) { if ($action['fires_min'] == 0) { - $data[2] .= __('Until').' '.$action['fires_max']; + $data[3] .= __('Until').' '.$action['fires_max']; } else { - $data[2] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max']; + $data[3] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max']; } } else { - $data[2] .= __('From').' '.$action['fires_min']; + $data[3] .= __('From').' '.$action['fires_min']; } if ($action['module_action_threshold'] != 0) { - $data[2] .= ' '.__('Threshold').' '.human_time_description_alerts($action['module_action_threshold'], true, 'tiny'); + $data[3] .= ' '.__('Threshold').' '.human_time_description_alerts($action['module_action_threshold'], true, 'tiny'); } - $data[2] .= ')'; - $data[2] .= ''; - $data[2] .= '
  • '; - $data[2] .= '
'; + $data[3] .= ')'; + $data[3] .= ''; + $data[3] .= ''; + $data[3] .= ''; - // Is possible manage actions if have LW permissions in the agent group of the alert module + $data[3] .= '
'; + $data[3] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true); + // Is possible manage actions if have LW permissions in the agent group of the alert module if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { // ~ $data[2] .= ''; - $data[2] .= ''; - $data[2] .= html_print_input_image( + $data[3] .= ''; + $data[3] .= html_print_input_image( 'delete', 'images/cross.png', 1, - 'padding:0px;', + 'padding:0px; margin-left:5px; margin-right:5px;', true, - ['title' => __('Delete action')] + [ + 'title' => __('Delete action'), + 'class' => 'action_button_img', + ] ); - $data[2] .= html_print_input_hidden('delete_action', 1, true); - $data[2] .= html_print_input_hidden('id_alert', $alert['id'], true); - $data[2] .= html_print_input_hidden('id_action', $action_id, true); - $data[2] .= ''; - $data[2] .= html_print_input_image( + $data[3] .= html_print_input_hidden('delete_action', 1, true); + $data[3] .= html_print_input_hidden('id_alert', $alert['id'], true); + $data[3] .= html_print_input_hidden('id_action', $action_id, true); + $data[3] .= ''; + $data[3] .= html_print_input_image( 'update_action', 'images/config.png', 1, @@ -632,19 +643,20 @@ foreach ($simple_alerts as $alert) { true, [ 'title' => __('Update action'), + 'class' => 'action_button_img', 'onclick' => 'show_display_update_action(\''.$action['id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action_id.'\',\''.$alert['id_agent_module'].'\')', ] ); - $data[2] .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true); + $data[3] .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true); } - $data[2] .= '
'; + $data[3] .= ''; + $data[3] .= ''; // Is possible manage actions if have LW permissions in the agent group of the alert module if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) { $own_info = get_user_info($config['id_user']); @@ -660,45 +672,45 @@ foreach ($simple_alerts as $alert) { $actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')'); } - $data[2] .= ''; + $data[3] .= ''; + $data[3] .= ''; + $data[3] .= ''; + $data[3] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true); + $data[3] .= ''; + $data[3] .= '
'; } - $status = STATUS_ALERT_NOT_FIRED; - $title = ''; - - if ($alert['times_fired'] > 0) { - $status = STATUS_ALERT_FIRED; - $title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)'); - } else if ($alert['disabled'] > 0) { - $status = STATUS_ALERT_DISABLED; - $title = __('Alert disabled'); - } else { - $status = STATUS_ALERT_NOT_FIRED; - $title = __('Alert not fired'); - } - - $data[3] = ui_print_status_image($status, $title, true); - - $table->cellclass[] = [ - 3 => 'action_buttons', + $table_alert_list->cellclass[] = [ + 1 => 'action_buttons', 4 => 'action_buttons', ]; $data[4] = '
'; @@ -790,11 +795,11 @@ foreach ($simple_alerts as $alert) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { $policyInfo = policies_is_alert_in_policy2($alert['id'], false); if ($policyInfo === false) { - $data[3] .= ''; + $data[1] .= ''; } else { $img = 'images/policies.png'; - $data[3] .= '  '.html_print_image($img, true, ['title' => $policyInfo['name']]).''; + $data[1] .= '  '.html_print_image($img, true, ['title' => $policyInfo['name']]).''; } } } @@ -840,11 +845,11 @@ foreach ($simple_alerts as $alert) { $data[4] .= '
'; } - array_push($table->data, $data); + array_push($table_alert_list->data, $data); } if (isset($data)) { - html_print_table($table); + html_print_table($table_alert_list); if ($id_agente) { ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom'); } else { @@ -864,7 +869,7 @@ if (isset($dont_display_alert_create_bttn)) { } if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) { - echo '
'; + echo '
'; echo '
'; html_print_submit_button(__('Create'), 'crtbtn', false, 'class="sub next"'); echo '
'; diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 870a6fafc8..60052e9645 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -177,7 +177,23 @@ $table->data[2][1] .= '
'; $table->colspan[2][1] = 2; $table->data[3][0] = __('Threshold'); -$table->data[3][1] = html_print_input_text('action_threshold', $action_threshold, '', 5, 7, true); +$table->data[3][1] = html_print_extended_select_for_time( + 'action_threshold', + $action_threshold, + '', + '', + '', + false, + true, + false, + true, + '', + false, + false, + '', + false, + true +); $table->colspan[3][1] = 2; $table->data[4][0] = ''; diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 41068372d4..a677c6f801 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -55,7 +55,7 @@ if ($id) { $id_group = $filter['id_group']; $id_name = $filter['id_name']; $event_type = $filter['event_type']; - $severity = $filter['severity']; + $severity = explode(',', $filter['severity']); $status = $filter['status']; $search = $filter['search']; $text_agent = $filter['text_agent']; @@ -123,7 +123,7 @@ if ($update || $create) { $id_group_filter = get_parameter('id_group_filter'); $id_name = (string) get_parameter('id_name'); $event_type = get_parameter('event_type', ''); - $severity = get_parameter('severity', ''); + $severity = implode(',', get_parameter('severity', -1)); $status = get_parameter('status', ''); $search = get_parameter('search', ''); $text_agent = get_parameter('text_agent', ''); @@ -172,6 +172,8 @@ if ($update || $create) { 'user_comment' => $user_comment, 'filter_only_alert' => $filter_only_alert, ]; + + $severity = explode(',', $severity); } if ($update) { @@ -289,15 +291,24 @@ $table->data[3][1] = html_print_select( true ); +if (empty($severity) && $severity !== '0') { + $severity = -1; +} + $table->data[4][0] = ''.__('Severity').''; $table->data[4][1] = html_print_select( get_priorities(), - 'severity', + 'severity[]', $severity, '', __('All'), - '-1', - true + -1, + true, + true, + true, + '', + false, + 'width: 175px' ); $fields = events_get_all_status(); diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index 155eb560db..958819a95b 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -290,7 +290,7 @@ $table_aux = new stdClass(); foreach ($result_graphs as $graph) { $data = []; - $data[0] = ''.ui_print_truncate_text(io_safe_output($graph['name']), 70).''; + $data[0] = ''.ui_print_truncate_text($graph['name'], 70).''; $data[1] = ui_print_truncate_text($graph['description'], 70); diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 98ee756b7b..daf5a39ca8 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -628,6 +628,8 @@ switch ($action) { $unknown_checks = $item['unknown_checks']; $agent_max_value = $item['agent_max_value']; $agent_min_value = $item['agent_min_value']; + $failover_mode = $item['failover_mode']; + $failover_type = $item['failover_type']; break; case 'group_report': @@ -3263,6 +3265,13 @@ function print_General_list($width, $action, $idItem=null, $type='general') $meta = false; } + $failover_mode = db_get_value( + 'failover_mode', + 'treport_content', + 'id_rc', + $idItem + ); + $operation = [ 'avg' => __('rate'), 'max' => __('max'), @@ -3284,6 +3293,18 @@ function print_General_list($width, $action, $idItem=null, $type='general') + + + + + + + + @@ -3318,7 +3339,7 @@ function print_General_list($width, $action, $idItem=null, $type='general') case 'new': ?> - + @@ -3365,19 +3386,50 @@ function print_General_list($width, $action, $idItem=null, $type='general') ['id_agente_modulo' => $item['id_agent_module']] ); + if (isset($item['id_agent_module_failover']) === true + && $item['id_agent_module_failover'] !== 0 + ) { + $idAgentFailover = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $item['id_agent_module_failover']] + ); + $nameAgentFailover = agents_get_alias( + $idAgentFailover + ); + + $nameModuleFailover = db_get_value_filter( + 'nombre', + 'tagente_modulo', + ['id_agente_modulo' => $item['id_agent_module_failover']] + ); + } + $server_name_element = ''; if ($meta && $server_name != '') { $server_name_element .= ' ('.$server_name.')'; } if ($type == 'availability') { - echo ' - '.printSmallFont($nameAgent).$server_name_element.' - '.printSmallFont($nameModule).' - - '.html_print_image('images/cross.png', true).' - - '; + if ($failover_mode) { + echo ' + '.printSmallFont($nameAgent).$server_name_element.' + '.printSmallFont($nameModule).' + '.printSmallFont($nameAgentFailover).$server_name_element.' + '.printSmallFont($nameModuleFailover).' + + '.html_print_image('images/cross.png', true).' + + '; + } else { + echo ' + '.printSmallFont($nameAgent).$server_name_element.' + '.printSmallFont($nameModule).' + + '.html_print_image('images/cross.png', true).' + + '; + } } else { echo ' '.printSmallFont($nameAgent).$server_name_element.' @@ -3403,6 +3455,15 @@ function print_General_list($width, $action, $idItem=null, $type='general') + + + @@ -3456,6 +3517,43 @@ function print_General_list($width, $action, $idItem=null, $type='general') + + + + + + + + + + @@ -4495,6 +4593,10 @@ function addGeneralRow() { var idAgent = $("input[name=id_agent_general]").val(); var serverId = $("input[name=id_server]").val(); var idModule = $("#id_agent_module_general").val(); + var nameAgentFailover = $("input[name=agent_failover]").val(); + var idModuleFailover = $("#id_agent_module_failover").val(); + var nameModuleFailover = $("#id_agent_module_failover :selected").text(); + var operation; if ($("#id_operation_module_general").length) { operation = $("#id_operation_module_general").val(); @@ -4580,10 +4682,63 @@ function addGeneralRow() { } }); + if (nameAgentFailover != '') { + //Truncate nameAgentFailover + var params = []; + params.push("truncate_text=1"); + params.push("text=" + nameAgentFailover); + params.push("page=include/ajax/reporting.ajax"); + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action= + + + "/ajax.php", + async: false, + timeout: 10000, + success: function (data) { + nameAgentFailover = data; + } + }); + + //Truncate nameModuleFailover + var params = []; + params.push("truncate_text=1"); + params.push("text=" + nameModuleFailover); + params.push("page=include/ajax/reporting.ajax"); + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action= + + + "/ajax.php", + async: false, + timeout: 10000, + success: function (data) { + nameModuleFailover = data; + } + }); + } + var params = []; params.push("add_general=1"); params.push("id=" + $("input[name=id_item]").val()); params.push("id_module=" + idModule); + params.push("id_module_failover=" + idModuleFailover); params.push("id_server=" + serverId); params.push("operation=" + operation); params.push("id_agent=" + idAgent); @@ -4610,6 +4765,8 @@ function addGeneralRow() { $("#row", row).attr('id', 'general_' + data['id']); $(".agent_name", row).html(nameAgent); $(".module_name", row).html(nameModule); + $(".agent_name_failover", row).html(nameAgentFailover); + $(".module_name_failover", row).html(nameModuleFailover); $(".operation_name", row).html(nameOperation); $(".delete_button", row).attr( 'href', @@ -4624,6 +4781,15 @@ function addGeneralRow() { $("#id_operation_module_general").val('avg'); $("#id_agent_module_general").empty(); $("#id_agent_module_general").attr('disabled', 'true'); + + $("input[name=id_agent_failover]").val(''); + $("input[name=agent_failover]").val(''); + $("#id_agent_module_failover").empty(); + $("#id_agent_module_failover").attr('disabled', 'true'); + $("#id_agent_module_failover").append( + $("") + .attr ("value", 0) + .html ($("#module_sla_text").html())); } } }); @@ -5111,6 +5277,12 @@ function chooseType() { $("#row_select_fields3").hide(); } $("#row_historical_db_check").hide(); + + $("#row_failover_mode").show(); + var failover_checked = $("input[name='failover_mode']").prop("checked"); + if(failover_checked){ + $("#row_failover_type").show(); + } break; case 'group_report': diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index e5e7121b10..60464ee953 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1207,8 +1207,7 @@ switch ($action) { $report_id_user = get_parameter('report_id_user'); $non_interactive = get_parameter('non_interactive', 0); - // Pretty font by default for pdf. - $custom_font = 'FreeSans.ttf'; + $custom_font = $config['custom_report_front_font']; switch ($type_access_selected) { case 'group_view': @@ -1284,7 +1283,6 @@ switch ($action) { $metaconsole_report = (int) is_metaconsole(); if ($config['custom_report_front']) { - $custom_font = $config['custom_report_front_font']; $logo = $config['custom_report_front_logo']; $header = $config['custom_report_front_header']; $first_page = $config['custom_report_front_firstpage']; @@ -1611,6 +1609,14 @@ switch ($action) { $values['agent_min_value'] = get_parameter( 'agent_min_value' ); + $values['failover_mode'] = get_parameter( + 'failover_mode', + 0 + ); + $values['failover_type'] = get_parameter( + 'failover_type', + REPORT_FAILOVER_TYPE_NORMAL + ); $good_format = true; break; diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 66c14ee89f..37c8aac797 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -32,7 +32,7 @@ if (isset($_GET['server'])) { $id_server = get_parameter_get('server'); // Headers ui_print_page_header(__('Update Server'), 'images/gm_servers.png', false, 'servers', true); - $sql = sprintf('SELECT name, ip_address, description, server_type, exec_proxy FROM tserver WHERE id_server = %d', $id_server); + $sql = sprintf('SELECT name, ip_address, description, server_type, exec_proxy, port FROM tserver WHERE id_server = %d', $id_server); $row = db_get_row_sql($sql); echo '
'; html_print_input_hidden('server', $id_server); @@ -75,6 +75,14 @@ if (isset($_GET['server'])) { __('Exec Server'), html_print_checkbox('exec_proxy', 1, $row['exec_proxy'], true), ]; + + $port_number = empty($row['port']) ? '' : $row['port']; + + $table->data[] = [ + __('Port'), + html_print_input_text('port', $port_number, '', 10, 0, true).ui_print_help_tip(__('Leave blank to use SSH default port (22)'), true), + ]; + if ($row['exec_proxy']) { $table->data[] = [ __('Check Exec Server'), @@ -136,11 +144,15 @@ if (isset($_GET['server'])) { $description = get_parameter_post('description'); $id_server = get_parameter_post('server'); $exec_proxy = get_parameter_post('exec_proxy'); + $port = get_parameter_post('port'); + + $port_number = empty($port) ? 0 : $port; $values = [ 'ip_address' => $address, 'description' => $description, 'exec_proxy' => $exec_proxy, + 'port' => $port_number, ]; $result = db_process_sql_update('tserver', $values, ['id_server' => $id_server]); if ($result !== false) { diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 0006fc3e9b..668ef26f0c 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -101,6 +101,10 @@ foreach ($servers as $server) { $data[2] .= ui_print_help_tip(__('This is a master server'), true); } + if ($server['exec_proxy'] == 1) { + $data[2] .= html_print_image('images/star.png', true, ['title' => __('Exec server enabled')]); + } + // $data[2] .= ' v' .. ''; switch ($server['type']) { case 'snmp': diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 60da29ea46..58e31d7edd 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1011,6 +1011,7 @@ $row++; $table_report->class = 'databox filters'; $table_report->style[0] = 'font-weight: bold;'; $table_report->size[0] = '50%'; + $table_report->data = []; $table_report->data[$row][0] = __('Show report info with description').ui_print_help_tip( @@ -1048,6 +1049,20 @@ $row++; $row++; + $table_report->data[$row][0] = __('PDF font family'); + $table_report->data[$row][1] = html_print_select( + $fonts, + 'custom_report_front_font', + $config['custom_report_front_font'], + false, + __('Default'), + '', + true + ); + + $row++; + + $table_report->data[$row][0] = __('Graph image height for HTML reports'); $table_report->data[$row][0] .= ui_print_help_tip( __('This is the height in pixels of the module graph or custom graph in the reports (only: HTML)'), @@ -1078,18 +1093,6 @@ $row++; } } - // Font - $table_report->data['custom_report_front-font'][0] = __('Custom report front').' - '.__('Font family'); - $table_report->data['custom_report_front-font'][1] = html_print_select( - $fonts, - 'custom_report_front_font', - $config['custom_report_front_font'], - false, - __('Default'), - '', - true - ); - // Logo $table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), @@ -1155,7 +1158,6 @@ $row++; html_print_table($table_report); echo ''; - // ---------------------------------------------------------------------- // OTHER CONFIGURATION // ---------------------------------------------------------------------- @@ -1164,17 +1166,17 @@ $row++; $table_other->class = 'databox filters'; $table_other->style[0] = 'font-weight: bold;'; $table_other->size[0] = '50%'; + $table_other->size[1] = '26%'; + $table_other->size[2] = '12%'; + $table_other->size[3] = '12%'; $table_other->data = []; - - - $table_other->data[$row][0] = __('Custom graphviz directory').ui_print_help_tip(__('Custom directory where the graphviz binaries are stored.'), true); $table_other->data[$row][1] = html_print_input_text( 'graphviz_bin_dir', $config['graphviz_bin_dir'], '', - 50, + 25, 255, true ); @@ -1192,8 +1194,6 @@ $row++; ); $row++; - - $table_other->data[$row][0] = __('Show only the group name'); $table_other->data[$row][0] .= ui_print_help_tip( __('Show the group name instead the group icon.'), @@ -1239,16 +1239,15 @@ $row++; // CUSTOM VALUES POST PROCESS // ---------------------------------------------------------------------- $table_other->data[$row][0] = __('Custom values post process'); - $table_other->data[$row][1] = ''; - $table_other->data[$row][1] .= __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true); - $table_other->data[$row][1] .= ' '.__('Text').': '.html_print_input_text('custom_text', '', '', 25, 50, true); - $table_other->data[$row][1] .= ' '; - $table_other->data[$row][1] .= html_print_input_hidden( + $table_other->data[$row][1] = __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true); + $table_other->data[$row][2] = __('Text').': '.html_print_input_text('custom_text', '', '', 15, 50, true); + $table_other->data[$row][2] .= ' '; + $table_other->data[$row][2] .= html_print_input_hidden( 'custom_value_add', '', true ); - $table_other->data[$row][1] .= html_print_button( + $table_other->data[$row][3] = html_print_button( __('Add'), 'custom_value_add_btn', false, @@ -1257,10 +1256,11 @@ $row++; true ); - $table_other->data[$row][1] .= '

'; + $row++; - $table_other->data[$row][1] .= __('Delete custom values').': '; - $table_other->data[$row][1] .= html_print_select( + $table_other->data[$row][0] = ''; + $table_other->data[$row][1] = __('Delete custom values').': '; + $table_other->data[$row][2] = html_print_select( post_process_get_custom_values(), 'custom_values', '', @@ -1270,7 +1270,7 @@ $row++; true ); $count_custom_postprocess = post_process_get_custom_values(); - $table_other->data[$row][1] .= html_print_button( + $table_other->data[$row][3] = html_print_button( __('Delete'), 'custom_values_del_btn', empty($count_custom_postprocess), @@ -1284,7 +1284,8 @@ $row++; '', true ); - $table_other->data[$row][1] .= '
'; + $table_other->data[$row][3] .= '

'; + // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // CUSTOM INTERVAL VALUES @@ -1299,22 +1300,52 @@ $row++; SECONDS_1MONTH => __('months'), SECONDS_1YEAR => __('years'), ]; - $table_other->data[$row][1] = __('Add new custom value to intervals').': '; + $table_other->data[$row][1] = __('Value').': '; $table_other->data[$row][1] .= html_print_input_text('interval_value', '', '', 5, 5, true); - $table_other->data[$row][1] .= html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false); - $table_other->data[$row][1] .= html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true); - $table_other->data[$row][1] .= '

'; + $table_other->data[$row][2] = html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false); + $table_other->data[$row][3] = html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true); - $table_other->data[$row][1] .= __('Delete interval').': '; - $table_other->data[$row][1] .= html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true); - $table_other->data[$row][1] .= html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true); + $row++; + + $table_other->data[$row][0] = ''; + $table_other->data[$row][1] = __('Delete interval').': '; + $table_other->data[$row][2] = html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true); + $table_other->data[$row][3] = html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true); $table_other->data[$row][1] .= html_print_input_hidden('interval_values', $config['interval_values'], true); // This hidden field will be filled from jQuery before submit $table_other->data[$row][1] .= html_print_input_hidden('interval_to_delete', '', true); + $table_other->data[$row][3] .= '

'; // ---------------------------------------------------------------------- $row++; + $table_other->data[$row][0] = __('Module units'); + $table_other->data[$row][1] = __('Value').': '; + $table_other->data[$row][1] .= html_print_input_text('custom_module_unit', '', '', 15, 50, true); + $table_other->data[$row][2] = ''; + $table_other->data[$row][3] = html_print_button(__('Add'), 'module_unit_add_btn', false, '', 'class="sub next"', true); + + $row++; + $table_other->data[$row][0] = ''; + $table_other->data[$row][1] = __('Delete custom values').': '; + $table_other->data[$row][2] = html_print_select(get_custom_module_units(), 'module_units', '', '', '', '', true, false, true, 'w100p'); + $table_other->data[$row][3] = html_print_button( + __('Delete'), + 'custom_module_unit_del_btn', + empty($count_custom_postprocess), + '', + 'class="sub cancel"', + true + ); + + $table_other->data[$row][3] .= html_print_input_hidden( + 'custom_module_unit_to_delete', + '', + true + ); + + $row++; + $common_dividers = [ ';' => ';', ',' => ',', @@ -1331,6 +1362,14 @@ $row++; $row++; + $table_other->data[$row][0] = __('Data multiplier to use in graphs/data'); + $options_data_multiplier = []; + $options_data_multiplier[0] = __('Use 1024 when module unit are bytes'); + $options_data_multiplier[1] = __('Use always 1000'); + $options_data_multiplier[2] = __('Use always 1024'); + + $table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false); + echo '
'; echo ''.__('Other configuration').' '.ui_print_help_icon('other_conf_tab', true).''; @@ -1397,7 +1436,6 @@ function edit_csv_divider () { function display_custom_report_front (show,table) { if (show == true) { - $('tr#'+table+'-custom_report_front-font').show(); $('tr#'+table+'-custom_report_front-logo').show(); $('tr#'+table+'-custom_report_front-preview').show(); $('tr#'+table+'-custom_report_front-header').show(); @@ -1405,7 +1443,6 @@ function display_custom_report_front (show,table) { $('tr#'+table+'-custom_report_front-footer').show(); } else { - $('tr#'+table+'-custom_report_front-font').hide(); $('tr#'+table+'-custom_report_front-logo').hide(); $('tr#'+table+'-custom_report_front-preview').hide(); $('tr#'+table+'-custom_report_front-header').hide(); @@ -1547,7 +1584,20 @@ $(document).ready (function () { }); //------------------------------------------------------------------ - + //------------------------------------------------------------------ + // CUSTOM MODULE UNITS + //------------------------------------------------------------------ + $("#button-custom_module_unit_del_btn").click( function() { + var unit_selected = $('#module_units option:selected').val(); + $('#hidden-custom_module_unit_to_delete').val(unit_selected); + $('#submit-update_button').trigger('click'); + }); + + $("#button-module_unit_add_btn").click( function() { + $('#submit-update_button').trigger('click'); + }); + //------------------------------------------------------------------ + // Juanma (06/05/2014) New feature: Custom front page for reports var custom_report = $('#checkbox-custom_report_front') .prop('checked'); diff --git a/pandora_console/godmode/update_manager/update_manager.offline.php b/pandora_console/godmode/update_manager/update_manager.offline.php index 8eff08d996..8fb4447772 100644 --- a/pandora_console/godmode/update_manager/update_manager.offline.php +++ b/pandora_console/godmode/update_manager/update_manager.offline.php @@ -46,6 +46,13 @@ if (! check_acl($config['id_user'], 0, 'PM') $baseurl = ui_get_full_url(false, false, false, false); +$current_package = db_get_value( + 'value', + 'tconfig', + 'token', + 'current_package_enterprise' +); + ?> var text1_package_file = "\n"; var text2_package_file = "\n"; + var text1_warning = "\n"; + var text2_warning = "\n"; var applying_mr = "\n"; var cancel_button = "\n"; var ok_button = "\n"; @@ -109,5 +118,5 @@ is not working on the metaconsole and there is no time to fix it --> diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index 3f724b4e58..4beb9efdfa 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -264,12 +264,21 @@ if ($show_update_action_menu) { $data .= __('Threshold'); $data .= ''; $data .= ''; - $data .= html_print_input_text( + $data .= html_print_extended_select_for_time( 'module_action_threshold_ajax', $action_option['module_action_threshold'], '', - 4, - 10, + '', + '', + false, + true, + false, + true, + '', + false, + false, + '', + false, true ); $data .= ''; diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 24fa8be341..7e11c16790 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -231,7 +231,7 @@ if ($save_event_filter) { $values['id_name'] = get_parameter('id_name'); $values['id_group'] = get_parameter('id_group'); $values['event_type'] = get_parameter('event_type'); - $values['severity'] = get_parameter('severity'); + $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); $values['text_agent'] = get_parameter('text_agent'); @@ -278,7 +278,7 @@ if ($update_event_filter) { $id = get_parameter('id'); $values['id_group'] = get_parameter('id_group'); $values['event_type'] = get_parameter('event_type'); - $values['severity'] = get_parameter('severity'); + $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); $values['text_agent'] = get_parameter('text_agent'); @@ -439,8 +439,10 @@ function load_form_filter() { $("#id_group").val(val); if (i == 'event_type') $("#event_type").val(val); - if (i == 'severity') - $("#severity").val(val); + if (i == 'severity') { + const multiple = val.split(","); + $("#severity").val(multiple); + } if (i == 'status') $("#status").val(val); if (i == 'search') @@ -954,7 +956,11 @@ if ($perform_event_response) { break; } - system('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1"', $ret_val); + if (empty($server_data['port'])) { + system('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1"', $ret_val); + } else { + system('ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address'].' "'.$timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1"', $ret_val); + } } } else { switch (PHP_OS) { @@ -1579,7 +1585,7 @@ if ($get_list_events_agents) { $id_agent = get_parameter('id_agent'); $server_id = get_parameter('server_id'); $event_type = get_parameter('event_type'); - $severity = get_parameter('severity'); + $severity = implode(',', get_parameter('severity', -1)); $status = get_parameter('status'); $search = get_parameter('search'); $id_agent_module = get_parameter('id_agent_module'); diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index dec331b6ef..a858f2083a 100755 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -111,6 +111,7 @@ if ($add_general) { $id_module = get_parameter('id_module', 0); $id_server = (int) get_parameter('id_server', 0); $operation = get_parameter('operation', ''); + $id_module_failover = (int) get_parameter('id_module_failover', 0); $include_enterprise = enterprise_include('include/functions_metaconsole.php'); @@ -126,10 +127,11 @@ if ($add_general) { $result = db_process_sql_insert( 'treport_content_item', [ - 'id_report_content' => $id, - 'id_agent_module' => $id_module, - 'server_name' => $connection['server_name'], - 'operation' => $operation, + 'id_report_content' => $id, + 'id_agent_module' => $id_module, + 'server_name' => $connection['server_name'], + 'operation' => $operation, + 'id_agent_module_failover' => $id_module_failover, ] ); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 7122e01598..27d73a8e58 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -442,20 +442,16 @@ switch ($action) { || ($layoutData['type'] == PERCENTILE_BUBBLE) ) { if ($value_show == 'value') { - $returnValue = format_for_graph($returnValue, 2); - $unit_text_db = db_get_sql( 'SELECT unit - FROM tagente_modulo - WHERE id_agente_modulo = '.$layoutData['id_agente_modulo'] + FROM tagente_modulo + WHERE id_agente_modulo = '.$layoutData['id_agente_modulo'] ); $unit_text_db = trim(io_safe_output($unit_text_db)); - if ($value_show == 'value') { - // Set empty string unit at the moment - // and change for old false value - $unit_text = ''; - } + $divisor = get_data_multiplier($unit_text_db); + + $returnValue = format_for_graph($returnValue, 2, '.', ',', $divisor); if (!empty($unit_text_db)) { $unit_text = $unit_text_db; diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php index 6ca2caa53b..fe356b737c 100644 --- a/pandora_console/include/chart_generator.php +++ b/pandora_console/include/chart_generator.php @@ -83,6 +83,7 @@ if (check_login(false) === false) { + @@ -140,6 +141,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) { + diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index b28b43f502..43fb9138c7 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -1340,6 +1340,10 @@ class NetworkMap if ($rel['parent_type'] == NODE_MODULE && $rel['child_type'] == NODE_MODULE ) { + // Keep std references. + $ref_id_parent = $id_parent; + $ref_id_child = $id_child; + // Module information available. $id_parent = $rel['id_parent_source_data']; $id_child = $rel['id_child_source_data']; @@ -1374,6 +1378,12 @@ class NetworkMap 'index' => $index, 'priority' => $priority, ]; + + // Keep node reference mapping - low precedence relationship. + $rel_map[$ref_id_parent.'_'.$ref_id_child] = [ + 'index' => $index, + 'priority' => $priority, + ]; } } else if ($rel['parent_type'] == NODE_AGENT && $rel['child_type'] == NODE_AGENT diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 784a51e66d..05b576e40f 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -616,7 +616,8 @@ class Tree && $statusType !== STATUS_MODULE_NO_DATA_BALL ) { if (is_numeric($module['value'])) { - $statusTitle .= ' : '.format_for_graph($module['value']); + $divisor = get_data_multiplier($module['unit']); + $statusTitle .= ' : '.format_for_graph($module['value'], 1, '.', ',', $divisor); } else { $statusTitle .= ' : '.substr(io_safe_output($module['value']), 0, 42); } @@ -1061,7 +1062,7 @@ class Tree $columns = 'DISTINCT(tam.id_agente_modulo) AS id, tam.nombre AS name, tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos, - tam.parent_module_id AS parent, tatm.id AS alerts'; + tam.parent_module_id AS parent, tatm.id AS alerts, tam.unit'; $sql = "SELECT $columns FROM tagente_modulo tam diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 9c424f92e2..5176bf8fde 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 = 'PC200110'; +$build_version = 'PC200127'; $pandora_version = 'v7.0NG.742'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 08a41a00f2..89c53802b4 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -262,6 +262,11 @@ function format_for_graph( $divider=1000, $sufix='' ) { + // Exception to exclude modules whose unit is already formatted as KB (satellite modules) + if (!empty($sufix) && $sufix == 'KB') { + return; + } + $shorts = [ '', 'K', @@ -1994,7 +1999,12 @@ function get_snmpwalk( if (enterprise_installed()) { if ($server_to_exec != 0) { $server_data = db_get_row('tserver', 'id_server', $server_to_exec); - exec('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_str.'"', $output, $rc); + + if (empty($server_data['port'])) { + exec('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_str.'"', $output, $rc); + } else { + exec('ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_str.'"', $output, $rc); + } } else { exec($command_str, $output, $rc); } @@ -2503,12 +2513,13 @@ function get_user_dashboards($id_user) /** * Get all the possible periods in seconds. * - * @param bool Flag to show or not custom fist option - * @param bool Show the periods by default if it is empty + * @param boolean $custom Flag to show or not custom fist option + * @param boolean $show_default Show the periods by default if it is empty + * @param boolean $allow_zero Allow the use of the value zero. * - * @return The possible periods in an associative array. + * @return array The possible periods in an associative array. */ -function get_periods($custom=true, $show_default=true) +function get_periods($custom=true, $show_default=true, $allow_zero=false) { global $config; @@ -2520,6 +2531,10 @@ function get_periods($custom=true, $show_default=true) if (empty($config['interval_values'])) { if ($show_default) { + if ($allow_zero === true) { + $periods[0] = sprintf(__('%s seconds'), '0'); + } + $periods[SECONDS_5MINUTES] = sprintf(__('%s minutes'), '5'); $periods[SECONDS_30MINUTES] = sprintf(__('%s minutes'), '30 '); $periods[SECONDS_1HOUR] = __('1 hour'); @@ -5465,6 +5480,45 @@ function get_help_info($section_name) } else { $result .= 'Discovery&printable=yes'; } + + case 'alert_configure': + if ($es) { + $result .= 'Alerts#Correlation_alert_creation'; + } else { + $result .= 'Alerts#Correlation_alert_creation'; + } + break; + + case 'alert_correlation': + if ($es) { + $result .= 'Alerts#Alert_correlation:_event_and_log_alerts'; + } else { + $result .= 'Alerts#Alert_correlation:_event_and_log_alerts'; + } + break; + + case 'alert_rules': + if ($es) { + $result .= 'Alerts#Rules_within_a_correlation_alert'; + } else { + $result .= 'Alerts#Rules_within_a_correlation_alert'; + } + break; + + case 'alert_fields': + if ($es) { + $result .= 'Alerts#Step_3:_Advanced_fields'; + } else { + $result .= 'Alerts#Step_3:_Advanced_fields'; + } + break; + + case 'alert_triggering': + if ($es) { + $result .= 'Alerts#Configuring_an_alert_template'; + } else { + $result .= 'Alerts#Configuring_an_alert_template'; + } break; } @@ -5494,3 +5548,108 @@ if (!function_exists('getallheaders')) { } + + +/** + * Update config token that contains custom module units. + * + * @param string Name of new module unit. + * @return boolean Success or failure. + */ +function add_custom_module_unit($value) +{ + global $config; + + $custom_module_units = get_custom_module_units(); + + $custom_module_units[$value] = $value; + + $new_conf = json_encode($custom_module_units); + + $return = config_update_value( + 'custom_module_units', + $new_conf + ); + + if ($return) { + $config['custom_module_units'] = $new_conf; + return true; + } else { + return false; + } +} + + +function get_custom_module_units() +{ + global $config; + + if (!isset($config['custom_module_units'])) { + $custom_module_units = []; + } else { + $custom_module_units = json_decode( + io_safe_output($config['custom_module_units']), + true + ); + } + + return $custom_module_units; +} + + +function delete_custom_module_unit($value) +{ + global $config; + + $custom_units = get_custom_module_units(); + + unset($custom_units[io_safe_output($value)]); + + $new_conf = json_encode($custom_units); + $return = config_update_value( + 'custom_module_units', + $new_conf + ); + + if ($return) { + $config['custom_module_units'] = $new_conf; + + return true; + } else { + return false; + } +} + + +/** + * Get multiplier to be applied on module data in order to represent it properly. Based on setup configuration and module's unit, either 1000 or 1024 will be returned. + * + * @param string Module's unit. + * + * @return integer Multiplier. + */ +function get_data_multiplier($unit) +{ + global $config; + + switch ($config['use_data_multiplier']) { + case 0: + if (strpos(strtolower($unit), 'yte') !== false) { + $multiplier = 1024; + } else { + $multiplier = 1000; + } + break; + + case 2: + $multiplier = 1024; + break; + + case 1: + default: + $multiplier = 1000; + break; + } + + return $multiplier; +} diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 2f7ff3433f..cff575a19b 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -3512,13 +3512,18 @@ function agents_get_status_animation($up=true) function agents_get_agent_id_by_alias_regex($alias_regex, $flag='i', $limit=0) { $agents_id = []; - $all_agents = agents_get_agents(false, ['id_agente', 'alias']); + if (is_metaconsole()) { + $all_agents = agents_meta_get_agents('AR', '|'); + } else { + $all_agents = agents_get_group_agents(0, true, 'lower', false, false, true, '|'); + } + $agent_match = '/'.$alias_regex.'/'.$flag; - foreach ($all_agents as $agent) { - $result_agent_match = preg_match($agent_match, $agent['alias']); + foreach ($all_agents as $agent_id => $agent_alias) { + $result_agent_match = preg_match($agent_match, $agent_alias); if ($result_agent_match) { - $agents_id[] = $agent['id_agente']; + $agents_id[] = $agent_id; $i++; if ($i === $limit) { break; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index b50cefe579..9100060e83 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1279,6 +1279,28 @@ function config_update_config() $error_update[] = __('Delete interval'); } + // -------------------------------------------------- + // -------------------------------------------------- + // MODULE CUSTOM UNITS + // -------------------------------------------------- + $custom_unit = get_parameter('custom_module_unit'); + $custom_unit_to_delete = get_parameter('custom_module_unit_to_delete', ''); + + if (!empty($custom_unit)) { + if (!add_custom_module_unit( + $custom_unit + ) + ) { + $error_update[] = __('Add custom module unit'); + } + } + + if (!empty($custom_unit_to_delete)) { + if (!delete_custom_module_unit($custom_unit_to_delete)) { + $error_update[] = __('Delete custom module unit'); + } + } + // -------------------------------------------------- if (!config_update_value('custom_report_info', get_parameter('custom_report_info'))) { $error_update[] = __('Custom report info'); @@ -1324,6 +1346,10 @@ function config_update_config() if (!config_update_value('csv_divider', (string) get_parameter('csv_divider', ';'))) { $error_update[] = __('CSV divider'); } + + if (!config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'))) { + $error_update[] = __('Use data multiplier'); + } break; case 'net': @@ -2820,6 +2846,10 @@ function config_process_config() config_update_value('csv_divider', ';'); } + if (!isset($config['use_data_multiplier'])) { + config_update_value('use_data_multiplier', '1'); + } + if (!isset($config['command_snapshot'])) { config_update_value('command_snapshot', 1); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 53005037df..7f989c9bb7 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -624,7 +624,37 @@ function events_update_status($id_evento, $status, $filter=null, $history=false) break; } - return db_process_sql($update_sql); + $result = db_process_sql($update_sql); + + if ($result) { + switch ($status) { + case EVENT_STATUS_NEW: + $status_string = 'New'; + break; + + case EVENT_STATUS_VALIDATED: + $status_string = 'Validated'; + break; + + case EVENT_STATUS_INPROCESS: + $status_string = 'In process'; + break; + + default: + $status_string = ''; + break; + } + + events_comment( + $id_evento, + '', + 'Change status to '.$status_string, + is_metaconsole() ? true : false, + $history + ); + } + + return $result; } @@ -751,43 +781,78 @@ function events_get_all( } if (isset($filter['severity']) && $filter['severity'] > 0) { - switch ($filter['severity']) { - case EVENT_CRIT_MAINTENANCE: - case EVENT_CRIT_INFORMATIONAL: - case EVENT_CRIT_NORMAL: - case EVENT_CRIT_MINOR: - case EVENT_CRIT_WARNING: - case EVENT_CRIT_MAJOR: - case EVENT_CRIT_CRITICAL: - default: - $sql_filters[] = sprintf( - ' AND criticity = %d ', - $filter['severity'] - ); - break; + if (is_array($filter['severity'])) { + if (!in_array(-1, $filter['severity'])) { + $not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']); + if ($not_normal !== false) { + unset($filter['severity'][$not_normal]); + $sql_filters[] = sprintf( + ' AND criticity != %d', + EVENT_CRIT_NORMAL + ); + } else { + $critical_warning = array_search(EVENT_CRIT_WARNING_OR_CRITICAL, $filter['severity']); + if ($critical_warning !== false) { + unset($filter['severity'][$critical_warning]); + $filter['severity'][] = EVENT_CRIT_WARNING; + $filter['severity'][] = EVENT_CRIT_CRITICAL; + } - case EVENT_CRIT_WARNING_OR_CRITICAL: - $sql_filters[] = sprintf( - ' AND (criticity = %d OR criticity = %d)', - EVENT_CRIT_WARNING, - EVENT_CRIT_CRITICAL - ); - break; + $critical_normal = array_search(EVENT_CRIT_OR_NORMAL, $filter['severity']); + if ($critical_normal !== false) { + unset($filter['severity'][$critical_normal]); + $filter['severity'][] = EVENT_CRIT_NORMAL; + $filter['severity'][] = EVENT_CRIT_CRITICAL; + } - case EVENT_CRIT_NOT_NORMAL: - $sql_filters[] = sprintf( - ' AND criticity != %d', - EVENT_CRIT_NORMAL - ); - break; + if (!empty($filter['severity'])) { + $filter['severity'] = implode(',', $filter['severity']); + $sql_filters[] = sprintf( + ' AND criticity IN (%s)', + $filter['severity'] + ); + } + } + } + } else { + switch ($filter['severity']) { + case EVENT_CRIT_MAINTENANCE: + case EVENT_CRIT_INFORMATIONAL: + case EVENT_CRIT_NORMAL: + case EVENT_CRIT_MINOR: + case EVENT_CRIT_WARNING: + case EVENT_CRIT_MAJOR: + case EVENT_CRIT_CRITICAL: + default: + $sql_filters[] = sprintf( + ' AND criticity = %d ', + $filter['severity'] + ); + break; - case EVENT_CRIT_OR_NORMAL: - $sql_filters[] = sprintf( - ' AND (criticity = %d OR criticity = %d)', - EVENT_CRIT_NORMAL, - EVENT_CRIT_CRITICAL - ); - break; + case EVENT_CRIT_WARNING_OR_CRITICAL: + $sql_filters[] = sprintf( + ' AND (criticity = %d OR criticity = %d)', + EVENT_CRIT_WARNING, + EVENT_CRIT_CRITICAL + ); + break; + + case EVENT_CRIT_NOT_NORMAL: + $sql_filters[] = sprintf( + ' AND criticity != %d', + EVENT_CRIT_NORMAL + ); + break; + + case EVENT_CRIT_OR_NORMAL: + $sql_filters[] = sprintf( + ' AND (criticity = %d OR criticity = %d)', + EVENT_CRIT_NORMAL, + EVENT_CRIT_CRITICAL + ); + break; + } } } diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index b3aa490edf..a3cf4ac0a5 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -106,12 +106,8 @@ if (!function_exists('mime_content_type')) { finfo_close($finfo); return $mimetype; } else { - $temp = exec('file '.$filename); - if (isset($temp) && $temp != '') { - return $temp; - } else { - return 'application/octet-stream'; - } + error_log('Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini'); + return 'unknown'; } } @@ -694,8 +690,9 @@ function filemanager_file_explorer( $data[1] = ''.$fileinfo['name'].''; } else { - $hash = md5($relative_path.$config['dbpass']); - $data[1] = ''.$fileinfo['name'].''; + $filename = base64_encode($relative_directory.'/'.$fileinfo['name']); + $hash = md5($filename.$config['dbpass']); + $data[1] = ''.$fileinfo['name'].''; } // Notice that uploaded php files could be dangerous @@ -755,8 +752,9 @@ function filemanager_file_explorer( } if ((!$fileinfo['is_dir']) && ($download_button)) { - $hash = md5($fileinfo['realpath'].$config['dbpass']); - $data[4] .= ''; + $filename = base64_encode($fileinfo['name']); + $hash = md5($filename.$config['dbpass']); + $data[4] .= ''; $data[4] .= html_print_image('images/file.png', true); $data[4] .= ''; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 42f848b649..12d9fa7c2d 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -572,7 +572,7 @@ function grafico_modulo_sparse_data( /** - * Functions tu create graphs. + * Functions to create graphs. * * @param array $params Details builds graphs. For example: * 'agent_module_id' => $agent_module_id, @@ -856,6 +856,10 @@ function grafico_modulo_sparse($params) } } + if (empty($params['divisor'])) { + $params['divisor'] = get_data_multiplier($params['unit']); + } + if (!$params['array_data_create']) { if ($params['baseline']) { $array_data = get_baseline_data( @@ -1478,6 +1482,10 @@ function graphic_combined_module( $data_module_graph['module_id'] = $agent_module_id; $data_module_graph['unit'] = $module_data['unit']; + $params['unit'] = $module_data['unit']; + + $params['divisor'] = get_data_multiplier($params['unit']); + // Stract data. $array_data_module = grafico_modulo_sparse_data( $agent_module_id, diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 9f708a7ca2..40af8f1998 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -798,6 +798,10 @@ function html_print_extended_select_for_unit( $fields['_timeticks_'] = 'Timeticks'; $fields['none'] = __('none'); + $default_module_custom_units = get_custom_module_units(); + + $fields = array_merge($fields, $default_module_custom_units); + if ($no_change != 0) { $fields[-1] = __('No change'); } @@ -988,20 +992,24 @@ function html_print_extended_select_for_post_process( /** * Render a pair of select for times and text box for set the time more fine. * - * @param string Select form name - * @param variant Current selected value. Can be a single value or an - * array of selected values (in combination with multiple) - * @param string Javascript onChange (select) code. - * @param string Label when nothing is selected. - * @param variant Value when nothing is selected - * @param integer $size Size of the input. - * @param bool Whether to return an output string or echo now (optional, echo by default). - * @param bool Wherter to assign to combo a unique name (to have more than one on same page, like dashboard) - * + * @param string $name Select form name + * @param variant $selected Current selected value. Can be a single value or an array of selected values (in combination with multiple) + * @param string $script Javascript onChange (select) code. + * @param string $nothing Label when nothing is selected. + * @param variant $nothing_value Value when nothing is selected + * @param integer $size Size of the input. + * @param boolean $return Whether to return an output string or echo now (optional, echo by default). + * @param boolean $select_style Wherter to assign to combo a unique name (to have more than one on same page, like dashboard) + * @param boolean $unique_name + * @param string $class + * @param boolean $readonly + * @param string $custom_fields + * @param string $style_icon + * @param boolean $no_change + * @param boolean $allow_zero Allow the use of the value zero. + * @return string HTML code if return parameter is true. */ - - function html_print_extended_select_for_time( $name, $selected='', @@ -1016,14 +1024,15 @@ function html_print_extended_select_for_time( $readonly=false, $custom_fields=false, $style_icon='', - $no_change=false + $no_change=false, + $allow_zero=false ) { global $config; $admin = is_user_admin($config['id_user']); if ($custom_fields) { $fields = $custom_fields; } else { - $fields = get_periods(); + $fields = get_periods(true, true, $allow_zero); } if ($no_change) { @@ -1045,7 +1054,14 @@ function html_print_extended_select_for_time( } } - if (($selected !== false) && (!isset($fields[$selected]) && $selected != 0)) { + // Allow the use of the value zero. + if ($allow_zero === true) { + $selected_zero = true; + } else { + $selected_zero = ($selected != 0) ? true : false; + } + + if (($selected !== false) && (!isset($fields[$selected]) && $selected_zero)) { $fields[$selected] = human_time_description_raw($selected, true); } @@ -1136,7 +1152,7 @@ function html_print_extended_select_for_time( echo '
'; echo "\n"; echo " \n"; echo " \n"; + echo " \n"; echo " \n"; echo " \n"; diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 7f698d8653..d719df08cd 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -81,8 +81,8 @@ if ($edit_networkmap) { $id_group = $values['id_group']; // ACL for the network map. - $networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -95,6 +95,9 @@ if ($edit_networkmap) { $name = io_safe_output($values['name']); + // Id group of the map itself, not data source. + $id_group_map = $values['id_group_map']; + $description = $values['description']; $filter = json_decode($values['filter'], true); @@ -267,8 +270,8 @@ if ($not_found) { $config['id_user'], 'AR', true, - 'id_group', - $id_group, + 'id_group_map', + $id_group_map, '', '', '', @@ -329,6 +332,28 @@ if ($not_found) { $table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask'); $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); + $table->data['source_data_group'][0] = __('Source group'); + $table->data['source_data_group'][1] = html_print_select_groups( + $config['id_user'], + 'AR', + true, + 'id_group', + $id_group, + '', + '', + '', + true + ); + $table->data['source_data_group'][1] .= html_print_image( + 'images/error.png', + true, + [ + 'id' => 'group_change_warning', + 'title' => __('Source id group changed. All elements in networkmap will be lost.'), + 'style' => 'display : none', + ] + ); + $table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:'); $table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox( 'dont_show_subgroups', @@ -379,7 +404,7 @@ if ($not_found) { $table->data['kval'][0] = __('Default ideal node separation'); $table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true); - echo ''; + echo ''; html_print_table($table); @@ -420,8 +445,11 @@ $(document).ready(function() { .css('display', 'none'); $("#form_editor-source_data_dont_show_subgroups") .css('display', 'none'); + $("#form_editor-source_data_group") + .css('display', 'none'); $("#form_editor-source_data_recon_task") .css('display', ''); + } else if (source == 'ip_mask') { $("#form_editor-source_data_ip_mask") @@ -430,6 +458,8 @@ $(document).ready(function() { .css('display', 'none'); $("#form_editor-source_data_dont_show_subgroups") .css('display', 'none'); + $("#form_editor-source_data_group") + .css('display', 'none'); } else if (source == 'group') { $("#form_editor-source_data_ip_mask") @@ -438,6 +468,8 @@ $(document).ready(function() { .css('display', 'none'); $("#form_editor-source_data_dont_show_subgroups") .css('display', ''); + $("#form_editor-source_data_group") + .css('display', ''); } }); @@ -508,5 +540,53 @@ $(document).ready(function() { $("input[name='source']").trigger("change"); $("#method").trigger("change"); + + + // Control if id_group has changed. + var id_group_old = $("#id_group").val(); + var id_group_changed = false; + + $("#id_group").on('change',{id_group_old: id_group_old}, function () { + + var id_group_new = $("#id_group").val(); + if((id_group_old != id_group_new) && (update_networkmap == 1 )) { + id_group_changed = true; + $("#group_change_warning").show(); + + } else { + id_group_changed = false; + $("#group_change_warning").hide(); + } + }); + + var update_networkmap = 0; + // Show advice if id_group has changed. + update_networkmap = $("input[name='update_networkmap']").val(); + + $( "#submit-crt" ).click(function( event ) { + + if(update_networkmap == 1 && id_group_changed === true) { + confirmDialog({ + title: '', + message: '', + ok: '', + cancel: '', + onDeny: function() { + // Continue execution. + return false; + }, + onAccept: function () { + // Submit form + $("#networkmap_options_form").submit(); + } + }) + event.preventDefault(); + } + }); + + +}); + + diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 2aa1404e30..97ebcf82c3 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -12,10 +12,10 @@ // Load global variables global $config; -// Check user credentials +// Check user credentials. check_login(); -// General ACL for the network maps +// General ACL for the network maps. $networkmaps_read = check_acl($config['id_user'], 0, 'MR'); $networkmaps_write = check_acl($config['id_user'], 0, 'MW'); $networkmaps_manage = check_acl($config['id_user'], 0, 'MM'); @@ -53,11 +53,12 @@ if (enterprise_installed()) { if ($save_empty_networkmap) { $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_paramater('id_group_map', 0); - // ACL for the network map + // ACL for the network map. // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -93,6 +94,7 @@ if (enterprise_installed()) { $values['description'] = $description; $values['source'] = 0; $values['source_data'] = $id_group; + $values['id_group_map'] = $id_group_map; if (!$networkmap_write && !$networkmap_manage) { @@ -139,10 +141,12 @@ if (enterprise_installed()) { } } else if ($update_empty_networkmap) { $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_parameter('id_group_map', 0); + // ACL for the new network map - $networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -221,11 +225,13 @@ if ($new_networkmap || $save_networkmap) { if ($save_networkmap) { $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_parameter('id_group_map', 0); + // ACL for the network map // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -282,6 +288,7 @@ if ($new_networkmap || $save_networkmap) { $values['height'] = $height; $values['id_user'] = $config['id_user']; $values['description'] = $description; + $values['id_group_map'] = $id_group_map; switch ($method) { case 'twopi': @@ -401,8 +408,10 @@ else if ($update_networkmap || $copy_networkmap || $delete) { return; } - $id_group_old = db_get_value('id_group', 'tmap', 'id', $id); - if ($id_group_old === false) { + // ACL for the network map. + $id_group_map_old = db_get_value('id_group_map', 'tmap', 'id', $id); + + if ($id_group_map_old === false) { db_pandora_audit( 'ACL Violation', 'Trying to accessnode graph builder' @@ -411,9 +420,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) { return; } - // ACL for the network map - $networkmap_write = check_acl($config['id_user'], $id_group_old, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group_old, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map_old, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map_old, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -426,10 +434,14 @@ else if ($update_networkmap || $copy_networkmap || $delete) { if ($update_networkmap) { $id_group = (int) get_parameter('id_group', 0); + // Get id of old group source to check changes. + $id_group_old = db_get_value('id_group', 'tmap', 'id', $id); + // ACL for the new network map - $networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM'); + $id_group_map = (int) get_parameter('id_group_map', 0); + $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -456,6 +468,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $values = []; $values['name'] = $name; $values['id_group'] = $id_group; + $values['id_group_map'] = $id_group_map; $description = get_parameter('description', ''); $values['description'] = $description; @@ -493,6 +506,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) { // If change the group, the map must be regenerated if ($id_group != $id_group_old) { networkmap_delete_nodes($id); + // Delete relations. + networkmap_delete_relations($id); } $networkmap_write = $networkmap_write_new; @@ -701,9 +716,9 @@ switch ($tab) { $network_maps = db_get_all_rows_filter( 'tmap', [ - 'id_group' => $id_groups, - 'limit' => $limit, - 'offset' => $offset, + 'id_group_map' => $id_groups, + 'limit' => $limit, + 'offset' => $offset, ] ); @@ -712,9 +727,9 @@ switch ($tab) { foreach ($network_maps as $network_map) { // ACL for the network map - $networkmap_read = check_acl($config['id_user'], $network_map['id_group'], 'MR'); - $networkmap_write = check_acl($config['id_user'], $network_map['id_group'], 'MW'); - $networkmap_manage = check_acl($config['id_user'], $network_map['id_group'], 'MM'); + $networkmap_read = check_acl($config['id_user'], $network_map['id_group_map'], 'MR'); + $networkmap_write = check_acl($config['id_user'], $network_map['id_group_map'], 'MW'); + $networkmap_manage = check_acl($config['id_user'], $network_map['id_group_map'], 'MM'); if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -722,7 +737,7 @@ switch ($tab) { 'Trying to access networkmap enterprise' ); include 'general/noaccess.php'; - return; + continue; } $data = []; @@ -768,7 +783,7 @@ switch ($tab) { } } - $data['groups'] = ui_print_group_icon($network_map['id_group'], true); + $data['groups'] = ui_print_group_icon($network_map['id_group_map'], true); if ($networkmap_write || $networkmap_manage) { $table->cellclass[] = [ diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 2ee34806d9..3c4565fe9a 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -576,8 +576,8 @@ if (is_ajax()) { $filter = json_encode($array_filter); // ACL for the network map. - $networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW'); - $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM'); + $networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW'); + $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -800,9 +800,9 @@ if ($networkmap === false) { return; } else { // ACL for the network map. - $networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR'); - $networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW'); - $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM'); + $networkmap_read = check_acl($config['id_user'], $networkmap['id_group_map'], 'MR'); + $networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW'); + $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM'); if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) { db_pandora_audit( diff --git a/pandora_console/operation/agentes/realtime_win.php b/pandora_console/operation/agentes/realtime_win.php index 5223a4bb2e..93c8c85ea2 100644 --- a/pandora_console/operation/agentes/realtime_win.php +++ b/pandora_console/operation/agentes/realtime_win.php @@ -65,6 +65,7 @@ echo ' + diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 05fd4c7c4b..c558530459 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -73,6 +73,7 @@ $label = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id) + diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 700a2026c1..3c758fde12 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -135,6 +135,10 @@ $id_agent = get_parameter( 'filter[id_agent]', $filter['id_agent'] ); +$text_module = get_parameter( + 'filter[text_module]', + $filter['text_module'] +); $id_agent_module = get_parameter( 'filter[id_agent_module]', $filter['id_agent_module'] @@ -210,10 +214,38 @@ $id_source_event = get_parameter( $filter['id_source_event'] ); +$server_id = get_parameter( + 'filter[server_id]', + $filter['id_server_meta'] +); + +if (is_metaconsole()) { + // Connect to node database. + $id_node = $server_id; + if ($id_node != 0) { + if (metaconsole_connect(null, $id_node) != NOERR) { + return false; + } + } +} + + if (empty($text_agent) && !empty($id_agent)) { $text_agent = agents_get_alias($id_agent); } +if (empty($text_module) && !empty($id_agent_module)) { + $text_module = modules_get_agentmodule_name($id_agent_module); + $text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module)); +} + +if (is_metaconsole()) { + // Return to metaconsole database. + if ($id_node != 0) { + metaconsole_restore_db(); + } +} + // Ajax responses. if (is_ajax()) { $get_events = get_parameter('get_events', 0); @@ -862,22 +894,6 @@ $in = '
'; $in .= $data.'
'; $inputs[] = $in; -// Criticity - severity. -$severity_select .= html_print_select( - get_priorities(), - 'severity', - $severity, - '', - __('All'), - '-1', - true, - false, - false -); -$in = '
'; -$in .= $severity_select.'
'; -$inputs[] = $in; - // Event status. $data = html_print_select( events_get_all_status(), @@ -929,6 +945,28 @@ $in = '
'; $in .= $data.'
'; $inputs[] = $in; +if (empty($severity) && $severity !== '0') { + $severity = -1; +} + +// Criticity - severity. +$data = html_print_select( + get_priorities(), + 'severity', + $severity, + '', + __('All'), + -1, + true, + true, + true, + '', + false +); +$in = '
'; +$in .= $data.'
'; +$inputs[] = $in; + $buttons = []; $buttons[] = [ @@ -1083,8 +1121,6 @@ if (is_metaconsole()) { $adv_inputs[] = $in; } -// Gap. -$adv_inputs[] = '
'; // Date from. $data = html_print_input_text( @@ -1634,6 +1670,10 @@ function process_datatables_callback(table, settings) { } + // Uncheck checkbox to select all. + if ($('#checkbox-all_validate_box').length) { + $('#checkbox-all_validate_box').uncheck(); + } } function process_datatables_item(item) { diff --git a/pandora_console/operation/visual_console/legacy_public_view.php b/pandora_console/operation/visual_console/legacy_public_view.php index ab6def4f70..4a316eee60 100644 --- a/pandora_console/operation/visual_console/legacy_public_view.php +++ b/pandora_console/operation/visual_console/legacy_public_view.php @@ -87,8 +87,8 @@ if ($layout) { $id_layout, true, true, - $width, - $height, + $bwidth, + $bheight, '../../', true, true, @@ -196,7 +196,6 @@ $ignored_params['refr'] = ''; $('body').css('background-color',''); $('body').css('margin','0'); - $('body').css('height','100%'); $('body').css('overflow','hidden'); $(".module_graph .menu_graph").css('display','none'); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index dcb62c2bda..ce00d2ed4b 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.742 -%define release 200110 +%define release 200127 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index ff62edb941..5c90768462 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.742 -%define release 200110 +%define release 200127 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 986400935b..92b75e1f64 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -3,7 +3,7 @@ # %define name pandorafms_console %define version 7.0NG.742 -%define release 200110 +%define release 200127 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index d1db588a10..741a0dc1d8 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1020,6 +1020,7 @@ CREATE TABLE IF NOT EXISTS `tserver` ( `server_keepalive` int(11) NOT NULL default 0, `stat_utimestamp` bigint(20) NOT NULL default '0', `exec_proxy` tinyint(1) UNSIGNED NOT NULL default 0, + `port` int(5) unsigned NOT NULL default 0, PRIMARY KEY (`id_server`), KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1098,7 +1099,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( `id_name` varchar(600) NOT NULL, `id_group` int(10) NOT NULL default 0, `event_type` text NOT NULL, - `severity` int(10) NOT NULL default -1, + `severity` text NOT NULL, `status` int(10) NOT NULL default -1, `search` TEXT, `text_agent` TEXT, @@ -1485,14 +1486,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` ( -- Table `treport_content_item` -- ---------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `treport_content_item` ( - `id` INTEGER UNSIGNED NOT NULL auto_increment, - `id_report_content` INTEGER UNSIGNED NOT NULL, - `id_agent_module` int(10) unsigned NOT NULL, + `id` INTEGER UNSIGNED NOT NULL auto_increment, + `id_report_content` INTEGER UNSIGNED NOT NULL, + `id_agent_module` int(10) unsigned NOT NULL, + `id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0, `server_name` text, `operation` text, PRIMARY KEY(`id`), FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) - ON UPDATE CASCADE ON DELETE CASCADE + ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; -- --------------------------------------------------------------------- @@ -2188,6 +2190,7 @@ CREATE TABLE IF NOT EXISTS `tmap` ( `generation_method` INTEGER UNSIGNED NOT NULL default 0, `generated` INTEGER UNSIGNED NOT NULL default 0, `filter` TEXT, + `id_group_map` INT(10) UNSIGNED NOT NULL default 0, PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index ab3219b3a5..c2082c379c 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -140,7 +140,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', ''), ('cr_incident_content', ''), ('sample_agent', '0'), -('gotty', '/usr/bin/gotty'); +('gotty', '/usr/bin/gotty'), +('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'); UNLOCK TABLES; -- diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index ced4c08a98..6d8edcc653 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.742-200110 +Version: 7.0NG.742-200127 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 2b7617742c..3181144d34 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.742-200110" +pandora_version="7.0NG.742-200127" package_cpan=0 package_pandora=1 diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 1906fa72eb..9e38b6cdcf 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -163,7 +163,12 @@ wmiserver 1 network_timeout 4 # Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY). -rcmd_timeout 30 + +rcmd_timeout 10 + +# Pandora FMS remote execution commands timeout tool filepath (by default at /usr/bin) + +rcmd_timeout_bin /usr/bin/timeout # Remote execution modules, ssh_launcher extra option (PANDORA FMS ENTERPRISE ONLY). ssh_launcher /usr/share/pandora_server/util/ssh_launcher.sh diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index a7232e459c..44a36abad9 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -148,6 +148,14 @@ wmiserver 0 network_timeout 5 +# Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY). + +rcmd_timeout 10 + +# Pandora FMS remote execution commands timeout tool filepath (by default at /usr/bin) + +rcmd_timeout_bin C:\PandoraFMS\Pandora_Server\bin\pandora_exec.exe + # Server keepalive (in seconds) server_keepalive 45 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 5cee1f0934..0275344af1 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -45,7 +45,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.742"; -my $pandora_build = "200110"; +my $pandora_build = "200127"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash @@ -275,7 +275,8 @@ sub pandora_load_config { $pa_config->{"alert_recovery"} = 0; # Introduced on 1.3.1 $pa_config->{"snmp_checks"} = 1; # Introduced on 1.3.1 $pa_config->{"snmp_timeout"} = 8; # Introduced on 1.3.1 - $pa_config->{"rcmd_timeout"} = 30; # Introduced on 7.0.740 + $pa_config->{"rcmd_timeout"} = 10; # Introduced on 7.0.740 + $pa_config->{"rcmd_timeout_bin"} = '/usr/bin/timeout'; # Introduced on 7.0.743 $pa_config->{"snmp_trapd"} = '/usr/sbin/snmptrapd'; # 3.0 $pa_config->{"tcp_checks"} = 1; # Introduced on 1.3.1 $pa_config->{"tcp_timeout"} = 20; # Introduced on 1.3.1 @@ -806,6 +807,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^rcmd_timeout\s+([0-9]*)/i) { $pa_config->{"rcmd_timeout"} = clean_blank($1); } + elsif ($parametro =~ m/^rcmd_timeout_bin\s(.*)/i) { + $pa_config->{"rcmd_timeout_bin"} = clean_blank($1); + } elsif ($parametro =~ m/^tcp_checks\s+([0-9]*)/i) { $pa_config->{"tcp_checks"} = clean_blank($1); } diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index cff02dc3ea..7788ccb475 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -32,7 +32,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.742"; -my $pandora_build = "200110"; +my $pandora_build = "200127"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index 056495238c..ce6048a6f9 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1447,7 +1447,7 @@ sub cloud_scan($) { } else { # Unrecognized task type. - call('message', 'Unrecognized task type', 1); + $self->call('message', 'Unrecognized task type', 1); $self->call('update_progress', -1); return; } @@ -1469,7 +1469,7 @@ sub cloud_scan($) { if (!$cloudObj) { # Failed to initialize, check Cloud credentials or anything. - call('message', 'Unable to initialize PandoraFMS::Recon::Cloud::'.$type, 3); + $self->call('message', 'Unable to initialize PandoraFMS::Recon::Cloud::'.$type, 3); } else { # Let Cloud object manage scan. @@ -1581,7 +1581,7 @@ sub app_scan($) { $type = 'SAP'; } else { # Unrecognized task type. - call('message', 'Unrecognized task type', 1); + $self->call('message', 'Unrecognized task type', 1); $self->call('update_progress', -1); return; } @@ -1607,7 +1607,7 @@ sub app_scan($) { $self->{'c_network_percent'} = 0; # Send message - call('message', 'Checking target ' . $target, 10); + $self->call('message', 'Checking target ' . $target, 10); # Force target acquirement. $self->{'task_data'}->{'dbhost'} = $target; @@ -1633,7 +1633,7 @@ sub app_scan($) { # Verify if object is connected. If cannot connect to current target # return with module. if (!$obj->is_connected()) { - call('message', 'Cannot connect to target ' . $target, 3); + $self->call('message', 'Cannot connect to target ' . $target, 3); $global_percent += $global_step; $self->{'c_network_percent'} = 90; @@ -1739,7 +1739,7 @@ sub deploy_scan($) { if (!$deployer) { # Failed to initialize, check Cloud credentials or anything. - call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3); + $self->call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3); } else { # Let deployer object manage scan. diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 9d82864045..d6aebf267b 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.742 -%define release 200110 +%define release 200127 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index d6f377a965..fd604a1c0c 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.742 -%define release 200110 +%define release 200127 Summary: Pandora FMS Server Name: %{name} @@ -47,6 +47,7 @@ rm -rf $RPM_BUILD_ROOT %setup -q -n pandora_server %build + %install rm -rf $RPM_BUILD_ROOT diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 3993c9aff4..ce2ba2feea 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="200110" +PI_BUILD="200127" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 4da8b67f13..671f66786a 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.742 PS200110"; +my $version = "7.0NG.742 PS200127"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index d2fa6f2f5b..94f5de381f 100755 --- 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.742 PS200110"; +my $version = "7.0NG.742 PS200127"; # save program name for logging my $progname = basename($0);