From 16d0e7057c45441ae6d9e3548b3d88edfb8f4280 Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 29 Mar 2023 14:31:34 +0200 Subject: [PATCH 1/2] Excluded manual discovery tasks from server lag calculation --- pandora_console/include/functions_servers.php | 2 ++ pandora_server/lib/PandoraFMS/Core.pm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index a58342dddb..bdf5c8026e 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -983,12 +983,14 @@ function servers_get_info($id_server=-1) 'SELECT UNIX_TIMESTAMP() - utimestamp FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) + AND interval_sweep > 0 AND id_recon_server = '.$server['id_server'] ); $server['module_lag'] = db_get_sql( 'SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) + AND interval_sweep > 0 AND id_recon_server = '.$server['id_server'] ); } else { diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 4726df4710..76f104ab7f 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -5639,9 +5639,9 @@ sub pandora_server_statistics ($$) { # Lag (take average active time of all active tasks) - $server->{"lag"} = get_db_value ($dbh, "SELECT UNIX_TIMESTAMP() - utimestamp from trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ?", $server->{"id_server"}); + $server->{"lag"} = get_db_value ($dbh, "SELECT UNIX_TIMESTAMP() - utimestamp from trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND interval_sweep > 0 AND id_recon_server = ?", $server->{"id_server"}); - $server->{"module_lag"} = get_db_value ($dbh, "SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ?", $server->{"id_server"}); + $server->{"module_lag"} = get_db_value ($dbh, "SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND interval_sweep AND id_recon_server = ?", $server->{"id_server"}); } else { From 8976a4734c11d1d75af47b1ca7674cd770ec4d78 Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 29 Mar 2023 14:33:15 +0200 Subject: [PATCH 2/2] Excluded manual discovery tasks from server lag calculation --- pandora_server/lib/PandoraFMS/Core.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 76f104ab7f..9291cee365 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -5641,7 +5641,7 @@ sub pandora_server_statistics ($$) { $server->{"lag"} = get_db_value ($dbh, "SELECT UNIX_TIMESTAMP() - utimestamp from trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND interval_sweep > 0 AND id_recon_server = ?", $server->{"id_server"}); - $server->{"module_lag"} = get_db_value ($dbh, "SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND interval_sweep AND id_recon_server = ?", $server->{"id_server"}); + $server->{"module_lag"} = get_db_value ($dbh, "SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND interval_sweep > 0 AND id_recon_server = ?", $server->{"id_server"}); } else {