diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9ec0fe362f..61c697631d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2009-08-01 Miguel de Dios + + * include/functions_db.php: add external Module group "Not assigned" + because there are modules with this module group as agent software. + * extensions/module_groups.php: fix bug that the count are very wrong. And + add the link to Full list of monitors with filter. + 2009-08-30 Raul Mateos * extensions/update_manager/main.php: Change Pandora FMS text to 3.0 diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index c9f10f6e4c..19c4456e7f 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -28,19 +28,15 @@ function mainModuleGroups() { global $config; //the useful global var of Pandora Console, it has many data can you use //The big query - $sql = 'SELECT SUM(t1.id_agente) AS count, t5.estado - FROM tagente AS t1 - INNER JOIN tgrupo AS t2 - ON t1.id_grupo = t2.id_grupo - INNER JOIN tagente_modulo AS t3 - ON t1.id_agente = t3.id_agente - INNER JOIN tmodule_group AS t4 - ON t3.id_module_group = t4.id_mg - INNER JOIN tagente_estado AS t5 - ON t1.id_agente = t5.id_agente - WHERE t3.delete_pending IS FALSE AND t3.disabled IS FALSE AND - t2.id_grupo = %d AND t3.id_module_group = %d - GROUP BY t5.estado'; + $sql = "select COUNT(id_agente) AS count, estado + FROM tagente_estado + WHERE utimestamp != 0 AND id_agente IN + (SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled IS FALSE) + AND id_agente_modulo IN + (SELECT id_agente_modulo + FROM tagente_modulo + WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE) + GROUP BY estado"; echo "

" . __("Combine table of agent group and module group") . "

"; @@ -88,8 +84,14 @@ function mainModuleGroups() { $color = 'transparent'; //Defaut color for cell if ($count == 0) { $color = '#babdb6'; //Grey when the cell for this model group and agent group hasn't modules. + $alinkStart = ''; + $alinkEnd = ''; } else { + $alinkStart = ''; + $alinkEnd = ''; + if (array_key_exists(0,$states) && (count($states) == 1)) $color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules. else { @@ -106,7 +108,7 @@ function mainModuleGroups() { height: 15px; margin-left: auto; margin-right: auto; text-align: center; padding-top: 5px;"> - ' . $count . ' modules'); + ' . $alinkStart . $count . ' modules' . $alinkEnd . ''); } array_push($tableData,$row); } diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 51ea5f6674..82c634b6c5 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1256,6 +1256,8 @@ function get_all_model_groups () { foreach ($groups as $group) $returnGroups[$group['id_mg']] = $group['name']; + $returnGroups[0] = "Not assigned"; //Module group external to DB but it exist + return $returnGroups; }