Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const KibanaInstance = ({ data, alerts }: { data: any; alerts: any }) => {
const showRules =
data.metrics.kibana_instance_rule_executions &&
data.metrics.kibana_instance_rule_executions.length &&
data.metrics.kibana_instance_rule_executions[0].indices_found.metricbeat;
data.metrics.kibana_instance_rule_executions[0].indices_found.ecs;

return (
<EuiPage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const KibanaOverview = ({ data }: { data: any }) => {
const showRules =
data.metrics.kibana_cluster_rule_overdue_count &&
data.metrics.kibana_cluster_rule_overdue_count.length &&
data.metrics.kibana_cluster_rule_overdue_count[0].indices_found.metricbeat;
data.metrics.kibana_cluster_rule_overdue_count[0].indices_found.ecs;

return (
<EuiPage>
Expand Down
12 changes: 8 additions & 4 deletions x-pack/plugins/monitoring/server/lib/details/get_series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
INDEX_PATTERN_TYPES,
STANDALONE_CLUSTER_CLUSTER_UUID,
METRICBEAT_INDEX_NAME_UNIQUE_TOKEN,
DS_INDEX_PATTERN_METRICS,
} from '../../../common/constants';
import { formatUTCTimestampForTimezone } from '../format_timezone';
import { getNewIndexPatterns } from '../cluster/get_index_patterns';
Expand Down Expand Up @@ -291,7 +292,7 @@ function handleSeries(
bucketSizeInSeconds * 1000
);
let internalIndicesFound = false;
let mbIndicesFound = false;
let ecsIndicesFound = false;
let data: Array<[string | number, number | null]> = [];

if (firstUsableBucketIndex <= lastUsableBucketIndex) {
Expand All @@ -308,8 +309,11 @@ function handleSeries(
// map buckets to X/Y coords for Flot charting
if (bucket.indices) {
for (const indexBucket of bucket.indices.buckets) {
if (indexBucket.key.includes(METRICBEAT_INDEX_NAME_UNIQUE_TOKEN)) {
mbIndicesFound = true;
if (
indexBucket.key.includes(METRICBEAT_INDEX_NAME_UNIQUE_TOKEN) ||
indexBucket.key.includes(DS_INDEX_PATTERN_METRICS)
) {
ecsIndicesFound = true;
} else {
internalIndicesFound = true;
}
Expand All @@ -327,7 +331,7 @@ function handleSeries(
? {
indices_found: {
internal: internalIndicesFound,
metricbeat: mbIndicesFound,
ecs: ecsIndicesFound,
},
}
: {};
Expand Down
21 changes: 13 additions & 8 deletions x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { getNewIndexPatterns } from '../cluster/get_index_patterns';
import { MissingRequiredError } from '../error_missing_required';
import { buildKibanaInfo } from './build_kibana_info';
import { isKibanaStatusStale } from './is_kibana_status_stale';
import { createQuery } from '../create_query';
import { KibanaMetric } from '../metrics';

export function handleResponse(resp: ElasticsearchResponse) {
const hit = resp.hits?.hits[0];
Expand All @@ -36,10 +38,13 @@ export function getKibanaInfo(
{ clusterUuid, kibanaUuid }: { clusterUuid: string; kibanaUuid: string }
) {
const moduleType = 'kibana';
const type = 'kibana_stats';
const dataset = 'stats';
const indexPatterns = getNewIndexPatterns({
config: Globals.app.config,
ccs: req.payload.ccs,
moduleType,
dataset,
});
const params = {
index: indexPatterns,
Expand All @@ -58,14 +63,14 @@ export function getKibanaInfo(
'hits.hits._source.service.version',
],
body: {
query: {
bool: {
filter: [
{ term: { cluster_uuid: clusterUuid } },
{ term: { 'kibana_stats.kibana.uuid': kibanaUuid } },
],
},
},
query: createQuery({
type,
dsDataset: `${moduleType}.${dataset}`,
metricset: dataset,
clusterUuid,
uuid: kibanaUuid,
metric: KibanaMetric.getMetricFields(),
}),
collapse: { field: 'kibana_stats.kibana.uuid' },
sort: [{ timestamp: { order: 'desc', unmapped_type: 'long' } }],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -719,7 +719,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -782,7 +782,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -845,7 +845,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -272,7 +272,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -334,7 +334,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -397,7 +397,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -461,7 +461,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down Expand Up @@ -523,7 +523,7 @@
},
"indices_found": {
"internal": true,
"metricbeat": false
"ecs": false
},
"data": [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
},
"indices_found": {
"internal": false,
"metricbeat": true
"ecs": true
},
"data": [
[
Expand Down Expand Up @@ -383,7 +383,7 @@
},
"indices_found": {
"internal": false,
"metricbeat": true
"ecs": true
},
"data": [
[
Expand Down Expand Up @@ -418,7 +418,7 @@
},
"indices_found": {
"internal": false,
"metricbeat": true
"ecs": true
},
"data": [
[
Expand Down Expand Up @@ -453,7 +453,7 @@
},
"indices_found": {
"internal": false,
"metricbeat": true
"ecs": true
},
"data": [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
export function setIndicesFound(metrics: any, setFromMetricbeat: boolean = false) {
return Object.keys(metrics).reduce((accum: any, metricName) => {
accum[metricName] = metrics[metricName].map(
(item: { indices_found: { internal: boolean; metricbeat: boolean } }, index: number) => {
(item: { indices_found: { internal: boolean; ecs: boolean } }, index: number) => {
if (item.indices_found) {
return {
...item,
indices_found: {
internal: !setFromMetricbeat,
metricbeat: setFromMetricbeat,
ecs: setFromMetricbeat,
},
};
}
Expand Down