From 75768c9eaaee83493272ec18aa12e9075121ada9 Mon Sep 17 00:00:00 2001 From: Fermin Date: Thu, 4 Oct 2018 16:23:36 +0200 Subject: [PATCH 1/3] [Tags performance] Open reporting checks --- pandora_console/include/functions_reporting.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 279c972324..6059c095ac 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -3667,7 +3667,6 @@ function reporting_agent_configuration($report, $content) { $agent_configuration['description'] = $agent_data['comentarios']; $agent_configuration['enabled'] = (int)!$agent_data['disabled']; $agent_configuration['group'] = $report["group"]; - // TODO TAGS agents_get_modules $modules = agents_get_modules ($content['id_agent']); $agent_configuration['modules'] = array(); @@ -8286,11 +8285,10 @@ function reporting_get_agentmodule_ttr ($id_agent_module, $period = 0, $date = 0 * Get a detailed report of the modules of the agent * * @param int $id_agent Agent id to get the report for. - * @param string $filter filter for get partial modules. * * @return array An array */ -function reporting_get_agent_module_info ($id_agent, $filter = false) { +function reporting_get_agent_module_info ($id_agent) { global $config; $return = array (); @@ -8306,12 +8304,7 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) { return $return; } - if ($filter != '') { - $filter = 'AND '; - } - - $filter = 'disabled = 0'; - // TODO TAGS agents_get_modules + $filter = array('disabled' => 0); $modules = agents_get_modules($id_agent, false, $filter, true, false); if ($modules === false) { From 979e443824a1daf43c757b3f0aad867e54e174a6 Mon Sep 17 00:00:00 2001 From: Fermin Date: Thu, 4 Oct 2018 16:31:24 +0200 Subject: [PATCH 2/3] Removed unused code --- .../include/functions_reporting.php | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 6059c095ac..0b24819347 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -8402,33 +8402,6 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $ break; } - if ($strict_user && $type == 'agent') { - - $acltags = tags_get_user_groups_and_tags ($config['id_user'],'AR', $strict_user); - $filter['disabled'] = 0; - $id_agent = $counts_info['id_agente']; - - $counts_info = array(); - $counts_info['normal_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NORMAL)); - $counts_info['warning_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_WARNING)); - $counts_info['critical_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_CRITICAL_BAD)); - $counts_info['notinit_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NOT_INIT)); - $counts_info['unknown_count'] = count(tags_get_agent_modules ($id_agent, false, $acltags, false, $filter, false, AGENT_MODULE_STATUS_UNKNOWN)); - $counts_info['total_count'] = $counts_info['normal_count'] + $counts_info['warning_count'] + $counts_info['critical_count'] + $counts_info['unknown_count'] + $counts_info['notinit_count']; - - $all_agent_modules = tags_get_agent_modules ($id_agent, false, $acltags, false, $filter); - if (!empty($all_agent_modules)) { - $mod_clause = "(".implode(',', array_keys($all_agent_modules)).")"; - - $counts_info['fired_count'] = (int) db_get_sql ("SELECT COUNT(times_fired) - FROM talert_template_modules - WHERE times_fired != 0 AND id_agent_module IN ".$mod_clause); - } - else { - $counts_info['fired_count'] = 0; - } - } - // Store the counts in a data structure to print hidden divs with titles $stats = array(); From 1278f03fd965dbc90a5c7c9603a4cc88e006089e Mon Sep 17 00:00:00 2001 From: Fermin Date: Thu, 4 Oct 2018 19:08:01 +0200 Subject: [PATCH 3/3] [Tags performance] agents_get_modules misc checks --- .../godmode/reporting/graph_container.php | 1 - .../operation/agentes/exportdata.php | 18 ++---------------- pandora_console/operation/agentes/graphs.php | 3 --- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index 09084c14e0..2785db4dba 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -66,7 +66,6 @@ if ($enterpriseEnable) { } $subsection = reporting_enterprise_add_graph_template_subsection('', $buttons); -reporting_enterprise_select_graph_template_tab(); $buttons['graph_container'] = array('active' => true, 'text' => '' . diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index 5319d700d0..579dbe8382 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -37,21 +37,8 @@ ui_print_page_header (__("Export data"), "images/server_export_mc.png"); $group = get_parameter_post ('group', 0); $agentName = get_parameter_post ('agent', 0); - -switch ($config["dbtype"]) { - case "mysql": - $agents = agents_get_agents( - array('nombre LIKE "' . $agentName . '"'), array ('id_agente')); - break; - case "postgresql": - $agents = agents_get_agents( - array('nombre LIKE \'' . $agentName . '\''), array ('id_agente')); - break; - case "oracle": - $agents = agents_get_agents( - array('nombre LIKE \'%' . $agentName . '%\''), array ('id_agente')); - break; -} +$agents = agents_get_agents( + array('nombre LIKE "' . $agentName . '"'), array ('id_agente')); $agent = $agents[0]['id_agente']; $module = (array) get_parameter_post ('module_arr', array ()); @@ -283,7 +270,6 @@ if (empty($export_btn) || $show_form) { $table->data[2][0] .= ui_print_help_tip(__("No modules of type string. You can not calculate their average"),true); if ($agent > 0) { - // TODO TAGS agents_get_modules $modules = agents_get_modules ($agent); } else { diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index f13c92d157..4c9a546798 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -47,7 +47,6 @@ $option_type = get_parameter('option_type', 0); // - others //---------------------------------------------------------------------- $list_modules = array(); -// TODO TAGS agents_get_modules $modules_networkmap_no_proc = agents_get_modules( $id_agente, false, array( 'id_modulo' => 2, // networkmap type @@ -62,7 +61,6 @@ $modules_networkmap_no_proc = agents_get_modules( )); if (empty($modules_networkmap_no_proc)) $modules_networkmap_no_proc = array(); -// TODO TAGS agents_get_modules $modules_others = agents_get_modules( $id_agente, false, array( 'id_tipo_modulo' => array( @@ -77,7 +75,6 @@ $modules_others = agents_get_modules( if (empty($modules_others)) $modules_others = array(); -// TODO TAGS agents_get_modules $modules_boolean = agents_get_modules( $id_agente, false, array( 'id_tipo_modulo' => array(