Fixed a bug that non-master servers had stopped log rotation.

This commit is contained in:
Hirofumi Kosaka 2017-03-07 17:58:25 +09:00
parent 7ecfe679ea
commit b0d8216965

View File

@ -284,18 +284,15 @@ sub pandora_server_tasks ($) {
# TASKS EXECUTED EVERY 5 SECONDS (Low latency tasks) # TASKS EXECUTED EVERY 5 SECONDS (Low latency tasks)
# -------------------------------------------------- # --------------------------------------------------
if (($counter % 5) == 0) { if (($counter % 5) == 0) {
# Update forced alerts # Update forced alerts
pandora_exec_forced_alerts ($pa_config, $dbh); pandora_exec_forced_alerts ($pa_config, $dbh);
# Rotate Log File
pandora_rotate_logfile($pa_config);
} }
# TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks) # TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks)
# --------------------------------------------------- # ---------------------------------------------------
if (($counter % 30) == 0) { if (($counter % 30) == 0) {
# Update module status and fired alert counts # Update module status and fired alert counts
my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count FROM tagente WHERE disabled = 0 AND (update_module_count=1 OR update_alert_count=1)'); my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count FROM tagente WHERE disabled = 0 AND (update_module_count=1 OR update_alert_count=1)');
foreach my $agent (@agents) { foreach my $agent (@agents) {
@ -351,16 +348,22 @@ sub pandora_server_tasks ($) {
db_do ($dbh, 'UPDATE tevento SET estado=1, ack_utimestamp=? WHERE estado=0 AND utimestamp < ? AND utimestamp > ?', $time_ref, $expiry_limit, $expiry_window); db_do ($dbh, 'UPDATE tevento SET estado=1, ack_utimestamp=? WHERE estado=0 AND utimestamp < ? AND utimestamp > ?', $time_ref, $expiry_limit, $expiry_window);
} }
} }
} }
# COMMON TASKS (master and non-master)
# ---------------------------------------------------------------
# Rotate Log File
if (($counter % 30) == 0) {
pandora_rotate_logfile($pa_config);
}
# Pandora self monitoring # Pandora self monitoring
if (defined($pa_config->{"self_monitoring"}) if (defined($pa_config->{"self_monitoring"})
&& $pa_config->{"self_monitoring"} == 1 && $pa_config->{"self_monitoring"} == 1
&& $counter % $pa_config->{'self_monitoring_interval'} == 0) { && $counter % $pa_config->{'self_monitoring_interval'} == 0) {
pandora_self_monitoring ($pa_config, $dbh); pandora_self_monitoring ($pa_config, $dbh);
} }
# Avoid counter overflow # Avoid counter overflow
if ($counter > 10000){ if ($counter > 10000){
$counter = 0; $counter = 0;