Changed the behaviour of the network map tooltip info for the strict users

This commit is contained in:
Alejandro Gallardo Escobar 2015-03-27 14:32:31 +01:00
parent c29c47dc09
commit fd41fba3d8
2 changed files with 13 additions and 82 deletions

View File

@ -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') . "<br>";
}
else {
$summary .= count($stats['agents']) .
" x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) .
' ' . __('Agents') . "<br>";
}
// 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') . "<br>";
}
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')."<br>";
$summary .= count($stats['modules']) .
" x " . html_print_image($hack_metaconsole . 'images/brick.png',true) .
' ' . __('Modules') . "<br>";
}
echo '<h3>'.__('Map summary').'</h3><strong>'.$summary.'</strong>';
@ -120,46 +87,9 @@ switch($action) {
$summary = '<br>';
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') . "<br>";
}
else {
$summary .= count($stats['agents']) .
" x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) .
' ' . __('Agents') . "<br>";
}
$summary .= count($stats['agents']) .
" x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) .
' ' . __('Agents') . "<br>";
}
echo '<h3>'.__('Map summary').'</h3><strong>'.$summary.'</strong>';
break;

View File

@ -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 '<strong>'.__('Monitors down').':</strong> '.$size_bad_modules.' / '.$total_modules;
echo '<ul>';
foreach ($bad_modules as $module) {
@ -561,7 +562,7 @@ if (is_ajax ()) {
$alert_modules = db_get_sql ($sql);
}
if ($alert_modules > 0) {
if ($alert_modules > 0 && (!$metaconsole || !$strict_user)) {
$sql = sprintf ('SELECT tagente_modulo.nombre, talert_template_modules.last_fired
FROM talert_template_modules, tagente_modulo, tagente
WHERE tagente.id_agente = %d