From fd41fba3d8030e0e8f91883da80c10c386db3727 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 27 Mar 2015 14:32:31 +0100 Subject: [PATCH] Changed the behaviour of the network map tooltip info for the strict users --- .../include/ajax/networkmap.ajax.php | 90 +++---------------- .../operation/agentes/ver_agente.php | 5 +- 2 files changed, 13 insertions(+), 82 deletions(-) diff --git a/pandora_console/include/ajax/networkmap.ajax.php b/pandora_console/include/ajax/networkmap.ajax.php index cb21e41c2b..5131de9664 100644 --- a/pandora_console/include/ajax/networkmap.ajax.php +++ b/pandora_console/include/ajax/networkmap.ajax.php @@ -58,50 +58,17 @@ switch($action) { } if (isset($stats['agents'])) { - if ($metaconsole) { - include_once ('include/functions_reporting.php'); - - $servers = db_get_all_rows_sql ("SELECT * - FROM tmetaconsole_setup"); - if ($servers === false) - $servers = array(); - - $total_agents = 0; - - foreach ($servers as $server) { - // If connection was good then retrieve all data server - if (metaconsole_load_external_db ($server)) { - $connection = true; - } - else { - $connection = false; - } - - if ($connection) - $data = reporting_get_group_stats(); - - metaconsole_restore_db(); - - $total_agents += $data["total_agents"]; - } - - - $total_agents = format_numeric($total_agents); - - $summary .= $total_agents . - " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . - ' ' . __('Agents') . "
"; - } - else { - $summary .= count($stats['agents']) . - " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . - ' ' . __('Agents') . "
"; - } + // TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY + $summary .= count($stats['agents']) . + " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . + ' ' . __('Agents') . "
"; } if (isset($stats['modules'])) { // TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY - $summary .= count($stats['modules'])." x ".html_print_image('images/brick.png',true).' '.__('Modules')."
"; + $summary .= count($stats['modules']) . + " x " . html_print_image($hack_metaconsole . 'images/brick.png',true) . + ' ' . __('Modules') . "
"; } echo '

'.__('Map summary').'

'.$summary.''; @@ -120,46 +87,9 @@ switch($action) { $summary = '
'; if (isset($stats['agents'])) { - if ($metaconsole) { - include_once ('include/functions_reporting.php'); - - $servers = db_get_all_rows_sql ("SELECT * - FROM tmetaconsole_setup - WHERE id = " . $id_server); - if ($servers === false) - $servers = array(); - - $total_agents = 0; - - foreach ($servers as $server) { - // If connection was good then retrieve all data server - if (metaconsole_load_external_db ($server)) { - $connection = true; - } - else { - $connection = false; - } - - if ($connection) - $data = reporting_get_group_stats(); - - metaconsole_restore_db(); - - $total_agents += $data["total_agents"]; - } - - - $total_agents = format_numeric($total_agents); - - $summary .= $total_agents . - " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . - ' ' . __('Agents') . "
"; - } - else { - $summary .= count($stats['agents']) . - " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . - ' ' . __('Agents') . "
"; - } + $summary .= count($stats['agents']) . + " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . + ' ' . __('Agents') . "
"; } echo '

'.__('Map summary').'

'.$summary.''; break; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 23e33d8bba..b2e251dd8f 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -438,6 +438,7 @@ if (is_ajax ()) { $server = null; if ($metaconsole) { + $strict_user = (bool) db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']); $server = db_get_row('tmetaconsole_setup', 'id', $id_server); if (metaconsole_connect($server) != NOERR) { @@ -527,7 +528,7 @@ if (is_ajax ()) { $size_bad_modules = sizeof ($bad_modules); // Modules down - if ($size_bad_modules > 0) { + if ($size_bad_modules > 0 && (!$metaconsole || !$strict_user)) { echo ''.__('Monitors down').': '.$size_bad_modules.' / '.$total_modules; echo '