diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 1ecb4ce25c..09828e6575 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2374,4 +2374,86 @@ function modules_get_module_group_status($id_agent, $id_module_group) { return $status_return; } + +function modules_get_modules_name ($sql_from , $sql_conditions = '', $meta = false) { + global $config; + + if (!$meta) { + // Query to get name of the modules to module name filter combo + switch ($config['dbtype']) { + case 'mysql': + case 'postgresql': + $sql = 'SELECT distinct(tagente_modulo.nombre) + '. $sql_from . $sql_conditions; + break; + case 'oracle': + $sql = 'SELECT DISTINCT(tagente_modulo.nombre)' . + $sql_from . $sql_conditions; + break; + } + + $return = db_get_all_rows_sql($sql); + + return $return; + } + else { + // For each server defined and not disabled: + $servers = db_get_all_rows_sql ('SELECT * + FROM tmetaconsole_setup + WHERE disabled = 0'); + + if ($servers === false) + $servers = array(); + + $result = array(); + foreach($servers as $server) { + // If connection was good then retrieve all data server + if (metaconsole_connect($server) == NOERR) { + $connection = true; + } + else { + $connection = false; + } + + // Get all info for filters of all nodes + $modules_temp = db_get_all_rows_sql($sql); + + $rows_temp = db_get_all_rows_sql('SELECT distinct name + FROM tmodule_group + ORDER BY name'); + $rows_temp = io_safe_output($rows_temp); + + if (!empty($rows_temp)) { + foreach ($rows_temp as $module_group_key => $modules_group_val) + $rows_temp_processed[$modules_group_val['name']] = $modules_group_val['name']; + + $rows_select = array_unique(array_merge($rows_select, $rows_temp_processed)); + } + + $groups_temp = users_get_groups_for_select(false, "AR", true, true, false); + + $groups_temp_processed = array(); + + foreach ($groups_temp as $group_temp_key => $group_temp_val) { + $new_key = str_replace(' ','',$group_temp_val); + $groups_temp_processed[$new_key] = $group_temp_val; + } + + if (!empty($groups_temp_processed)) { + $groups_select = array_unique(array_merge($groups_select, $groups_temp_processed)); + } + + if (!empty($modules_temp)) + $modules = array_merge($modules, $modules_temp); + + metaconsole_restore_db(); + } + unset($groups_select[__('All')]); + $key_group_all = array_search(__('All'), $groups_select); + if ($key_group_all !== false) + unset($groups_select[$key_group_all]); + return $modules; + } +} + ?> diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index b00fae7843..a43f0a267a 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -19,10 +19,10 @@ global $config; check_login(); -if (! check_acl ($config['id_user'], 0, "AR") - && ! check_acl ($config['id_user'], 0, "AW")) { - db_pandora_audit("ACL Violation", - "Trying to access Agent Management"); +if (! check_acl ($config['id_user'], 0, 'AR') + && ! check_acl ($config['id_user'], 0, 'AW')) { + db_pandora_audit('ACL Violation', + 'Trying to access Agent Management'); require ('general/noaccess.php'); return; } @@ -38,26 +38,33 @@ $strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_use if (! defined ('METACONSOLE')) { //Header - ui_print_page_header (__("Monitor detail"), "images/brick.png", false); + ui_print_page_header (__('Monitor detail'), 'images/brick.png', false); } else { - ui_meta_print_header(__("Monitor view")); + ui_meta_print_header(__('Monitor view')); } - - -$ag_freestring = get_parameter ('ag_freestring'); -$ag_modulename = (string) get_parameter ('ag_modulename'); -if (!defined('METACONSOLE')) { - $ag_group = (int) get_parameter ('ag_group', 0); -} +$ag_freestring = get_parameter ('ag_freestring'); +$ag_modulename = (string) get_parameter ('ag_modulename'); +$ag_custom_fields = (array) get_parameter('ag_custom_fields', array()); +$offset = (int) get_parameter ('offset', 0); +$status = (int) get_parameter ('status', 4); +$modulegroup = get_parameter ('modulegroup', -1); +$tag_filter = get_parameter('tag_filter', 0); +$refr = get_parameter('refr', 0); +// Sort functionality +$sortField = get_parameter('sort_field'); +$sort = get_parameter('sort', 'none'); +//When the previous page was a visualmap and show only one module +$id_module = (int)get_parameter('id_module', 0); +if (!is_metaconsole()) + $ag_group = (int) get_parameter ('ag_group', 0); else { - $ag_group = get_parameter ('ag_group', 0); + $ag_group = get_parameter ('ag_group', 0); $ag_group_metaconsole = $ag_group; } -$ag_custom_fields = (array) get_parameter("ag_custom_fields", array()); $ag_custom_fields_params = ""; if (!empty($ag_custom_fields)) { foreach ($ag_custom_fields as $id => $value) { @@ -66,23 +73,6 @@ if (!empty($ag_custom_fields)) { } } -$offset = (int) get_parameter ('offset', 0); -$status = (int) get_parameter ('status', 4); -$modulegroup = get_parameter ('modulegroup', -1); -$tag_filter = get_parameter('tag_filter', 0); -if ($tag_filter) { - if ($ag_group && $strict_user) { - $tag_filter = 0; - } -} -$refr = get_parameter('refr', 0); -// Sort functionality - -$sortField = get_parameter('sort_field'); -$sort = get_parameter('sort', 'none'); - -//When the previous page was a visualmap and show only one module -$id_module = (int)get_parameter('id_module', 0); if ($id_module) { $status = -1; $ag_modulename = modules_get_agentmodule_name($id_module); @@ -91,28 +81,17 @@ if ($id_module) { enterprise_hook('open_meta_frame'); -$filters = '