From edd00a8f886c09f2423e85f8455a7e1dbc5aaf54 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Mon, 26 Dec 2011 11:45:19 +0000 Subject: [PATCH] 2011-12-26 Ramon Novoa * lib/PandoraFMS/Core.pm: Discard inc data when a second value with the same timestamp arrives. Thanks to eXXon. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5305 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 80fb14bd95..2ed489b3b9 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-12-26 Ramon Novoa + + * lib/PandoraFMS/Core.pm: Discard inc data when a second value + with the same timestamp arrives. Thanks to eXXon. + 2011-12-23 Ramon Novoa * conf/pandora_server.conf: Added Netflow server configuration diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 4a2f86b821..3322a60d08 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1820,6 +1820,9 @@ sub process_data ($$$$$) { if ($module_type =~ m/_inc$/) { $data = process_inc_data ($data, $module, $utimestamp, $dbh); + # Same timestamp as previous data. Discard. + return undef if($data == -1); + # Not an error, no previous data if (!defined($data)){ $data_object->{'data'} = 0; @@ -1868,7 +1871,7 @@ sub process_inc_data ($$$$) { } # Should not happen - return 0 if ($utimestamp == $data_inc->{'utimestamp'}); + return -1 if ($utimestamp == $data_inc->{'utimestamp'}); # Update inc data db_do ($dbh, 'UPDATE tagente_datos_inc SET datos = ?, utimestamp = ? WHERE id_agente_modulo = ?', $data, $utimestamp, $module->{'id_agente_modulo'});