Fixed problems with fired alerts when recover this alerts, no show properly in metaconsole. Tiquet: #3111

This commit is contained in:
m-lopez-f 2015-12-22 11:49:20 +01:00
parent baf8712d3e
commit 2ae4568fc5
2 changed files with 6 additions and 3 deletions

View File

@ -306,7 +306,7 @@ sub pandora_server_tasks ($) {
}
if ($agent->{'update_alert_count'} == 1) {
pandora_update_agent_alert_count ($dbh, $agent->{'id_agente'});
pandora_update_agent_alert_count ($pa_config, $dbh, $agent->{'id_agente'});
}
}

View File

@ -4806,12 +4806,15 @@ sub pandora_update_agent_module_count ($$$) {
##########################################################################
# Update the fired alert count of an agent.
##########################################################################
sub pandora_update_agent_alert_count ($$) {
my ($dbh, $agent_id) = @_;
sub pandora_update_agent_alert_count ($$$) {
my ($pa_config, $dbh, $agent_id) = @_;
db_do ($dbh, 'UPDATE tagente SET update_alert_count=0,
fired_count=(SELECT COUNT(*) FROM tagente_modulo, talert_template_modules WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=talert_template_modules.id_agent_module AND talert_template_modules.disabled=0 AND times_fired>0 AND id_agente=' . $agent_id .
') WHERE id_agente = ' . $agent_id);
# Sync the agent cache every time the module count is updated.
enterprise_hook('update_agent_cache', [$pa_config, $dbh, $agent_id]) if ($pa_config->{'metaconsole_agent_cache'} == 1);
}
########################################################################