From 06e715b6dbfa04caf28b92c03d2a579686eaf9e5 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 12 Aug 2015 14:37:24 +0200 Subject: [PATCH] Ignore out of order data instead of resetting the module. --- pandora_server/lib/PandoraFMS/Core.pm | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index c34a6ffe63..1b32f51e08 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3525,20 +3525,25 @@ sub process_inc_data ($$$$$) { return undef; } - # Negative increment, reset inc data - if ($data < $data_inc->{'datos'} || $utimestamp < $data_inc->{'utimestamp'}) { - db_do ($dbh, 'UPDATE tagente_datos_inc SET datos = ?, utimestamp = ? WHERE id_agente_modulo = ?', $data, $utimestamp, $module->{'id_agente_modulo'}); - logger($pa_config, "Discarding data and resetting counter for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10); - - # Prevent the module from becoming unknown! - db_do ($dbh, 'UPDATE tagente_estado SET utimestamp = ? WHERE id_agente_modulo = ?', time(), $module->{'id_agente_modulo'}); - + # Out of order data + if ($utimestamp < $data_inc->{'utimestamp'}) { + logger($pa_config, "Received old data for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 3); return undef; } # Should not happen if ($utimestamp == $data_inc->{'utimestamp'}) { - logger($pa_config, "Duplicate timestamp for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10); + logger($pa_config, "Duplicate timestamp for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 3); + return undef; + } + + # Negative increment, reset inc data + if ($data < $data_inc->{'datos'}) { + db_do ($dbh, 'UPDATE tagente_datos_inc SET datos = ?, utimestamp = ? WHERE id_agente_modulo = ?', $data, $utimestamp, $module->{'id_agente_modulo'}); + logger($pa_config, "Discarding data and resetting counter for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10); + + # Prevent the module from becoming unknown! + db_do ($dbh, 'UPDATE tagente_estado SET utimestamp = ? WHERE id_agente_modulo = ?', time(), $module->{'id_agente_modulo'}); return undef; }