diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 4fecf5d5db..bb54c56b4c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201026 +Version: 7.0NG.750-201029 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 3c41d59799..7e6e85035c 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.750-201026" +pandora_version="7.0NG.750-201029" 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 dcf6ce3719..d55e379f01 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.750'; -use constant AGENT_BUILD => '201026'; +use constant AGENT_BUILD => '201029'; # 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 e8d5ba360e..698b2439d2 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.750 -%define release 201026 +%define release 201029 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 4e9891f8cc..8d18a817fe 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.750 -%define release 201026 +%define release 201029 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 8cf408cc77..81a292285e 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201026" +PI_BUILD="201029" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 1f7a962eae..f6493723fd 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201026} +{201029} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 4ec547fa68..bac75d8cd5 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.750(Build 201026)") +#define PANDORA_VERSION ("7.0NG.750(Build 201029)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9f5f9872e9..070d4c6fbd 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.750(Build 201026))" + VALUE "ProductVersion", "(7.0NG.750(Build 201029))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index e04b3c9161..304b66c7a6 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201026 +Version: 7.0NG.750-201029 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 890008009a..a7ca73a213 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.750-201026" +pandora_version="7.0NG.750-201029" package_pear=0 package_pandora=1 diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 4e9772b6d6..bcb1db0e08 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -131,7 +131,7 @@ if (check_acl($config['id_user'], 0, 'LM')) { $table->data[2][0] = __('Template'); $own_info = get_user_info($config['id_user']); -if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { +if ($own_info['is_admin']) { $templates = alerts_get_alert_templates(false, ['id', 'name']); } else { $usr_groups = users_get_groups($config['id_user'], 'LW', true); diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 72fe425fca..7d74fe56d0 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -168,7 +168,15 @@ if ($id_group) { } } else { $table->data[2][1] = '
'; - $table->data[2][1] .= html_print_select_groups(false, 'AR', true, 'id_parent', $id_parent, '', '', '', true); + $table->data[2][1] .= html_print_input( + [ + 'type' => 'select_groups', + 'name' => 'id_parent', + 'selected' => $id_parent, + 'return' => true, + 'returnAllGroup' => true, + ] + ); $table->data[2][1] .= '
'; } diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index fb8a845284..5ff2132d12 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -258,7 +258,7 @@ if ($id_modulo === COMPONENT_TYPE_WIZARD) { if ($execution_type === EXECUTION_TYPE_PLUGIN || $module_protocol === 'wmi') { // Search all parameters received with extra_fields. foreach ($_REQUEST as $parameter => $thisValue) { - // Extra fields (OIDs Macros or WMI Extra fields) + // Extra fields (OIDs Macros or WMI Extra fields). if (preg_match('/extra_field_'.$module_protocol.'_/', $parameter) !== 0) { $tmpParameter = explode('_', $parameter); $extra_fields['extra_field_'.$tmpParameter[3]] = get_parameter($parameter); @@ -330,7 +330,7 @@ if ($create_component) { if ($name && !$name_check) { $id = network_components_create_network_component( - strip_tags(io_safe_input($name), '
'), + $name, $type, $id_group, [ @@ -431,7 +431,7 @@ if ($update_component) { $id, [ 'type' => $type, - 'name' => strip_tags(io_safe_input($name, '
')), + 'name' => $name, 'id_group' => $id_group, 'description' => $description, 'module_interval' => $module_interval, diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index db1303d907..4bb76a00fa 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -223,8 +223,9 @@ switch ($action) { $server_name = $item['server_name']; // Metaconsole db connection. - if ($meta && !empty($server_name)) { + if ($meta && empty($server_name) === false) { $connection = metaconsole_get_connection($server_name); + $server_id = $connection['id']; if (metaconsole_load_external_db($connection) != NOERR) { continue; } @@ -1383,8 +1384,7 @@ $class = 'databox filters'; html_print_input_hidden('id_agent', $idAgent); html_print_input_hidden('server_name', $server_name); - html_print_input_hidden('server_id', $server_name); - html_print_input_hidden('id_server', ''); + html_print_input_hidden('server_id', $server_id); $params = []; $params['show_helptip'] = false; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 8ac3a11e37..6857a2cd39 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1380,11 +1380,12 @@ switch ($action) { switch ($action) { case 'update': $values = []; - $server_name = get_parameter('server_id'); - if (is_metaconsole() && $server_name != '') { - $id_meta = metaconsole_get_id_server($server_name); + $server_id = get_parameter('server_id', 0); + if (is_metaconsole() === true + && empty($server_id) === false + ) { $connection = metaconsole_get_connection_by_id( - $id_meta + $server_id ); metaconsole_connect($connection); $values['server_name'] = $connection['server_name']; @@ -1811,7 +1812,6 @@ switch ($action) { 'combo_modulegroup' ); $values['id_group'] = get_parameter('combo_group'); - $values['server_name'] = get_parameter('server_name'); if ($values['server_name'] == '') { $values['server_name'] = get_parameter( @@ -1867,9 +1867,7 @@ switch ($action) { ); // If metaconsole is activated. - if ($config['metaconsole'] == 1 - && defined('METACONSOLE') - ) { + if (is_metaconsole() === true) { if (($values['type'] == 'custom_graph') || ($values['type'] == 'automatic_custom_graph') ) { diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index 2a15affd94..cb90d927b8 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -1170,6 +1170,380 @@ class HostDevices extends Wizard ]; } + // Input: SNMP enabled. + $form['inputs'][] = [ + 'label' => __('SNMP enabled'), + 'arguments' => [ + 'name' => 'snmp_enabled', + 'type' => 'switch', + 'return' => true, + 'value' => (isset($this->task['snmp_enabled'])) ? $this->task['snmp_enabled'] : 1, + 'onclick' => 'extraSNMP();', + + ], + ]; + + // SNMP CONFIGURATION. + $form['inputs'][] = [ + 'hidden' => 1, + 'block_id' => 'snmp_extra', + 'class' => 'indented', + 'block_content' => [ + [ + 'label' => __('SNMP version'), + 'arguments' => [ + 'name' => 'snmp_version', + 'fields' => [ + '1' => 'v. 1', + '2c' => 'v. 2c', + '3' => 'v. 3', + ], + 'type' => 'select', + 'script' => 'SNMPExtraShow(this.value)', + 'selected' => $this->task['snmp_version'], + 'return' => true, + ], + ], + ], + ]; + + // SNMP Options pack v1. + $form['inputs'][] = [ + 'hidden' => 1, + 'block_id' => 'snmp_options_basic', + 'class' => 'indented', + 'block_content' => [ + [ + 'label' => __('SNMP communities to try with').ui_print_help_tip( + __( + 'You can specify several values, separated by commas, for example: public,mysecret,1234' + ), + true + ), + 'arguments' => [ + 'name' => 'community', + 'type' => 'text', + 'value' => $this->task['snmp_community'], + 'size' => 25, + 'return' => true, + + ], + ], + ], + ]; + + // SNMP Options pack v3. + $form['inputs'][] = [ + 'hidden' => 1, + 'block_id' => 'snmp_options_v3', + 'class' => 'indented', + 'block_content' => [ + [ + 'label' => ''.__('Context').'', + 'arguments' => [ + 'name' => 'snmp_context', + 'type' => 'text', + 'value' => $this->task['snmp_community'], + 'size' => 15, + 'return' => true, + + ], + ], + [ + 'label' => ''.__('Auth user').'', + 'arguments' => [ + 'name' => 'snmp_auth_user', + 'type' => 'text', + 'value' => $this->task['snmp_auth_user'], + 'size' => 15, + 'return' => true, + + ], + ], + [ + 'label' => ''.__('Auth password').''.ui_print_help_tip( + __( + 'The pass length must be eight character minimum.' + ), + true + ), + 'arguments' => [ + 'name' => 'snmp_auth_pass', + 'type' => 'password', + 'value' => $this->task['snmp_auth_pass'], + 'size' => 15, + 'return' => true, + + ], + ], + [ + 'label' => ''.__('Privacy method').'', + 'arguments' => [ + 'name' => 'snmp_privacy_method', + 'type' => 'select', + 'fields' => [ + 'DES' => __('DES'), + 'AES' => __('AES'), + ], + 'selected' => $this->task['snmp_privacy_method'], + 'size' => 15, + 'return' => true, + + ], + ], + [ + 'label' => ''.__('Privacy pass').''.ui_print_help_tip( + __( + 'The pass length must be eight character minimum.' + ), + true + ), + 'arguments' => [ + 'name' => 'snmp_privacy_pass', + 'type' => 'password', + 'value' => $this->task['snmp_privacy_pass'], + 'size' => 15, + 'return' => true, + + ], + ], + [ + 'label' => ''.__('Auth method').'', + 'arguments' => [ + 'name' => 'snmp_auth_method', + 'type' => 'select', + 'fields' => [ + 'MD5' => __('MD5'), + 'SHA' => __('SHA'), + ], + 'selected' => $this->task['snmp_auth_method'], + 'size' => 15, + 'return' => true, + + ], + ], + [ + 'label' => ''.__('Security level').'', + 'arguments' => [ + 'name' => 'snmp_security_level', + 'type' => 'select', + 'fields' => [ + 'noAuthNoPriv' => __('Not auth and not privacy method'), + 'authNoPriv' => __('Auth and not privacy method'), + 'authPriv' => __('Auth and privacy method'), + ], + 'selected' => $this->task['snmp_security_level'], + 'size' => 15, + 'return' => true, + + ], + ], + + ], + ]; + + // Input: Enforce os detection. + $form['inputs'][] = [ + 'label' => __('OS detection'), + 'arguments' => [ + 'name' => 'os_detect', + 'type' => 'switch', + 'return' => true, + 'value' => (isset($this->task['os_detect'])) ? $this->task['os_detect'] : 1, + + ], + ]; + + // Input: Name resolution. + $form['inputs'][] = [ + 'label' => __('Name resolution'), + 'arguments' => [ + 'name' => 'resolve_names', + 'type' => 'switch', + 'return' => true, + 'value' => (isset($this->task['resolve_names'])) ? $this->task['resolve_names'] : 1, + ], + ]; + + // Input: Parent detection. + $form['inputs'][] = [ + 'label' => __('Parent detection'), + 'arguments' => [ + 'name' => 'parent_detection', + 'type' => 'switch', + 'return' => true, + 'value' => (isset($this->task['parent_detection'])) ? $this->task['parent_detection'] : 1, + ], + ]; + + // Input: Parent recursion. + $form['inputs'][] = [ + 'label' => __('Parent recursion'), + 'arguments' => [ + 'name' => 'parent_recursion', + 'type' => 'switch', + 'return' => true, + 'value' => (isset($this->task['parent_recursion'])) ? $this->task['parent_recursion'] : 1, + ], + ]; + + // Input: VLAN enabled. + $form['inputs'][] = [ + 'label' => __('VLAN enabled'), + 'arguments' => [ + 'name' => 'vlan_enabled', + 'type' => 'switch', + 'return' => true, + 'value' => (isset($this->task['vlan_enabled'])) ? $this->task['vlan_enabled'] : 1, + ], + ]; + + // Input: WMI enabled. + $form['inputs'][] = [ + 'label' => __('WMI enabled'), + 'arguments' => [ + 'name' => 'wmi_enabled', + 'type' => 'switch', + 'value' => (isset($this->task['wmi_enabled'])) ? $this->task['wmi_enabled'] : 0, + 'return' => true, + 'onclick' => 'toggleAuth();', + + ], + ]; + + // AUTH CONFIGURATION. + $show_auth = false; + if ((isset($this->task['wmi_enabled']) && $this->task['wmi_enabled'] > 0) + || (isset($this->task['rcmd_enabled']) && $this->task['rcmd_enabled'] > 0) + ) { + $show_auth = true; + } + + include_once $config['homedir'].'/include/class/CredentialStore.class.php'; + $available_keys = CredentialStore::getKeys('CUSTOM'); + if (check_acl($config['id_user'], 0, 'PM')) { + $link_to_cs = ''; + $link_to_cs .= __('No credentials available').', '; + $link_to_cs .= strtolower(__('Manage credentials')).''; + } else { + $link_to_cs = __('No credentials available'); + } + + if (count($available_keys) > 0) { + $form['inputs'][] = [ + 'block_id' => 'auth_block', + 'class' => 'indented', + 'hidden' => !$show_auth, + 'block_content' => [ + [ + 'label' => __('Credentials to try with'), + 'arguments' => [ + 'type' => 'select', + 'name' => 'auth_strings[]', + 'fields' => CredentialStore::getKeys('CUSTOM'), + 'selected' => explode( + ',', + $this->task['auth_strings'] + ), + + 'multiple' => true, + 'class' => 'select_multiple', + ], + ], + ], + ]; + } else { + $form['inputs'][] = [ + 'block_id' => 'auth_block', + 'class' => 'indented', + 'hidden' => !$show_auth, + 'block_content' => [ + [ + 'label' => __('Credentials'), + 'extra' => $link_to_cs, + ], + ], + ]; + } + + ui_require_jquery_file('tag-editor.min'); + ui_require_jquery_file('caret.min'); + ui_require_css_file('jquery.tag-editor'); + + $form['js'] = ' + $(\'#text-community\').tagEditor({ + forceLowercase: false + }); + + function SNMPExtraShow(target) { + $("#snmp_options_basic").hide(); + $("#snmp_options_v3").hide(); + if (document.getElementsByName("snmp_enabled")[0].checked) { + $("#snmp_extra").show(); + if (target == 3) { + $("#snmp_options_v3").show(); + } else { + $("#snmp_options_basic").show(); + } + } + } + + function extraSNMP() { + if (document.getElementsByName("snmp_enabled")[0].checked) { + SNMPExtraShow($("#snmp_version").val()); + $("#snmp_extra").show(); + + // Enable snmp dependant checks + if (!document.getElementsByName("parent_recursion")[0].checked) + $("input[name=parent_recursion]").click(); + + if (!document.getElementsByName("parent_detection")[0].checked) + $("input[name=parent_detection]").click(); + + if (!document.getElementsByName("resolve_names")[0].checked) + $("input[name=resolve_names]").click(); + + if (!document.getElementsByName("vlan_enabled")[0].checked) + $("input[name=vlan_enabled]").click(); + } else { + // Hide unusable sections + $("#snmp_extra").hide(); + $("#snmp_options_basic").hide(); + $("#snmp_options_v3").hide(); + + // Disable snmp dependant checks + if (document.getElementsByName("parent_recursion")[0].checked) + $("input[name=parent_recursion]").click(); + + if (document.getElementsByName("parent_detection")[0].checked) + $("input[name=parent_detection]").click(); + + if (document.getElementsByName("resolve_names")[0].checked) + $("input[name=resolve_names]").click(); + + if (document.getElementsByName("vlan_enabled")[0].checked) + $("input[name=vlan_enabled]").click(); + } + } + + function toggleAuth() { + if (document.getElementsByName("wmi_enabled")[0].checked + || (typeof document.getElementsByName("rcmd_enabled")[0] != "undefined" + && document.getElementsByName("rcmd_enabled")[0].checked) + ) { + $("#auth_block").show(); + } else { + $("#auth_block").hide(); + } + } + + $(function() { + SNMPExtraShow($("#snmp_version").val()); + }); + '; + if (enterprise_installed()) { // Feature configuration. $extra = enterprise_hook('hd_showextrainputs', [$this]); @@ -1178,7 +1552,7 @@ class HostDevices extends Wizard $form['inputs'], $extra['inputs'] ); - $form['js'] = $extra['js']; + $form['js'] .= $extra['js']; } } diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index 698ab7df9b..4db3fbbbd9 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -216,7 +216,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { } else if ($search_agents && is_metaconsole()) { $id_agent = (int) get_parameter('id_agent'); $string = (string) get_parameter('q'); - // q is what autocomplete plugin gives + // Q is what autocomplete plugin gives. $id_group = (int) get_parameter('id_group', -1); $addedItems = html_entity_decode((string) get_parameter('add')); $addedItems = json_decode($addedItems); @@ -236,6 +236,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { 'alias', 'direccion', 'id_tmetaconsole_setup AS id_server', + 'server_name', ]; $filter = []; @@ -254,36 +255,33 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { case 'enabled': $filter['disabled'] = 0; break; + + default: + // Not possible. + break; } - if (!empty($id_agent)) { + if (empty($id_agent) === false) { $filter['id_agente'] = $id_agent; } - if (!empty($string)) { + if (empty($string) === false) { // Get agents for only the alias. $filter_alias = $filter; - switch ($config['dbtype']) { - case 'mysql': - $filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")'; - break; + $filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")'; - case 'postgresql': - $filter_alias[] = '(alias LIKE \'%'.$string.'%\')'; - break; + $agents = db_get_all_rows_filter( + 'tmetaconsole_agent', + $filter_alias, + $fields + ); - case 'oracle': - $filter_alias[] = '(UPPER(alias) LIKE UPPER(\'%'.$string.'%\'))'; - break; - } - - $agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_alias, $fields); if ($agents !== false) { foreach ($agents as $agent) { $data[] = [ 'id' => $agent['id_agente'], 'name' => io_safe_output($agent['nombre']), - 'alias' => io_safe_output($agent['alias']), + 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')', 'ip' => io_safe_output($agent['direccion']), 'id_server' => $agent['id_server'], 'filter' => 'alias', @@ -293,27 +291,20 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { // Get agents for only the name. $filter_agents = $filter; - switch ($config['dbtype']) { - case 'mysql': - $filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")'; - break; + $filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")'; - case 'postgresql': - $filter_agents[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre LIKE \'%'.$string.'%\')'; - break; + $agents = db_get_all_rows_filter( + 'tmetaconsole_agent', + $filter_agents, + $fields + ); - case 'oracle': - $filter_agents[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))'; - break; - } - - $agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_agents, $fields); if ($agents !== false) { foreach ($agents as $agent) { $data[] = [ 'id' => $agent['id_agente'], 'name' => io_safe_output($agent['nombre']), - 'alias' => io_safe_output($agent['alias']), + 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')', 'ip' => io_safe_output($agent['direccion']), 'id_server' => $agent['id_server'], 'filter' => 'agent', @@ -321,29 +312,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { } } - // Get agents for only the address + // Get agents for only the address. $filter_address = $filter; - switch ($config['dbtype']) { - case 'mysql': - $filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")'; - break; + $filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")'; - case 'postgresql': - $filter_address[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion LIKE \'%'.$string.'%\')'; - break; + $agents = db_get_all_rows_filter( + 'tmetaconsole_agent', + $filter_address, + $fields + ); - case 'oracle': - $filter_address[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))'; - break; - } - - $agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_address, $fields); if ($agents !== false) { foreach ($agents as $agent) { $data[] = [ 'id' => $agent['id_agente'], 'name' => io_safe_output($agent['nombre']), - 'alias' => io_safe_output($agent['alias']), + 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')', 'ip' => io_safe_output($agent['direccion']), 'id_server' => $agent['id_server'], 'filter' => 'address', @@ -351,29 +335,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { } } - // Get agents for only the description + // Get agents for only the description. $filter_description = $filter; - switch ($config['dbtype']) { - case 'mysql': - $filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")'; - break; + $filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")'; - case 'postgresql': - $filter_description[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')'; - break; + $agents = db_get_all_rows_filter( + 'tmetaconsole_agent', + $filter_description, + $fields + ); - case 'oracle': - $filter_description[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))'; - break; - } - - $agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_description, $fields); if ($agents !== false) { foreach ($agents as $agent) { $data[] = [ 'id' => $agent['id_agente'], 'name' => io_safe_output($agent['nombre']), - 'alias' => io_safe_output($agent['alias']), + 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')', 'ip' => io_safe_output($agent['direccion']), 'id_server' => $agent['id_server'], 'filter' => 'description', diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index 9efc2a872a..7f23e84894 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -3002,7 +3002,7 @@ class AgentWizard extends HTML $newModule = $module; // Split the values got to obtain the name. $tmpFirst = explode('.', $value); - $tmpSecond = explode(' ', $tmpFirst[1]); + $tmpSecond = explode(' ', $tmpFirst[(count($tmpFirst) - 1)]); // Position 0 is the index, Position 3 is the MIB name. $snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3]; // Perform the operations for get the values. @@ -3011,6 +3011,11 @@ class AgentWizard extends HTML $currentOid = $oid.'.'.$tmpSecond[0]; $macros['macros'][$oidName] = $currentOid; $currentOidValue = $this->snmpgetValue($currentOid); + // If for any reason the value comes empty, add 1. + if ($currentOidValue == '') { + $currentOidValue = 1; + } + $thisOperation = preg_replace( '/'.$oidName.'/', $currentOidValue, @@ -4566,7 +4571,7 @@ class AgentWizard extends HTML // Definition object. $definition = []; - // ifHCInOctets. + // IfHCInOctets. $moduleName = $name.'ifHCInOctets'; $definition['ifHCInOctets'] = [ 'module_name' => $moduleName, @@ -4592,7 +4597,7 @@ class AgentWizard extends HTML ], ]; - // ifHCOutOctets. + // IfHCOutOctets. $moduleName = $name.'ifHCOutOctets'; $definition['ifHCOutOctets'] = [ 'module_name' => $moduleName, @@ -4618,7 +4623,7 @@ class AgentWizard extends HTML ], ]; - // ifHCInUcastPkts. + // IfHCInUcastPkts. $moduleName = $name.'ifHCInUcastPkts'; $definition['ifHCInUcastPkts'] = [ 'module_name' => $moduleName, @@ -4644,7 +4649,7 @@ class AgentWizard extends HTML ], ]; - // ifHCOutUcastPkts. + // IfHCOutUcastPkts. $moduleName = $name.'ifHCOutUcastPkts'; $definition['ifHCOutUcastPkts'] = [ 'module_name' => $moduleName, @@ -4669,7 +4674,7 @@ class AgentWizard extends HTML 'inv_critical' => false, ], ]; - // ifHCInNUcastPkts. + // IfHCInNUcastPkts. $moduleName = $name.'ifHCInNUcastPkts'; $definition['ifHCInNUcastPkts'] = [ 'module_name' => $moduleName, @@ -4733,17 +4738,18 @@ class AgentWizard extends HTML * @param integer|null $type Module type. * * @return string + * @throws Exception Handle of unwanted operations. */ private function evalOperation( string $operation, string $unit='', ?int $type=0 ) { - // Avoid non-numeric or arithmetic chars for security reasons. - if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) { - $output = 'ERROR'; - } else { - try { + try { + // Avoid non-numeric or arithmetic chars for security reasons. + if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) { + throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation)); + } else { // Get the result of the operation and set it. $output = ''; eval('$output = '.$operation.';'); @@ -4753,9 +4759,11 @@ class AgentWizard extends HTML $unit, $type ); - } catch (Exception $e) { - $output = 'ERROR'; } + } catch (Exception $e) { + $this->message['type'][] = 'error'; + $this->message['message'][] = $e->getMessage(); + $this->showMessage(); } return $output; @@ -5034,15 +5042,13 @@ class AgentWizard extends HTML var imageInfoModules = $("#image-info-modules-" + blockNumber); var totalCount = 0; var markedCount = 0; - var hidden_input = document.getElementById("hidden-module-active-"+switchName[2]+"_"+switchName[3]); - var id_input = hidden_input.id.split("_"); if (type == 'block') { selectedBlock .parent() .removeClass("alpha50"); if (selectedBlock.prop("checked")) { // Set to active the values of fields. - $("[id*='"+id_input[0]+"']") + $("[id*=hidden-module-active-"+blockNumber+"]") .each(function(){ $(this).val('1'); }); @@ -5054,7 +5060,7 @@ class AgentWizard extends HTML imageInfoModules.removeClass('hidden'); } else { // Set to inactive the values of fields. - $("[id*='"+id_input[0]+"']") + $("[id*=hidden-module-active-"+blockNumber+"]") .each(function(){ $(this).val('0'); }); diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index b9721b3eb0..0afa46af73 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -264,6 +264,7 @@ class TreeService extends Tree ts.id_agent_module, ts.name, ts.name as `alias`, + ts.description as `description`, ts.id as `rootID`, "services" as `rootType`, "services" as `type`, @@ -311,6 +312,7 @@ class TreeService extends Tree ]; $services[$service['id']]['name'] = $service['name']; $services[$service['id']]['id'] = $service['id']; + $services[$service['id']]['description'] = $service['description']; $services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id']; } @@ -512,6 +514,8 @@ class TreeService extends Tree $tmp['id'] = (int) $item->service()->id(); $tmp['name'] = $item->service()->name(); $tmp['alias'] = $item->service()->name(); + $tmp['description'] = $item->service()->description(); + $tmp['elementDescription'] = $item->description(); if ($this->connectedToNode === false && is_metaconsole() === true @@ -643,6 +647,8 @@ class TreeService extends Tree ts.id_agent_module, ts.name, ts.name as `alias`, + ts.description as `description`, + tse.description as `elementDescription`, tse.id_service as `rootID`, "services" as `rootType`, "services" as `type`, diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index f5a41e3337..e490b8d671 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 = 'PC201026'; +$build_version = 'PC201029'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 0147168ebf..a033f33115 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3753,7 +3753,16 @@ function series_type_graph_array($data, $show_elements_graph) $name_legend .= __('Unit ').' '; $name_legend .= $show_elements_graph['unit'].': '; } else { - $name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': '; + if (isset($show_elements_graph['from_interface']) === true + && (bool) $show_elements_graph['from_interface'] === true + ) { + $label_interfaces = array_flip($show_elements_graph['modules_series']); + $name_legend = $show_elements_graph['labels'][$value['agent_module_id']][$label_interfaces[$value['agent_module_id']]].': '; + } else if (is_array($show_elements_graph['labels'][$value['agent_module_id']]) === true) { + $name_legend = 'Avg: '; + } else { + $name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': '; + } } } else { if (strpos($key, 'baseline') !== false) { diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index beff278dc1..119852f1b9 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -335,6 +335,11 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $ // Filter by agents id. $id_agents_list = implode(',', $id_agent); + + if ($id_agents_list === '') { + $id_agents_list = '0'; + } + $subQuery .= ' AND id_agente in ('.$id_agents_list.')'; } else if ($id_agent === false || empty($id_agent)) { if ($allModules) { diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 6401910faa..2b96c52978 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -12513,7 +12513,13 @@ function api_set_create_event($id, $trash1, $other, $returnType) if ($other['data'][18] != '') { $values['id_extra'] = $other['data'][18]; - $sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";'; + if (is_metaconsole()) { + $table_event = 'tmetaconsole_event'; + } else { + $table_event = 'tevento'; + } + + $sql_validation = 'SELECT id_evento FROM '.$table_event.' where estado IN (0,2) and id_extra ="'.$other['data'][18].'";'; $validation = db_get_all_rows_sql($sql_validation); if ($validation) { foreach ($validation as $val) { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 092044765c..e029ebda2e 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -428,7 +428,7 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip * @param boolean $disabled Disabled or enabled. * @param boolean $style CSS inline style. * @param string $option_style CSS inline style in array format. - * @param array $id_group Groups to be manually added. + * @param integer $id_group Exclude group branch from id_group. * @param string $keys_field Field to be used as array key, (id). * @param boolean $strict_user Strict. * @param array $delete_groups Remove groups from select. @@ -500,6 +500,15 @@ function html_print_select_groups( $name = 'group_select'.$idcounter[$name]; } + if ($id_group !== false) { + $children = groups_get_children($id_group); + foreach ($children as $child) { + $delete_groups[] = $child['id_grupo']; + } + + $delete_groups[] = $id_group; + } + $fields = []; // Preload selector. if (is_array($selected) === false) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 0bfe96e864..674da95b09 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4979,6 +4979,16 @@ function reporting_agent_configuration($report, $content) } +/** + * Report Min, Max and Avg. + * + * @param array $report Info report. + * @param array $content Content report. + * @param string $type Type report. + * @param boolean $pdf Is pdf. + * + * @return array Data draw report. + */ function reporting_value($report, $content, $type, $pdf=false) { global $config; @@ -4993,16 +5003,17 @@ function reporting_value($report, $content, $type, $pdf=false) $return['type'] = 'min_value'; break; - case 'avg': - $return['type'] = 'avg_value'; - break; - case 'sum': $return['type'] = 'sumatory'; break; + + case 'avg': + default: + $return['type'] = 'avg_value'; + break; } - if (empty($content['name'])) { + if (empty($content['name']) === true) { switch ($type) { case 'max': $content['name'] = __('Max. Value'); @@ -5012,17 +5023,18 @@ function reporting_value($report, $content, $type, $pdf=false) $content['name'] = __('Min. Value'); break; - case 'avg': - $content['name'] = __('AVG. Value'); - break; - case 'sum': $content['name'] = __('Summatory'); break; + + case 'avg': + default: + $content['name'] = __('AVG. Value'); + break; } } - if ($config['metaconsole']) { + if (is_metaconsole() === true) { $id_meta = metaconsole_get_id_server($content['server_name']); $server = metaconsole_get_connection_by_id($id_meta); @@ -5060,14 +5072,15 @@ function reporting_value($report, $content, $type, $pdf=false) $return['agent_name'] = $agent_name; $return['module_name'] = $module_name; + $only_image = false; if ($pdf) { - $only_image = 1; + $only_image = true; } $params = [ 'agent_module_id' => $content['id_agent_module'], 'period' => $content['period'], - 'width' => '600px', + 'width' => '90%', 'pure' => false, 'date' => $report['datetime'], 'only_image' => $only_image, @@ -5086,6 +5099,7 @@ function reporting_value($report, $content, $type, $pdf=false) case 'max': case 'min': case 'avg': + default: $divisor = get_data_multiplier($unit); if ($content['lapse_calc'] == 0) { @@ -5107,6 +5121,7 @@ function reporting_value($report, $content, $type, $pdf=false) break; case 'avg': + default: $value = reporting_get_agentmodule_data_average( $content['id_agent_module'], $content['period'], @@ -5118,7 +5133,14 @@ function reporting_value($report, $content, $type, $pdf=false) if (!$config['simple_module_value']) { $formated_value = $value; } else { - $formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit); + $formated_value = format_for_graph( + $value, + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); } } else { $return['visual_format'] = $content['visual_format']; @@ -5126,17 +5148,51 @@ function reporting_value($report, $content, $type, $pdf=false) switch ($type) { case 'max': $params['force_interval'] = 'max_only'; - $value = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit); + $value = format_for_graph( + reporting_get_agentmodule_data_max( + $content['id_agent_module'], + $content['period'], + $report['datetime'] + ), + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); break; case 'min': $params['force_interval'] = 'min_only'; - $value = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit); + $value = format_for_graph( + reporting_get_agentmodule_data_min( + $content['id_agent_module'], + $content['period'], + $report['datetime'] + ), + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); break; case 'avg': + default: $params['force_interval'] = 'avg_only'; - $value = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit); + $value = format_for_graph( + reporting_get_agentmodule_data_average( + $content['id_agent_module'], + $content['period'], + $report['datetime'] + ), + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); break; } @@ -5166,15 +5222,49 @@ function reporting_value($report, $content, $type, $pdf=false) if ($i > $time_begin['utimestamp']) { switch ($type) { case 'max': - $row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit); + $row[__('Maximun')] = format_for_graph( + reporting_get_agentmodule_data_max( + $content['id_agent_module'], + $content['lapse'], + ($i + $content['lapse']) + ), + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); break; case 'min': - $row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit); + $row[__('Maximun')] = format_for_graph( + reporting_get_agentmodule_data_min( + $content['id_agent_module'], + $content['lapse'], + ($i + $content['lapse']) + ), + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); break; case 'avg': - $row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit); + default: + $row[__('Maximun')] = format_for_graph( + reporting_get_agentmodule_data_average( + $content['id_agent_module'], + $content['lapse'], + ($i + $content['lapse']) + ), + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); break; } } else { @@ -5185,7 +5275,7 @@ function reporting_value($report, $content, $type, $pdf=false) } } - if ($config['metaconsole']) { + if (is_metaconsole() === true) { metaconsole_restore_db(); } @@ -5205,7 +5295,14 @@ function reporting_value($report, $content, $type, $pdf=false) } else { $divisor = get_data_multiplier($unit); - $formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit); + $formated_value = format_for_graph( + $value, + $config['graph_precision'], + '.', + ',', + $divisor, + $unit + ); } break; } @@ -5215,7 +5312,7 @@ function reporting_value($report, $content, $type, $pdf=false) 'formated_value' => $formated_value, ]; - if ($config['metaconsole']) { + if (is_metaconsole() === true) { metaconsole_restore_db(); } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 0de6b542bd..207d2037ed 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -501,6 +501,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) $table1->head[5] = __('Status'); $table1->headstyle = []; + $table1->headstyle[0] = 'text-align: left'; + $table1->headstyle[1] = 'text-align: left'; $table1->headstyle[2] = 'text-align: right'; $table1->headstyle[3] = 'text-align: right'; $table1->headstyle[4] = 'text-align: right'; @@ -536,6 +538,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) $table2->head[6] = __('Downtime'); $table2->headstyle = []; + $table2->headstyle[0] = 'text-align: left'; + $table2->headstyle[1] = 'text-align: left'; $table2->headstyle[2] = 'text-align: right'; $table2->headstyle[3] = 'text-align: right'; $table2->headstyle[4] = 'text-align: right'; @@ -548,7 +552,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) $table3->align = []; $table3->align[0] = 'left'; - $table3->align[1] = 'left'; + $table3->align[1] = 'right'; $table3->align[2] = 'right'; $table3->align[3] = 'right'; $table3->align[4] = 'right'; @@ -565,6 +569,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) $table3->head[4] = __('Checks Unknown'); $table3->headstyle = []; + $table3->headstyle[0] = 'text-align: left'; + $table3->headstyle[1] = 'text-align: right'; $table3->headstyle[2] = 'text-align: right'; $table3->headstyle[3] = 'text-align: right'; $table3->headstyle[4] = 'text-align: right'; @@ -721,23 +727,23 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) true ); } else { - $table1->title = $item['title']; - $table1->titleclass = 'title_table_pdf'; - $table1->titlestyle = 'text-align:left;'; + // $table1->title = $item['title']; + // $table1->titleclass = 'title_table_pdf'; + // $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table1, true ); - $table2->title = $item['title']; - $table2->titleclass = 'title_table_pdf'; - $table2->titlestyle = 'text-align:left;'; + // $table2->title = $item['title']; + // $table2->titleclass = 'title_table_pdf'; + // $table2->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table2, true ); - $table3->title = $item['title']; - $table3->titleclass = 'title_table_pdf'; - $table3->titlestyle = 'text-align:left;'; + // $table3->title = $item['title']; + // $table3->titleclass = 'title_table_pdf'; + // $table3->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table3, true @@ -782,9 +788,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) true ); } else { - $table1->title = $item['title']; - $table1->titleclass = 'title_table_pdf'; - $table1->titlestyle = 'text-align:left;'; + // $table1->title = $item['title']; + // $table1->titleclass = 'title_table_pdf'; + // $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table1, true @@ -2965,8 +2971,26 @@ function reporting_html_min_value(&$table, $item, $mini) } -function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_empty=false) -{ +/** + * Htlm report AVg, min, Max, Only. + * + * @param array $table Table. + * @param array $item Data. + * @param boolean $mini Is mini. + * @param boolean $only_value Only value. + * @param boolean $check_empty Empty. + * @param integer $pdf PDF Mode. + * + * @return string Html output. + */ +function reporting_html_value( + $table, + $item, + $mini, + $only_value=false, + $check_empty=false, + $pdf=0 +) { global $config; if ($mini) { @@ -2975,8 +2999,12 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e $font_size = $config['font_size_item_report'].'em'; } - if (isset($item['visual_format']) && $item['visual_format'] != 0 - && ($item['type'] == 'max_value' || $item['type'] == 'min_value' || $item['type'] == 'avg_value') + $return_pdf = ''; + + if (isset($item['visual_format']) === true && $item['visual_format'] != 0 + && ($item['type'] == 'max_value' + || $item['type'] == 'min_value' + || $item['type'] == 'avg_value') ) { $table2 = new stdClass(); $table2->width = '100%'; @@ -2998,6 +3026,7 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e break; case 'avg_value': + default: $table2->head = [ __('Agent'), __('Module'), @@ -3025,15 +3054,28 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e $table->colspan[2][0] = 3; $table->colspan[3][0] = 3; - array_push($table->data, html_print_table($table2, true)); + if ($pdf === 0) { + array_push($table->data, html_print_table($table2, true)); + } else { + $return_pdf .= html_print_table($table2, true); + } + unset($item['data'][0]); if ($item['visual_format'] != 1) { $value = $item['data'][1]['value']; - array_push($table->data, $value); - unset($item['data'][1]); + if ($pdf === 0) { + array_push($table->data, $value); + } else { + $style_div_pdf = 'text-align:center;margin-bottom:20px;'; + $return_pdf .= '
'; + $return_pdf .= $value; + $return_pdf .= '
'; + } } + unset($item['data'][1]); + if ($item['visual_format'] != 2) { $table1 = new stdClass(); $table1->width = '100%'; @@ -3053,6 +3095,7 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e break; case 'avg_value': + default: $table1->head = [ __('Lapse'), __('Average'), @@ -3061,8 +3104,9 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e } $table1->data = []; + $row = []; foreach ($item['data'] as $data) { - if (!is_numeric($data[__('Maximun')])) { + if (is_numeric($data[__('Maximun')]) === false) { $row = [ $data[__('Lapse')], $data[__('Maximun')], @@ -3070,7 +3114,12 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e } else { $row = [ $data[__('Lapse')], - remove_right_zeros(number_format($data[__('Maximun')], $config['graph_precision'])), + remove_right_zeros( + number_format( + $data[__('Maximun')], + $config['graph_precision'] + ) + ), ]; } @@ -3080,10 +3129,22 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e $table1->title = $item['title']; $table1->titleclass = 'title_table_pdf'; $table1->titlestyle = 'text-align:left;'; + if ($pdf === 0) { + array_push($table->data, html_print_table($table1, true)); + } else { + $return_pdf .= html_print_table($table1, true); + } + } - array_push($table->data, html_print_table($table1, true)); + if ($pdf !== 0) { + return $return_pdf; } } else { + if ($pdf !== 0) { + $table = new stdClass(); + $table->width = '100%'; + } + $table->colspan['data']['cell'] = 3; $table->cellstyle['data']['cell'] = 'text-align: left;'; @@ -3098,6 +3159,10 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e } $table->data['data']['cell'] .= '

'; + + if ($pdf !== 0) { + return html_print_table($table, true); + } } } @@ -3617,9 +3682,9 @@ function reporting_html_availability($table, $item, $pdf=0) $data[0] = html_print_table($table1, true); array_push($table->data, $data); } else { - $table1->title = $item['title']; - $table1->titleclass = 'title_table_pdf'; - $table1->titlestyle = 'text-align:left;'; + // $table1->title = $item['title']; + // $table1->titleclass = 'title_table_pdf'; + // $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table($table1, true); } @@ -3629,9 +3694,9 @@ function reporting_html_availability($table, $item, $pdf=0) $data2[0] = html_print_table($table2, true); array_push($table->data, $data2); } else { - $table2->title = $item['title']; - $table2->titleclass = 'title_table_pdf'; - $table2->titlestyle = 'text-align:left;'; + // $table2->title = $item['title']; + // $table2->titleclass = 'title_table_pdf'; + // $table2->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table($table2, true); } } @@ -3699,9 +3764,9 @@ function reporting_html_availability($table, $item, $pdf=0) ); array_push($table->data, $data); } else { - $table1->title = $item['title']; - $table1->titleclass = 'title_table_pdf'; - $table1->titlestyle = 'text-align:left;'; + // $table1->title = $item['title']; + // $table1->titleclass = 'title_table_pdf'; + // $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table1, true diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 15c2f9fcf4..f99ae01c79 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -2024,7 +2024,7 @@ function getServerUrl() { server_url = get_php_value("homeurl"); } catch (SyntaxError) { console.warn("Pandora homeurl cannot be found."); - server_url = window.location.origin + "/pandora_console"; + server_url = $("#hidden-homeurl").val(); } return server_url; } diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index f3e6ecec52..497e18c266 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -637,7 +637,20 @@ var TreeController = { .css("cursor", "pointer"); $content.append($serviceDetailImage); - $content.append(" " + element.name); + if ( + typeof element.elementDescription !== "undefined" && + element.elementDescription != "" + ) { + $content.append(" " + element.elementDescription); + } else if ( + typeof element.description !== "undefined" && + element.description != "" + ) { + $content.append(" " + element.description); + } else { + $content.append(" " + element.name); + } + // $content.append(" " + element.name); } else { $content.remove($node); } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 6e3df35955..8e1c489b1e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1484,6 +1484,7 @@ table.databox { padding: 9px 7px; font-weight: normal; color: #fff; + text-align: justify; } .databox > th * { diff --git a/pandora_console/include/styles/wizard.css b/pandora_console/include/styles/wizard.css index a183e2368f..0ef0df5ee6 100644 --- a/pandora_console/include/styles/wizard.css +++ b/pandora_console/include/styles/wizard.css @@ -11,6 +11,10 @@ ul.wizard { ul.wizard li { padding-bottom: 10px; padding-top: 10px; + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; } ul.wizard li > label:not(.p-switch) { diff --git a/pandora_console/install.php b/pandora_console/install.php index f39f2adc26..f706f1dff4 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
'; +html_print_input_hidden('homeurl', $config['homeurl']); + $url_css_modal = ui_get_full_url('include/styles/register.css', false, false, false); echo ''; // Connection lost alert. diff --git a/pandora_console/operation/visual_console/public_view.php b/pandora_console/operation/visual_console/public_view.php index 1127614eed..301ec3ca9c 100644 --- a/pandora_console/operation/visual_console/public_view.php +++ b/pandora_console/operation/visual_console/public_view.php @@ -31,6 +31,8 @@ require_once $config['homedir'].'/vendor/autoload.php'; ui_require_css_file('visual_maps'); ui_require_css_file('register'); +html_print_input_hidden('homeurl', $config['homeurl']); + // Connection lost alert. $conn_title = __('Connection with server has been lost'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index b28bb4afb5..37fa8092c2 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.750 -%define release 201026 +%define release 201029 # 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 324713445b..162aeaef50 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.750 -%define release 201026 +%define release 201029 # 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 42daa187a9..de5a3f753c 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.750 -%define release 201026 +%define release 201029 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 1654336189..1afd3bd5bb 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.750-201026 +Version: 7.0NG.750-201029 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 be7ae03b37..2aff52280a 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.750-201026" +pandora_version="7.0NG.750-201029" package_cpan=0 package_pandora=1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index dd2fd49511..03f3c1e109 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.750"; -my $pandora_build = "201026"; +my $pandora_build = "201029"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index aaeebeff4e..17a8779e7f 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -34,7 +34,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.750"; -my $pandora_build = "201026"; +my $pandora_build = "201029"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 63e13ebe52..258f820820 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.750 -%define release 201026 +%define release 201029 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 73712e49d1..7b05aea60c 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.750 -%define release 201026 +%define release 201029 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index d2dc2b4701..2712d24fd2 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201026" +PI_BUILD="201029" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 94cb21db50..e7a1e7ec12 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.750 PS201026"; +my $version = "7.0NG.750 PS201029"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 1304a56793..80771fd543 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.750 PS201026"; +my $version = "7.0NG.750 PS201029"; # save program name for logging my $progname = basename($0);