Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stack Monitoring] Fix displaying ES version for external collection #131194

Merged
merged 8 commits into from
May 16, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ElasticsearchModifiedSource,
ElasticsearchLegacySource,
ElasticsearchSourceKibanaStats,
ElasticsearchMetricbeatSource,
} from '../../../common/types/es';
// @ts-ignore
import { calculateOverallStatus } from '../calculate_overall_status';
Expand Down Expand Up @@ -47,7 +48,7 @@ export function getClustersSummary(
} = cluster;

const license = cluster.license || cluster.elasticsearch?.cluster?.stats?.license;
const version = cluster.version || cluster.elasticsearch?.version;
const version = cluster.version || ecsFormatVersion(cluster);
const clusterUuid = cluster.cluster_uuid || cluster.elasticsearch?.cluster?.id;
const clusterStatsLegacy = cluster.cluster_stats;
const clusterStatsMB = cluster.elasticsearch?.cluster?.stats;
Expand Down Expand Up @@ -161,3 +162,9 @@ export function getClustersSummary(
};
});
}

function ecsFormatVersion(cluster: ElasticsearchMetricbeatSource) {
const versions = cluster.elasticsearch?.cluster?.stats?.nodes?.versions || [];
const sortedVersions = [...versions].sort().reverse();
return sortedVersions.join('/');
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"cluster_uuid": "__standalone_cluster__",
"version": "",
"license": {},
"elasticsearch": {
"cluster_stats": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
{
"isSupported": true,
"cluster_uuid": "__standalone_cluster__",
"version": "",
"license": {},
"elasticsearch": {
"cluster_stats": {
Expand Down