From 31ea02f4ad0722a50744b4c1604f0dd041db7c0e Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 5 Feb 2013 08:39:25 +0000 Subject: [PATCH] 2013-02-05 Sergio Martin * lib/PandoraFMS/Core.pm: Set ack utimestamp when create a event in validated status (normal status) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7580 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 46caaeaaab..2ad609195d 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2013-02-05 Sergio Martin + + * lib/PandoraFMS/Core.pm: Set ack utimestamp when create + a event in validated status (normal status) + 2013-02-04 Sergio Martin * lib/PandoraFMS/Core.pm: Fix a broken query of my last diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 4a7ac0adde..4ebaeb1cb5 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -2386,12 +2386,15 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) { $warning_instructions = '' unless defined ($warning_instructions); $unknown_instructions = '' unless defined ($unknown_instructions); + # If the event is created with validated status, assign ack_utimestamp + my $ack_utimestamp = $event_status == 1 ? time() : 0; + my $utimestamp = time (); my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp)); $id_agentmodule = 0 unless defined ($id_agentmodule); - db_do ($dbh, 'INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions); + db_do ($dbh, 'INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp); } ########################################################################## @@ -3342,7 +3345,6 @@ sub pandora_process_event_replication ($) { while(1) { # Check the queue each N seconds sleep ($replication_interval); - enterprise_hook('pandora_replicate_update_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id]); enterprise_hook('pandora_replicate_copy_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id, $replication_mode]); } }