diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index 6660a19f10..7f1a587b65 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -534,9 +534,10 @@ function planned_downtimes_migrate_malformed_downtimes_copy_items($original_down /** * Stop a planned downtime. * - * @param array Planned downtime data. + * @param array $downtime Planned downtime data. * - * @return mixes False on error or an array with the result and a message of the operation. + * @return mixed False on error or an array with the result and a message of + * the operation. */ function planned_downtimes_stop($downtime) { @@ -566,7 +567,9 @@ function planned_downtimes_stop($downtime) case 'periodically': return false; - break; + default: + // Nothing to do. + break; } $message .= ui_print_result_message( @@ -593,7 +596,7 @@ function planned_downtimes_stop($downtime) true ); - // Reenabled the Agents or Modules or alerts...depends of type + // Reenabled the Agents or Modules or alerts...depends of type. switch ($downtime['type_downtime']) { case 'quiet': $agents = db_get_all_rows_filter( @@ -658,7 +661,10 @@ function planned_downtimes_stop($downtime) foreach ($agents as $agent) { $result = db_process_sql_update( 'tagente', - ['disabled' => 0], + [ + 'disabled' => 0, + 'update_module_count' => 1, + ], ['id_agente' => $agent['id_agent']] ); @@ -702,6 +708,10 @@ function planned_downtimes_stop($downtime) } } break; + + default: + // Nothing to do. + break; } $message .= ui_print_info_message( diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index 53265cb0a0..bb177be783 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -306,7 +306,7 @@ sub pandora_server_tasks ($) { if (($counter % 30) == 0) { # Update module status and fired alert counts - my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count, update_secondary_groups FROM tagente WHERE disabled = 0 AND (update_module_count=1 OR update_alert_count=1 OR update_secondary_groups=1)'); + my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count, update_secondary_groups FROM tagente WHERE (update_module_count=1 OR update_alert_count=1 OR update_secondary_groups=1)'); foreach my $agent (@agents) { logger ($pa_config, "Updating module status and fired alert counts for agent " . $agent->{'nombre'}, 10); diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 4155b2d432..f45731ba13 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1820,7 +1820,8 @@ sub pandora_planned_downtime_set_disabled_elements($$$) { WHERE tp.id_agent = ta.id_agente AND tp.id_downtime = ?',$downtime->{'id'}); db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa - SET ta.disabled = 1 WHERE tpa.id_agent = ta.id_agente AND + SET ta.disabled = 1, ta.update_module_count = 1 + WHERE tpa.id_agent = ta.id_agente AND tpa.id_downtime = ?',$downtime->{'id'}); } else { @@ -1857,7 +1858,8 @@ sub pandora_planned_downtime_unset_disabled_elements($$$) { if ($only_alerts == 0) { db_do($dbh,'UPDATE tagente ta, tplanned_downtime_agents tpa - set ta.disabled = 0 WHERE tpa.id_agent = ta.id_agente AND + set ta.disabled = 0, ta.update_module_count = 1 + WHERE tpa.id_agent = ta.id_agente AND tpa.manually_disabled = 0 AND tpa.id_downtime = ?',$downtime->{'id'}); } else { my @downtime_agents = get_db_rows($dbh, 'SELECT *