2010-07-26 Ramon Novoa <rnovoa@artica.es>

* 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.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3060 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2010-07-26 11:51:49 +00:00
parent 89466842f6
commit 8b2c487362
3 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2010-07-26 Ramon Novoa <rnovoa@artica.es>
* 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 <rnovoa@artica.es>
* lib/PandoraFMS/DataServer.pm: Sort files by creation date before

View File

@ -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);
}
}

View File

@ -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;
}