diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 35b994fead..e2573bd859 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -54,7 +54,7 @@ echo sprintf('
', $menuTypeClass); // ======= Servers List =============================================== if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { $servers = []; - $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); + $servers['all'] = (int) count((servers_get_info() ?? [])); if ($servers['all'] != 0) { $servers['up'] = (int) servers_check_status(); $servers['down'] = ($servers['all'] - $servers['up']); diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 08fc1922cd..d3780dcd39 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -1510,17 +1510,35 @@ class ConsoleSupervisor { global $config; + $types_sql = ''; + if (is_metaconsole() === true && isset($config['ndbh']) === false) { + $types_sql = sprintf( + ' AND ( + `server_type` = %d OR + `server_type` = %d OR + `server_type` = %d OR + `server_type` = %d + )', + SERVER_TYPE_AUTOPROVISION, + SERVER_TYPE_EVENT, + SERVER_TYPE_MIGRATION, + SERVER_TYPE_PREDICTION + ); + } + $servers = db_get_all_rows_sql( - 'SELECT - id_server, - name, - server_type, - server_keepalive, - status, - unix_timestamp() - unix_timestamp(keepalive) as downtime - FROM tserver - WHERE - unix_timestamp() - unix_timestamp(keepalive) > server_keepalive' + sprintf( + 'SELECT id_server, + `name`, + server_type, + server_keepalive, + `status`, + unix_timestamp() - unix_timestamp(keepalive) as downtime + FROM tserver + WHERE unix_timestamp() - unix_timestamp(keepalive) > server_keepalive + %s', + $types_sql + ) ); if ($servers === false) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 7534cb5e23..5108484aaa 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -12546,7 +12546,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru $table_ind = html_get_predefined_table(); $servers = []; - $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); + $servers['all'] = (int) count((servers_get_info() ?? [])); $servers['up'] = (int) servers_check_status(); $servers['down'] = ($servers['all'] - $servers['up']); if ($servers['all'] == 0) { @@ -12607,7 +12607,7 @@ function reporting_get_stats_indicators_mobile($data, $width=280, $height=20, $h $table_ind = html_get_predefined_table(); $servers = []; - $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); + $servers['all'] = (int) count((servers_get_info() ?? [])); $servers['up'] = (int) servers_check_status(); $servers['down'] = ($servers['all'] - $servers['up']); if ($servers['all'] == 0) {