#8263 Fixed status group

This commit is contained in:
Daniel Maya 2021-11-24 11:40:24 +01:00
parent 07ef0477af
commit cfd2fe390e
3 changed files with 5 additions and 14 deletions

View File

@ -609,24 +609,15 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
*
* @return integer Status of the agents.
*/
function groups_get_status($id_group=0, $strict_user=false)
function groups_get_status($id_group=0, $ignore_alerts=false)
{
global $config;
include_once $config['homedir'].'/include/functions_reporting.php';
if ($strict_user) {
$acltags = tags_get_user_groups_and_tags($config['id_user'], 'AR', $strict_user);
$group_status = group_get_data($config['id_user'], $strict_user, $acltags, false, 'group');
$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
$data['agent_critical'] = $groups_status['_agents_critical_'];
$data['agent_warning'] = $groups_status['_agents_warning_'];
$data['agent_unknown'] = $groups_status['_agents_unknown_'];
} else {
$data = reporting_get_group_stats_resume($id_group);
}
$data = reporting_get_group_stats_resume($id_group);
if ($data['monitor_alerts_fired'] > 0) {
if ($data['monitor_alerts_fired'] > 0 && $ignore_alerts == false) {
return AGENT_STATUS_ALERT_FIRED;
} else if ($data['agent_critical'] > 0) {
return AGENT_STATUS_CRITICAL;

View File

@ -3426,7 +3426,7 @@ function visual_map_get_status_element($layoutData)
break;
case GROUP_ITEM:
$group_status = groups_get_status($layoutData['id_group']);
$group_status = groups_get_status($layoutData['id_group'], true);
switch ($group_status) {
case AGENT_STATUS_ALERT_FIRED:

View File

@ -359,7 +359,7 @@ final class Group extends Item
}
} else {
// Get the status img src.
$status = \groups_get_status($groupId);
$status = \groups_get_status($groupId, true);
}
$imagePath = \visual_map_get_image_status_element($data, $status);