mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Added support for loading .enc files for XML::Parser.
(cherry picked from commit 11e1f5eb1f41f6162d3464abda74c15b2cb733fa)
This commit is contained in:
parent
ddf4366017
commit
f81af8b437
@ -426,6 +426,9 @@ sub pandora_load_config {
|
|||||||
$pa_config->{"warmup_unknown_on"} = 1; # 6.1
|
$pa_config->{"warmup_unknown_on"} = 1; # 6.1
|
||||||
|
|
||||||
#$pa_config->{'include_agents'} = 0; #6.1
|
#$pa_config->{'include_agents'} = 0; #6.1
|
||||||
|
#
|
||||||
|
# External .enc files for XML::Parser.
|
||||||
|
$pa_config->{"enc_dir"} = ""; # > 6.0SP4
|
||||||
|
|
||||||
# Check for UID0
|
# Check for UID0
|
||||||
if ($pa_config->{"quiet"} != 0){
|
if ($pa_config->{"quiet"} != 0){
|
||||||
@ -956,6 +959,9 @@ sub pandora_load_config {
|
|||||||
#elsif ($parametro =~ m/^include_agents\s+([0-1])/i) {
|
#elsif ($parametro =~ m/^include_agents\s+([0-1])/i) {
|
||||||
# $pa_config->{'include_agents'}= clean_blank($1);
|
# $pa_config->{'include_agents'}= clean_blank($1);
|
||||||
#}
|
#}
|
||||||
|
elsif ($parametro =~ m/^enc_dir\s+(.*)/i) {
|
||||||
|
$pa_config->{'enc_dir'} = clean_blank($1);
|
||||||
|
}
|
||||||
} # end of loop for parameter #
|
} # end of loop for parameter #
|
||||||
|
|
||||||
# Set to RDBMS' standard port
|
# Set to RDBMS' standard port
|
||||||
|
@ -25,6 +25,7 @@ use threads::shared;
|
|||||||
use Thread::Semaphore;
|
use Thread::Semaphore;
|
||||||
|
|
||||||
use Time::Local;
|
use Time::Local;
|
||||||
|
use XML::Parser::Expat;
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
use POSIX qw(setsid strftime);
|
use POSIX qw(setsid strftime);
|
||||||
|
|
||||||
@ -71,6 +72,29 @@ sub new ($$;$) {
|
|||||||
# Call the constructor of the parent class
|
# Call the constructor of the parent class
|
||||||
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
|
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
|
||||||
|
|
||||||
|
# Load external .enc files for XML::Parser.
|
||||||
|
if ($config->{'enc_dir'} ne '') {
|
||||||
|
if (opendir(my $dh, $config->{'enc_dir'})) {
|
||||||
|
while (my $enc_file = readdir($dh)) {
|
||||||
|
|
||||||
|
# Ignore unknown files.
|
||||||
|
next unless ($enc_file =~ m/.enc$/);
|
||||||
|
|
||||||
|
# Load the .enc file.
|
||||||
|
eval {
|
||||||
|
local $SIG{__DIE__} = {};
|
||||||
|
XML::Parser::Expat::load_encoding($config->{'enc_dir'} . '/' . $enc_file);
|
||||||
|
};
|
||||||
|
if ($@) {
|
||||||
|
print_message ($config, " [WARNING] Error loading encoding file: $enc_file", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dh);
|
||||||
|
} else {
|
||||||
|
print_message($config, " [WARNING] Error opening directory " . $config->{'enc_dir'} . ": $!", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user