mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Fixed a couple of variables that were renamed in Config.pm (caused
trouble with other scripts that read pandora_server.conf).
This commit is contained in:
parent
d05c18b613
commit
0985c1f9df
@ -188,8 +188,8 @@ sub pandora_load_config {
|
|||||||
$pa_config->{"incomingdir"} = "/var/spool/pandora/data_in";
|
$pa_config->{"incomingdir"} = "/var/spool/pandora/data_in";
|
||||||
$pa_config->{"server_threshold"} = 30;
|
$pa_config->{"server_threshold"} = 30;
|
||||||
$pa_config->{"alert_threshold"} = 60;
|
$pa_config->{"alert_threshold"} = 60;
|
||||||
$pa_config->{"logfile"} = "/var/log/pandora_server.log";
|
$pa_config->{"log_file"} = "/var/log/pandora_server.log";
|
||||||
$pa_config->{"errorlogfile"} = "/var/log/pandora_server.error";
|
$pa_config->{"errorlog_file"} = "/var/log/pandora_server.error";
|
||||||
$pa_config->{"networktimeout"} = 5; # By default, not in config file yet
|
$pa_config->{"networktimeout"} = 5; # By default, not in config file yet
|
||||||
$pa_config->{"pandora_master"} = 1; # on by default
|
$pa_config->{"pandora_master"} = 1; # on by default
|
||||||
$pa_config->{"pandora_check"} = 0; # Deprecated since 2.0
|
$pa_config->{"pandora_check"} = 0; # Deprecated since 2.0
|
||||||
@ -205,7 +205,6 @@ sub pandora_load_config {
|
|||||||
$pa_config->{"exportserver"} = 1; # default
|
$pa_config->{"exportserver"} = 1; # default
|
||||||
$pa_config->{"inventoryserver"} = 1; # default
|
$pa_config->{"inventoryserver"} = 1; # default
|
||||||
$pa_config->{"webserver"} = 1; # 3.0
|
$pa_config->{"webserver"} = 1; # 3.0
|
||||||
$pa_config->{"servermode"} = "";
|
|
||||||
$pa_config->{'snmp_logfile'} = "/var/log/pandora_snmptrap.log";
|
$pa_config->{'snmp_logfile'} = "/var/log/pandora_snmptrap.log";
|
||||||
$pa_config->{"network_threads"} = 3; # Fixed default
|
$pa_config->{"network_threads"} = 3; # Fixed default
|
||||||
$pa_config->{"keepalive"} = 60; # 60 Seconds initially for server keepalive
|
$pa_config->{"keepalive"} = 60; # 60 Seconds initially for server keepalive
|
||||||
@ -462,18 +461,18 @@ sub pandora_load_config {
|
|||||||
elsif ($parametro =~ m/^log_file\s(.*)/i) {
|
elsif ($parametro =~ m/^log_file\s(.*)/i) {
|
||||||
$tbuf= clean_blank($1);
|
$tbuf= clean_blank($1);
|
||||||
if ($tbuf =~ m/^\.(.*)/){
|
if ($tbuf =~ m/^\.(.*)/){
|
||||||
$pa_config->{"logfile"} = $pa_config->{"basepath"}.$1;
|
$pa_config->{"log_file"} = $pa_config->{"basepath"}.$1;
|
||||||
} else {
|
} else {
|
||||||
$pa_config->{"logfile"} = $tbuf;
|
$pa_config->{"log_file"} = $tbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($parametro =~ m/^errorlog_file\s(.*)/i) {
|
elsif ($parametro =~ m/^errorlog_file\s(.*)/i) {
|
||||||
$tbuf= clean_blank($1);
|
$tbuf= clean_blank($1);
|
||||||
if ($tbuf =~ m/^\.(.*)/){
|
if ($tbuf =~ m/^\.(.*)/){
|
||||||
$pa_config->{"errorlogfile"} = $pa_config->{"basepath"}.$1;
|
$pa_config->{"errorlog_file"} = $pa_config->{"basepath"}.$1;
|
||||||
} else {
|
} else {
|
||||||
$pa_config->{"errorlogfile"} = $tbuf;
|
$pa_config->{"errorlog_file"} = $tbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,14 +905,14 @@ sub pandora_load_config {
|
|||||||
print " [*] PID File is written at ".$pa_config->{'PID'}."\n";
|
print " [*] PID File is written at ".$pa_config->{'PID'}."\n";
|
||||||
}
|
}
|
||||||
print " [*] Server basepath is ".$pa_config->{'basepath'}."\n";
|
print " [*] Server basepath is ".$pa_config->{'basepath'}."\n";
|
||||||
print " [*] Server logfile at ".$pa_config->{"logfile"}."\n";
|
print " [*] Server logfile at ".$pa_config->{"log_file"}."\n";
|
||||||
print " [*] Server errorlogfile at ".$pa_config->{"errorlogfile"}."\n";
|
print " [*] Server errorlogfile at ".$pa_config->{"errorlog_file"}."\n";
|
||||||
print " [*] Server incoming directory at ".$pa_config->{"incomingdir"}."\n";
|
print " [*] Server incoming directory at ".$pa_config->{"incomingdir"}."\n";
|
||||||
print " [*] Server keepalive ".$pa_config->{"keepalive"}."\n";
|
print " [*] Server keepalive ".$pa_config->{"keepalive"}."\n";
|
||||||
print " [*] Server threshold ".$pa_config->{"server_threshold"}."\n";
|
print " [*] Server threshold ".$pa_config->{"server_threshold"}."\n";
|
||||||
}
|
}
|
||||||
# Check for valid token token values
|
# Check for valid token token values
|
||||||
if (( $pa_config->{"dbuser"} eq "" ) || ( $pa_config->{"basepath"} eq "" ) || ( $pa_config->{"incomingdir"} eq "" ) || ( $pa_config->{"logfile"} eq "" ) || ( $pa_config->{"dbhost"} eq "") || ( $pa_config->{"pandora_master"} eq "") || ( $pa_config->{"dbpass"} eq "" ) ) {
|
if (( $pa_config->{"dbuser"} eq "" ) || ( $pa_config->{"basepath"} eq "" ) || ( $pa_config->{"incomingdir"} eq "" ) || ( $pa_config->{"log_file"} eq "" ) || ( $pa_config->{"dbhost"} eq "") || ( $pa_config->{"pandora_master"} eq "") || ( $pa_config->{"dbpass"} eq "" ) ) {
|
||||||
print " [ERROR] Bad Config values. Be sure that $archivo_cfg is a valid setup file. \n\n";
|
print " [ERROR] Bad Config values. Be sure that $archivo_cfg is a valid setup file. \n\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -928,7 +927,7 @@ sub pandora_load_config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger ($pa_config, "Launching $pa_config->{'version'} $pa_config->{'build'}", 1);
|
logger ($pa_config, "Launching $pa_config->{'version'} $pa_config->{'build'}", 1);
|
||||||
my $config_options = "Logfile at ".$pa_config->{"logfile"}.", Basepath is ".$pa_config->{"basepath"}.", Checksum is ".$pa_config->{"pandora_check"}.", Master is ".$pa_config->{"pandora_master"}.", SNMP Console is ".$pa_config->{"snmpconsole"}.", Server Threshold at ".$pa_config->{"server_threshold"}." sec, verbosity at ".$pa_config->{"verbosity"}.", Alert Threshold at $pa_config->{'alert_threshold'}, ServerName is '".$pa_config->{'servername'}.$pa_config->{"servermode"}."'";
|
my $config_options = "Logfile at ".$pa_config->{"log_file"}.", Basepath is ".$pa_config->{"basepath"}.", Checksum is ".$pa_config->{"pandora_check"}.", Master is ".$pa_config->{"pandora_master"}.", SNMP Console is ".$pa_config->{"snmpconsole"}.", Server Threshold at ".$pa_config->{"server_threshold"}." sec, verbosity at ".$pa_config->{"verbosity"}.", Alert Threshold at $pa_config->{'alert_threshold'}, ServerName is '".$pa_config->{'servername'}."'";
|
||||||
logger ($pa_config, "Config options: $config_options", 1);
|
logger ($pa_config, "Config options: $config_options", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -940,8 +939,8 @@ sub pandora_start_log ($){
|
|||||||
my $pa_config = shift;
|
my $pa_config = shift;
|
||||||
|
|
||||||
# Dump all errors to errorlog
|
# Dump all errors to errorlog
|
||||||
open (STDERR, ">> " . $pa_config->{'errorlogfile'}) or die " [ERROR] Pandora FMS can't write to Errorlog. Aborting : \n $! \n";
|
open (STDERR, ">> " . $pa_config->{'errorlog_file'}) or die " [ERROR] Pandora FMS can't write to Errorlog. Aborting : \n $! \n";
|
||||||
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $pa_config->{'servername'} . $pa_config->{'servermode'} . " Starting Pandora FMS Server. Error logging activated.\n";
|
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $pa_config->{'servername'} . " Starting Pandora FMS Server. Error logging activated.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -466,13 +466,13 @@ sub logger ($$;$) {
|
|||||||
$level = 1 unless defined ($level);
|
$level = 1 unless defined ($level);
|
||||||
return if ($level > $pa_config->{'verbosity'});
|
return if ($level > $pa_config->{'verbosity'});
|
||||||
|
|
||||||
if (!defined($pa_config->{'logfile'})) {
|
if (!defined($pa_config->{'log_file'})) {
|
||||||
print strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " [V". $level ."] " . $message . "\n";
|
print strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " [V". $level ."] " . $message . "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the log file (can be a regular file or 'syslog')
|
# Get the log file (can be a regular file or 'syslog')
|
||||||
my $file = $pa_config->{'logfile'};
|
my $file = $pa_config->{'log_file'};
|
||||||
|
|
||||||
# Syslog
|
# Syslog
|
||||||
if ($file eq 'syslog') {
|
if ($file eq 'syslog') {
|
||||||
@ -492,7 +492,7 @@ sub logger ($$;$) {
|
|||||||
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
|
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
|
||||||
# Get an exclusive lock on the file (LOCK_EX)
|
# Get an exclusive lock on the file (LOCK_EX)
|
||||||
flock (FILE, 2);
|
flock (FILE, 2);
|
||||||
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . $pa_config->{'servername'} . $pa_config->{'servermode'} . " [V". $level ."] " . $message . "\n";
|
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . $pa_config->{'servername'} . " [V". $level ."] " . $message . "\n";
|
||||||
close (FILE);
|
close (FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ sub logger ($$;$) {
|
|||||||
sub pandora_rotate_logfile ($) {
|
sub pandora_rotate_logfile ($) {
|
||||||
my ($pa_config) = @_;
|
my ($pa_config) = @_;
|
||||||
|
|
||||||
my $file = $pa_config->{'logfile'};
|
my $file = $pa_config->{'log_file'};
|
||||||
|
|
||||||
# Log File Rotation
|
# Log File Rotation
|
||||||
if ($file ne 'syslog' && -e $file && (stat($file))[7] > $pa_config->{'max_log_size'}) {
|
if ($file ne 'syslog' && -e $file && (stat($file))[7] > $pa_config->{'max_log_size'}) {
|
||||||
@ -592,7 +592,11 @@ sub enterprise_load ($) {
|
|||||||
|
|
||||||
# Ops
|
# Ops
|
||||||
if ($@) {
|
if ($@) {
|
||||||
open (STDERR, ">> " . $pa_config->{'errorlogfile'});
|
|
||||||
|
# Enterprise.pm not found.
|
||||||
|
return 0 if ($@ =~ m/PandoraFMS\/Enterprise\.pm.*\@INC/);
|
||||||
|
|
||||||
|
open (STDERR, ">> " . $pa_config->{'errorlog_file'});
|
||||||
print STDERR $@;
|
print STDERR $@;
|
||||||
close (STDERR);
|
close (STDERR);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -59,9 +59,8 @@ my $history_dbh = ($conf{'_history_db_enabled'} eq '1') ? db_connect ('mysql', $
|
|||||||
|
|
||||||
$conf{'activate_gis'}=0;
|
$conf{'activate_gis'}=0;
|
||||||
$conf{'max_log_size'}=1000;
|
$conf{'max_log_size'}=1000;
|
||||||
$conf{'logfile'}="/dev/null";
|
$conf{'log_file'}="/dev/null";
|
||||||
$conf{'servername'}="performance";
|
$conf{'servername'}="performance";
|
||||||
$conf{'servermode'}="";
|
|
||||||
$conf{'event_auto_validation'}=1;
|
$conf{'event_auto_validation'}=1;
|
||||||
|
|
||||||
pandora_speedtest_main (\%conf, $dbh, $history_dbh);
|
pandora_speedtest_main (\%conf, $dbh, $history_dbh);
|
||||||
|
@ -3302,7 +3302,7 @@ sub cli_get_bad_conf_files() {
|
|||||||
foreach my $file (@files) {
|
foreach my $file (@files) {
|
||||||
# Check important tokens
|
# Check important tokens
|
||||||
my $missings = 0;
|
my $missings = 0;
|
||||||
my @tokens = ("server_ip","server_path","temporal","logfile");
|
my @tokens = ("server_ip","server_path","temporal","log_file");
|
||||||
|
|
||||||
foreach my $token (@tokens) {
|
foreach my $token (@tokens) {
|
||||||
if(enterprise_hook('pandora_check_conf_token',[$conf->{incomingdir}.'/conf/'.$file, $token]) == 0) {
|
if(enterprise_hook('pandora_check_conf_token',[$conf->{incomingdir}.'/conf/'.$file, $token]) == 0) {
|
||||||
|
@ -547,6 +547,11 @@ sub log_message ($$) {
|
|||||||
my $utimestamp = time ();
|
my $utimestamp = time ();
|
||||||
|
|
||||||
my $log_file = get_conf_token ($conf, 'log_file', '');
|
my $log_file = get_conf_token ($conf, 'log_file', '');
|
||||||
|
|
||||||
|
# Added for backward compatibility.
|
||||||
|
if ($log_file eq '') {
|
||||||
|
$log_file = get_conf_token ($conf, 'logfile', '');
|
||||||
|
}
|
||||||
|
|
||||||
# Log to stdout
|
# Log to stdout
|
||||||
if ($log_file eq '') {
|
if ($log_file eq '') {
|
||||||
@ -839,7 +844,7 @@ module_end\n";
|
|||||||
server_ip " . get_conf_token ($conf, 'server_ip', 'localhost') . "
|
server_ip " . get_conf_token ($conf, 'server_ip', 'localhost') . "
|
||||||
server_path /var/spool/pandora/data_in
|
server_path /var/spool/pandora/data_in
|
||||||
temporal /tmp
|
temporal /tmp
|
||||||
logfile /var/log/pandora/pandora_agent.log
|
log_file /var/log/pandora/pandora_agent.log
|
||||||
|
|
||||||
# Interval in seconds, 300 by default
|
# Interval in seconds, 300 by default
|
||||||
interval $interval
|
interval $interval
|
||||||
|
@ -110,18 +110,18 @@ sub load_config {
|
|||||||
elsif ($parametro =~ m/^log_file\s(.*)/i) {
|
elsif ($parametro =~ m/^log_file\s(.*)/i) {
|
||||||
$tbuf= clean_blank($1);
|
$tbuf= clean_blank($1);
|
||||||
if ($tbuf =~ m/^\.(.*)/){
|
if ($tbuf =~ m/^\.(.*)/){
|
||||||
$pa_config->{"logfile"} = $pa_config->{"basepath"}.$1;
|
$pa_config->{"log_file"} = $pa_config->{"basepath"}.$1;
|
||||||
} else {
|
} else {
|
||||||
$pa_config->{"logfile"} = $tbuf;
|
$pa_config->{"log_file"} = $tbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($parametro =~ m/^errorlog_file\s(.*)/i) {
|
elsif ($parametro =~ m/^errorlog_file\s(.*)/i) {
|
||||||
$tbuf= clean_blank($1);
|
$tbuf= clean_blank($1);
|
||||||
if ($tbuf =~ m/^\.(.*)/){
|
if ($tbuf =~ m/^\.(.*)/){
|
||||||
$pa_config->{"errorlogfile"} = $pa_config->{"basepath"}.$1;
|
$pa_config->{"errorlog_file"} = $pa_config->{"basepath"}.$1;
|
||||||
} else {
|
} else {
|
||||||
$pa_config->{"errorlogfile"} = $tbuf;
|
$pa_config->{"errorlog_file"} = $tbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,18 +119,18 @@ sub load_config {
|
|||||||
elsif ($parametro =~ m/^log_file\s(.*)/i) {
|
elsif ($parametro =~ m/^log_file\s(.*)/i) {
|
||||||
$tbuf= clean_blank($1);
|
$tbuf= clean_blank($1);
|
||||||
if ($tbuf =~ m/^\.(.*)/){
|
if ($tbuf =~ m/^\.(.*)/){
|
||||||
$pa_config->{"logfile"} = $pa_config->{"basepath"}.$1;
|
$pa_config->{"log_file"} = $pa_config->{"basepath"}.$1;
|
||||||
} else {
|
} else {
|
||||||
$pa_config->{"logfile"} = $tbuf;
|
$pa_config->{"log_file"} = $tbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($parametro =~ m/^errorlog_file\s(.*)/i) {
|
elsif ($parametro =~ m/^errorlog_file\s(.*)/i) {
|
||||||
$tbuf= clean_blank($1);
|
$tbuf= clean_blank($1);
|
||||||
if ($tbuf =~ m/^\.(.*)/){
|
if ($tbuf =~ m/^\.(.*)/){
|
||||||
$pa_config->{"errorlogfile"} = $pa_config->{"basepath"}.$1;
|
$pa_config->{"errorlog_file"} = $pa_config->{"basepath"}.$1;
|
||||||
} else {
|
} else {
|
||||||
$pa_config->{"errorlogfile"} = $tbuf;
|
$pa_config->{"errorlog_file"} = $tbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user