diff --git a/x-pack/plugins/monitoring/server/lib/cluster/__test__/__snapshots__/get_clusters_summary.test.js.snap b/x-pack/plugins/monitoring/server/lib/cluster/__test__/__snapshots__/get_clusters_summary.test.js.snap index dac4b1faec42f8..dcfe460dbc4340 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/__test__/__snapshots__/get_clusters_summary.test.js.snap +++ b/x-pack/plugins/monitoring/server/lib/cluster/__test__/__snapshots__/get_clusters_summary.test.js.snap @@ -18,7 +18,7 @@ Array [ "totalEvents": null, }, "ccs": "proddy1", - "cluster_name": "proddy1", + "cluster_name": "Custom name", "cluster_uuid": "fOt6KT9KTICAMm2ncRhsMg", "elasticsearch": Object { "cluster_stats": Object { @@ -227,7 +227,7 @@ Array [ "totalEvents": null, }, "ccs": "proddy1", - "cluster_name": "proddy1", + "cluster_name": "Custom name", "cluster_uuid": "fOt6KT9KTICAMm2ncRhsMg", "elasticsearch": Object { "cluster_stats": Object { diff --git a/x-pack/plugins/monitoring/server/lib/cluster/__test__/fixtures/clusters.json b/x-pack/plugins/monitoring/server/lib/cluster/__test__/fixtures/clusters.json index e6510ab80d90f7..b8ba0a569ad7c8 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/__test__/fixtures/clusters.json +++ b/x-pack/plugins/monitoring/server/lib/cluster/__test__/fixtures/clusters.json @@ -304,6 +304,13 @@ } } }, + "cluster_settings": { + "cluster": { + "metadata": { + "display_name": "Custom name" + } + } + }, "isSupported": true, "alerts": { "alertsMeta": { diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.js b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.js index 46353655868097..272013c6c959b5 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.js +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_stats.js @@ -57,7 +57,8 @@ function fetchClusterStats(req, esIndexPattern, clusterUuid) { 'hits.hits._source.license.expiry_date', 'hits.hits._source.license.expiry_date_in_millis', 'hits.hits._source.cluster_stats', - 'hits.hits._source.cluster_state' + 'hits.hits._source.cluster_state', + 'hits.hits._source.cluster_settings.cluster.metadata.display_name' ], body: { query: createQuery({ type: 'cluster_stats', start, end, metric, clusterUuid }), diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.js b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.js index a4886fbf5ddd79..34fd639ed567b9 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.js +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pick, omit } from 'lodash'; +import { pick, omit, get } from 'lodash'; import { calculateOverallStatus } from '../calculate_overall_status'; export function getClustersSummary(clusters, kibanaUuid) { @@ -12,7 +12,6 @@ export function getClustersSummary(clusters, kibanaUuid) { const { isSupported, cluster_uuid: clusterUuid, - cluster_name: clusterName, version, license, cluster_stats: clusterStats, @@ -22,9 +21,12 @@ export function getClustersSummary(clusters, kibanaUuid) { beats, apm, alerts, - ccs + ccs, + cluster_settings: clusterSettings } = cluster; + const clusterName = get(clusterSettings, 'cluster.metadata.display_name', cluster.cluster_name); + const { status: licenseStatus, type: licenseType,