Fixed the status of agent with some not-init modules. TICKET: #1761

(cherry picked from commit 39efadf123)
This commit is contained in:
mdtrooper 2015-02-05 14:51:08 +01:00
parent e9b0a6fe26
commit e943a84b96
1 changed files with 7 additions and 2 deletions

View File

@ -1525,6 +1525,8 @@ function agents_get_addresses ($id_agent) {
* return -1 if the data are wrong
*/
function agents_get_status_from_counts($agent) {
// Check if in the data there are all the necessary values
if (!isset($agent['normal_count']) &&
!isset($agent['warning_count']) &&
@ -1534,11 +1536,11 @@ function agents_get_status_from_counts($agent) {
!isset($agent['total_count'])) {
return -1;
}
# Juanma (05/05/2014) Fix: This status is not init! 0 modules or all not init
if ($agent['notinit_count'] == $agent['total_count']) {
return AGENT_MODULE_STATUS_NOT_INIT;
}
}
if ($agent['critical_count'] > 0) {
return AGENT_MODULE_STATUS_CRITICAL_BAD;
}
@ -1551,6 +1553,9 @@ function agents_get_status_from_counts($agent) {
else if ($agent['normal_count'] == $agent['total_count']) {
return AGENT_MODULE_STATUS_NORMAL;
}
else if ($agent['normal_count'] + $agent['notinit_count'] == $agent['total_count']) {
return AGENT_MODULE_STATUS_NORMAL;
}
//~ else if($agent['notinit_count'] == $agent['total_count']) {
//~ return AGENT_MODULE_STATUS_NORMAL;
//~ }