From c03ad1f29bc2153ae08cb560fb3c51ca08f50080 Mon Sep 17 00:00:00 2001 From: ramonn Date: Mon, 24 Aug 2009 18:25:42 +0000 Subject: [PATCH] 2009-08-24 Ramon Novoa * lib/PandoraFMS/Config.pm, lib/PandoraFMS/DataServer.pm: Added an option to ignore timestamps in XML data files and use file timestamps instead. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1877 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 6 ++++++ pandora_server/lib/PandoraFMS/Config.pm | 7 ++++++- pandora_server/lib/PandoraFMS/DataServer.pm | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 2ea5cc7dd9..c44d3ad6bc 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2009-08-24 Ramon Novoa + + * lib/PandoraFMS/Config.pm, + lib/PandoraFMS/DataServer.pm: Added an option to ignore timestamps in + XML data files and use file timestamps instead. + 2009-08-23 Sancho Lerena * util/tentacle_serverd: Using SU instead SUDO, idea from diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 9e19d9f16a..2e582f08d6 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -222,6 +222,9 @@ sub pandora_load_config { # Update tagent_access $pa_config->{"agentaccess"} = 1; + + # Ignore the timestamp in the XML and use the file timestamp instead + $pa_config->{'use_xml_timestamp'} = 0; # Check for UID0 if ($pa_config->{"quiet"} != 0){ @@ -485,7 +488,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^agentaccess\s([0-1])/i) { $pa_config->{'agentaccess'}= clean_blank($1); } - + elsif ($parametro =~ m/^use_xml_timestamp\s([0-1])/i) { + $pa_config->{'use_xml_timestamp'} = clean_blank($1); + } } # end of loop for parameter # diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 64e17fa64a..61e4d97aba 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -137,6 +137,9 @@ sub data_consumer ($$) { next; } + # Ignore the timestamp in the XML and use the file timestamp instead + $xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '1'); + unlink ($file_name); process_xml_data ($self->getConfig (), $xml_data, $self->getServerID (), $self->getDBH ()); return;