From 9d70802083b64cec2e3c276dc541beea2858ec07 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 12 Sep 2023 10:49:02 +0200 Subject: [PATCH 1/2] Fix counters tactical view pandora_enterprise#12033 --- pandora_server/lib/PandoraFMS/Core.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index cbb4ea851e..eac182781e 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -5687,7 +5687,7 @@ sub pandora_server_statistics ($$) { $server->{"modules_total"} = get_db_value ($dbh, "SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) FROM tagente, tagent_module_inventory WHERE tagente.disabled=0 AND tagent_module_inventory.id_agente = tagente.id_agente"); # Calculate lag - $lag_row = get_db_single_row ($dbh, "SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - tagent_module_inventory.interval) AS lag + $lag_row = get_db_single_row ($dbh, "SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) AS `module_lag`, AVG(UNIX_TIMESTAMP() - utimestamp - tagent_module_inventory.interval) AS `lag` FROM tagente, tagent_module_inventory WHERE utimestamp > 0 AND tagent_module_inventory.id_agente = tagente.id_agente @@ -5736,8 +5736,8 @@ sub pandora_server_statistics ($$) { if ($server->{"server_type"} != DATASERVER){ $lag_row = get_db_single_row ( $dbh, - "SELECT COUNT(tam.id_agente_modulo) AS module_lag, - AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag + "SELECT COUNT(tam.id_agente_modulo) AS `module_lag`, + AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS `lag` FROM ( SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo FROM tagente_estado @@ -5762,8 +5762,8 @@ sub pandora_server_statistics ($$) { else { $lag_row = get_db_single_row ( $dbh, - "SELECT COUNT(tam.id_agente_modulo) AS module_lag, - AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag + "SELECT COUNT(tam.id_agente_modulo) AS `module_lag`, + AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS `lag` FROM ( SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo FROM tagente_estado From e2cf8de7a9002ef958f614ab3106c92bce0ae4f0 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 13 Sep 2023 14:15:07 +0200 Subject: [PATCH 2/2] fixed errors pandora_enterprise#12035 --- pandora_console/include/functions_servers.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index e4d1f655b0..3a4273efa4 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -283,6 +283,10 @@ function servers_get_performance($filter=[]) } foreach ($counts as $c) { + if (empty($c['modules']) === true) { + continue; + } + switch ($c['server_type']) { case SERVER_TYPE_DATA: $data['total_local_modules'] = $c['modules']; @@ -292,7 +296,7 @@ function servers_get_performance($filter=[]) case SERVER_TYPE_SNMP: case SERVER_TYPE_ENTERPRISE_ICMP: case SERVER_TYPE_ENTERPRISE_SNMP: - $data['total_network_modules'] = $c['modules']; + $data['total_network_modules'] += $c['modules']; break; case SERVER_TYPE_PLUGIN: