diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index a7f451a306..8db0c1525a 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,10 @@ +2010-07-26 Ramon Novoa + + * lib/PandoraFMS/Core.pm: Do not compress data for async modules. + + * lib/PandoraFMS/DataServer.pm: Check that the file exists before + trying to parse the XML to avoid XML::Simple error messages. + 2010-07-22 Ramon Novoa * lib/PandoraFMS/DataServer.pm: Sort files by creation date before diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 92f6b2bb37..15ace95555 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -767,8 +767,8 @@ sub pandora_process_module ($$$$$$$$$;$) { $current_utimestamp, $timestamp, $module->{'id_agente'}, $current_interval, $server_id, $utimestamp, ($save == 1) ? $timestamp : $agent_status->{'last_try'}, $module->{'id_agente_modulo'}); - # Save module data - if ($module_type eq "log4x" || $save == 1) { + # Save module data. Async and log4x modules are not compressed. + if ($module_type =~ m/(async)|(log4x)/) || $save == 1) { save_module_data ($dataObject, $module, $module_type, $utimestamp, $dbh); } } diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index d43d2ea650..91a3539f53 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -127,6 +127,9 @@ sub data_consumer ($$) { $file_name .= "/" unless (substr ($file_name, -1, 1) eq '/'); $file_name .= $task; + # Double check that the file exists + return unless (-f $file_name); + # Try to parse the XML 3 times my $xml_data; @@ -134,18 +137,18 @@ sub data_consumer ($$) { eval { threads->yield; $xml_data = XMLin ($file_name, forcearray => 'module'); - }; + }; - # Invalid XML - if ($@) { - sleep (10); - next; - } + # Invalid XML + if ($@) { + sleep (10); + 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' || ! defined ($xml_data->{'timestamp'})); + # 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' || ! defined ($xml_data->{'timestamp'})); - unlink ($file_name); + unlink ($file_name); process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ()); return; }