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

* lib/PandoraFMS/Core.pm: Make sure delete_pending is set to 0
          when selecting keepalive modules.

        * lib/PandoraFMS/DataServer.pm: Do not read more than max_queue_files
          files. Suppressed some warnings.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3069 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2010-07-27 17:12:17 +00:00
parent 402788e97c
commit ccd952497e
3 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2010-07-27 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Make sure delete_pending is set to 0
when selecting keepalive modules.
* lib/PandoraFMS/DataServer.pm: Do not read more than max_queue_files
files. Suppressed some warnings.
2010-07-27 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Removed a misplaced parenthesis.

View File

@ -999,7 +999,7 @@ sub pandora_module_keep_alive ($$$$$) {
logger($pa_config, "Updating keep_alive module for agent '" . $agent_name . "'.", 10);
# Update keepalive module
my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND id_tipo_modulo = 100', $id_agent);
my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND delete_pending = 0 AND id_tipo_modulo = 100', $id_agent);
return unless defined ($module);
my %data = ('data' => 1);

View File

@ -82,16 +82,30 @@ sub data_producer ($) {
my $pa_config = $self->getConfig ();
my @tasks;
my @files;
# Read all files in the incoming directory
# Open the incoming directory
opendir (DIR, $pa_config->{'incomingdir'})
|| die "[FATAL] Cannot open Incoming data directory at " . $pa_config->{'incomingdir'} . ": $!";
my @files = readdir (DIR);
# Do not read more than max_queue_files files
my $file_count = 0;
while (my $file = readdir (DIR)) {
if ($file_count > $pa_config->{"max_queue_files"}) {
last;
}
push (@files, $file);
$file_count++;
}
closedir(DIR);
@files = sort { -C $pa_config->{'incomingdir'} . "/$b" <=> -C $pa_config->{'incomingdir'} . "/$a" } (@files);
# Temporarily disable warnings (some files may have been deleted)
{
no warnings;
@files = sort { -C $pa_config->{'incomingdir'} . "/$b" <=> -C $pa_config->{'incomingdir'} . "/$a" } (@files);
}
# Queue files
my $queue_count = 0;
foreach my $file_name (@files) {
if ($queue_count > $pa_config->{"max_queue_files"}) {