diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 12c344ecf3..40c7a12898 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2013-09-05 Sergio Martin + + * godmode/agentes/module_manager.php + godmode/agentes/configurar_agente.php: Change old counts + of status by new way setting flags to be updated by + server + 2013-09-05 Miguel de Dios * godmode/agentes/module_manager_editor_plugin.php, diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 7c6d7f3c01..8ec7470d01 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1172,36 +1172,10 @@ if ($delete_module) { // DELETE agent module ! $error++; } else { - // Update module status count - if ($module_data['estado'] == 0) { - db_process_sql ('UPDATE tagente - SET normal_count=normal_count-1 - WHERE id_agente=' . $module_data['id_agente']); - } - else if ($module_data['estado'] == 1) { - db_process_sql ('UPDATE tagente - SET critical_count=critical_count-1 - WHERE id_agente=' . $module_data['id_agente']); - } - else if ($module_data['estado'] == 2) { - db_process_sql ('UPDATE tagente - SET warning_count=warning_count-1 - WHERE id_agente=' . $module_data['id_agente']); - } - else if ($module_data['estado'] == 3) { - db_process_sql ('UPDATE tagente - SET unknown_count=unknown_count-1 - WHERE id_agente=' . $module_data['id_agente']); - } - else if ($module_data['estado'] == 4) { - db_process_sql ('UPDATE tagente - SET notinit_count=notinit_count-1 - WHERE id_agente=' . $module_data['id_agente']); - } - + // Set flag to update module status count db_process_sql ('UPDATE tagente - SET total_count=total_count-1 - WHERE id_agente=' . $module_data['id_agente']); + SET update_module_count = 1, update_alert_count = 1 + WHERE id_agente = ' . $module_data['id_agente']); } $result = db_process_sql_delete('tagente_estado', diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 2ec33fd163..1c3654b468 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -176,36 +176,10 @@ if ($multiple_delete) { $error++; } else { - // Update module status count + // Set flag to update module status count if ($module !== false) { - if ($module['estado'] == AGENT_MODULE_STATUS_NORMAL) { - db_process_sql ('UPDATE tagente - SET normal_count = normal_count - 1 - WHERE id_agente=' . $module['id_agente']); - } - else if ($module['estado'] == AGENT_MODULE_STATUS_CRITICAL_BAD) { - db_process_sql ('UPDATE tagente - SET critical_count = critical_count - 1 - WHERE id_agente=' . $module['id_agente']); - } - else if ($module['estado'] == AGENT_MODULE_STATUS_WARNING) { - db_process_sql ('UPDATE tagente - SET warning_count = warning_count - 1 - WHERE id_agente=' . $module['id_agente']); - } - else if ($module['estado'] == AGENT_MODULE_STATUS_UNKNOWN) { - db_process_sql ('UPDATE tagente - SET unknown_count = unknown_count - 1 - WHERE id_agente =' . $module['id_agente']); - } - else if ($module['estado'] == AGENT_MODULE_STATUS_NO_DATA) { - db_process_sql ('UPDATE tagente - SET notinit_count = notinit_count - 1 - WHERE id_agente = ' . $module['id_agente']); - } - db_process_sql ('UPDATE tagente - SET total_count = total_count - 1 + SET update_module_count = 1, update_alert_count = 1 WHERE id_agente = ' . $module['id_agente']); } }