Merge branch 'ent-8263-Fallo-interpretacion-grupos-en-Consola-Visual' into 'develop'
Ent 8263 fallo interpretacion grupos en consola visual See merge request artica/pandorafms!4550
This commit is contained in:
commit
cd073ef4e3
|
@ -609,24 +609,15 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
|
||||||
*
|
*
|
||||||
* @return integer Status of the agents.
|
* @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;
|
global $config;
|
||||||
|
|
||||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
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;
|
return AGENT_STATUS_ALERT_FIRED;
|
||||||
} else if ($data['agent_critical'] > 0) {
|
} else if ($data['agent_critical'] > 0) {
|
||||||
return AGENT_STATUS_CRITICAL;
|
return AGENT_STATUS_CRITICAL;
|
||||||
|
|
|
@ -3420,7 +3420,7 @@ function visual_map_get_status_element($layoutData)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GROUP_ITEM:
|
case GROUP_ITEM:
|
||||||
$group_status = groups_get_status($layoutData['id_group']);
|
$group_status = groups_get_status($layoutData['id_group'], true);
|
||||||
|
|
||||||
switch ($group_status) {
|
switch ($group_status) {
|
||||||
case AGENT_STATUS_ALERT_FIRED:
|
case AGENT_STATUS_ALERT_FIRED:
|
||||||
|
|
|
@ -346,9 +346,7 @@ final class Group extends Item
|
||||||
|
|
||||||
$countStatus = \db_get_row_sql($sql);
|
$countStatus = \db_get_row_sql($sql);
|
||||||
|
|
||||||
if ($countStatus['fired'] > 0) {
|
if ($countStatus['critical'] > 0) {
|
||||||
$status = AGENT_STATUS_ALERT_FIRED;
|
|
||||||
} else if ($countStatus['critical'] > 0) {
|
|
||||||
$status = AGENT_STATUS_CRITICAL;
|
$status = AGENT_STATUS_CRITICAL;
|
||||||
} else if ($countStatus['warning'] > 0) {
|
} else if ($countStatus['warning'] > 0) {
|
||||||
$status = AGENT_STATUS_WARNING;
|
$status = AGENT_STATUS_WARNING;
|
||||||
|
@ -359,7 +357,7 @@ final class Group extends Item
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Get the status img src.
|
// 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);
|
$imagePath = \visual_map_get_image_status_element($data, $status);
|
||||||
|
|
Loading…
Reference in New Issue