mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
Do not delete collections if a broker is configured.
This commit is contained in:
parent
b26aa1baf7
commit
a10f2a6d2e
@ -111,6 +111,9 @@ my $ConfDir = '';
|
|||||||
# Pandora FMS agent configuration file
|
# Pandora FMS agent configuration file
|
||||||
my $ConfFile = 'pandora_agent.conf';
|
my $ConfFile = 'pandora_agent.conf';
|
||||||
|
|
||||||
|
# Set to 1 if broker agents are enabled.
|
||||||
|
my $BrokerEnabled = 0;
|
||||||
|
|
||||||
# Broker agent configuration files
|
# Broker agent configuration files
|
||||||
my @BrokerPid;
|
my @BrokerPid;
|
||||||
|
|
||||||
@ -674,6 +677,11 @@ sub read_config (;$) {
|
|||||||
log_message ('setup', "$1 is $2");
|
log_message ('setup', "$1 is $2");
|
||||||
$Conf{$1} = $2;
|
$Conf{$1} = $2;
|
||||||
|
|
||||||
|
# Look for broker agents.
|
||||||
|
if ($1 eq 'broker_agent') {
|
||||||
|
$BrokerEnabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
# Remove trailing spaces
|
# Remove trailing spaces
|
||||||
$Conf{$1} =~ s/\s*$//;
|
$Conf{$1} =~ s/\s*$//;
|
||||||
}
|
}
|
||||||
@ -963,7 +971,8 @@ sub launch_tentacle_proxy () {
|
|||||||
################################################################################
|
################################################################################
|
||||||
sub check_collections () {
|
sub check_collections () {
|
||||||
|
|
||||||
# Delete old collections
|
# Delete old collections if there are no broker agents
|
||||||
|
if ($BrokerEnabled == 0) {
|
||||||
opendir (DIR, "$ConfDir/collections") || return;
|
opendir (DIR, "$ConfDir/collections") || return;
|
||||||
while (defined (my $file_name = readdir(DIR))) {
|
while (defined (my $file_name = readdir(DIR))) {
|
||||||
next if ($file_name eq '.' || $file_name eq '..');
|
next if ($file_name eq '.' || $file_name eq '..');
|
||||||
@ -977,6 +986,7 @@ sub check_collections () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir (DIR);
|
closedir (DIR);
|
||||||
|
}
|
||||||
|
|
||||||
# Download new collections
|
# Download new collections
|
||||||
while (my ($collection, $in_path) = each (%Collections)) {
|
while (my ($collection, $in_path) = each (%Collections)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user