Skip to content

Commit

Permalink
[Monitoring] Use the cluster name from metadata if it exists (#24495)
Browse files Browse the repository at this point in the history
* Use the cluster name from metadata if it exists

* PR comments
  • Loading branch information
chrisronline authored Oct 29, 2018
1 parent 1018947 commit 460a297
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Array [
"totalEvents": null,
},
"ccs": "proddy1",
"cluster_name": "proddy1",
"cluster_name": "Custom name",
"cluster_uuid": "fOt6KT9KTICAMm2ncRhsMg",
"elasticsearch": Object {
"cluster_stats": Object {
Expand Down Expand Up @@ -227,7 +227,7 @@ Array [
"totalEvents": null,
},
"ccs": "proddy1",
"cluster_name": "proddy1",
"cluster_name": "Custom name",
"cluster_uuid": "fOt6KT9KTICAMm2ncRhsMg",
"elasticsearch": Object {
"cluster_stats": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@
}
}
},
"cluster_settings": {
"cluster": {
"metadata": {
"display_name": "Custom name"
}
}
},
"isSupported": true,
"alerts": {
"alertsMeta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
* 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) {
return clusters.map(cluster => {
const {
isSupported,
cluster_uuid: clusterUuid,
cluster_name: clusterName,
version,
license,
cluster_stats: clusterStats,
Expand All @@ -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,
Expand Down

0 comments on commit 460a297

Please sign in to comment.