Re-read the configuration from the DB periodically.

This commit is contained in:
Ramon Novoa 2019-09-11 09:25:40 +02:00
parent 33d9ce9de8
commit 39d5285720
3 changed files with 9 additions and 5 deletions

View File

@ -365,9 +365,11 @@ sub pandora_server_tasks ($) {
# COMMON TASKS (master and non-master)
# ---------------------------------------------------------------
# Rotate Log File
if (($counter % 30) == 0) {
# Update configuration options from the console.
pandora_get_sharedconfig ($pa_config, $dbh);
# Rotate the log file.
pandora_rotate_logfile($pa_config);
# Set event storm protection

View File

@ -189,7 +189,7 @@ sub pandora_get_sharedconfig ($$) {
$pa_config->{'rb_product_name'} = 'Pandora FMS' unless (defined ($pa_config->{'rb_product_name'}) && $pa_config->{'rb_product_name'} ne '');
# Mail transport agent configuration. Local configuration takes precedence.
if ($pa_config->{"mta_address"} eq '') {
if ($pa_config->{"mta_local"} eq 0) {
$pa_config->{"mta_address"} = pandora_get_tconfig_token ($dbh, 'email_smtpServer', '');
$pa_config->{"mta_from"} = '"' . pandora_get_tconfig_token ($dbh, 'email_from_name', 'Pandora FMS') . '" <' .
pandora_get_tconfig_token ($dbh, 'email_from_dir', 'pandora@pandorafms.org') . '>';
@ -336,7 +336,8 @@ sub pandora_load_config {
$pa_config->{"mta_pass"} = ''; # Introduced on 2.0
$pa_config->{"mta_auth"} = 'none'; # Introduced on 2.0 (Support LOGIN PLAIN CRAM-MD5 DIGEST-MD)
$pa_config->{"mta_from"} = 'pandora@localhost'; # Introduced on 2.0
$pa_config->{"mta_encryption"} = 'none';
$pa_config->{"mta_encryption"} = 'none'; # 7.0 739
$pa_config->{"mta_local"} = 0; # 7.0 739
$pa_config->{"mail_in_separate"} = 1; # 1: eMail deliver alert mail in separate mails.
# 0: eMail deliver 1 mail with all destination.
@ -610,6 +611,7 @@ sub pandora_load_config {
}
elsif ($parametro =~ m/^mta_address\s(.*)/i) {
$pa_config->{'mta_address'}= clean_blank($1);
$pa_config->{'mta_local'}=1;
}
elsif ($parametro =~ m/^mta_port\s(.*)/i) {
$pa_config->{'mta_port'}= clean_blank($1);

View File

@ -278,7 +278,7 @@ sub sendmail {
}
$smtp = $mail{'Smtp'} || $mail{'Server'};
unshift @{$mailcfg{'smtp'}}, $smtp if ($smtp and $mailcfg{'smtp'}->[0] ne $smtp);
$mailcfg{'smtp'}->[0] = $smtp if ($smtp and $mailcfg{'smtp'}->[0] ne $smtp);
$encryption = $mail{'Encryption'} || $mail{'Encryption'};