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

This commit is contained in:
mdtrooper 2015-02-05 14:51:08 +01:00
parent 39292e558f
commit 39efadf123
1 changed files with 7 additions and 2 deletions

View File

@ -1523,6 +1523,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']) &&
@ -1532,11 +1534,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;
}
@ -1549,6 +1551,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;
//~ }