From bc664253765b343b37f2c2ef1f3f5150d4c36ce7 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Tue, 6 Aug 2019 16:28:41 -0400
Subject: [PATCH 01/43] Enable setup mode UI toggles
---
.../public/directives/main/index.js | 5 +-
.../monitoring/public/lib/setup_mode.js | 64 ++++++++++---------
.../public/services/breadcrumbs_provider.js | 16 +++--
.../monitoring/public/views/loading/index.js | 5 +-
4 files changed, 49 insertions(+), 41 deletions(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/directives/main/index.js b/x-pack/legacy/plugins/monitoring/public/directives/main/index.js
index 9f7debb73de9b..4d56cc28c241e 100644
--- a/x-pack/legacy/plugins/monitoring/public/directives/main/index.js
+++ b/x-pack/legacy/plugins/monitoring/public/directives/main/index.js
@@ -18,7 +18,7 @@ import template from './index.html';
import { timefilter } from 'ui/timefilter';
import { shortenPipelineHash } from '../../../common/formatting';
import 'ui/directives/kbn_href';
-import { getSetupModeState } from '../../lib/setup_mode';
+import { getSetupModeState, initSetupModeState } from '../../lib/setup_mode';
const setOptions = (controller) => {
if (!controller.pipelineVersions || !controller.pipelineVersions.length || !controller.pipelineDropdownElement) {
@@ -169,6 +169,9 @@ uiModule.directive('monitoringMain', (breadcrumbs, license, kbnUrl, $injector) =
controllerAs: 'monitoringMain',
bindToController: true,
link(scope, _element, attributes, controller) {
+ initSetupModeState(scope, $injector, () => {
+ controller.setup(getSetupObj());
+ });
if (!scope.cluster) {
const $route = $injector.get('$route');
const globalState = $injector.get('globalState');
diff --git a/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js b/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js
index dbfbdb324f7aa..99b9b5bfc0df5 100644
--- a/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js
+++ b/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js
@@ -134,37 +134,39 @@ export const toggleSetupMode = inSetupMode => {
};
const setSetupModeMenuItem = () => {
- // Disabling this for this initial release. This will be added back in
- // in a subsequent PR
- // checkAngularState();
-
- // const globalState = angularState.injector.get('globalState');
- // const navItems = globalState.inSetupMode
- // ? [
- // {
- // key: 'exit',
- // label: 'Exit Setup Mode',
- // description: 'Exit setup mode',
- // run: () => toggleSetupMode(false),
- // testId: 'exitSetupMode'
- // },
- // {
- // key: 'refresh',
- // label: 'Refresh Setup Data',
- // description: 'Refresh data used for setup mode',
- // run: () => updateSetupModeData(),
- // testId: 'refreshSetupModeData'
- // }
- // ]
- // : [{
- // key: 'enter',
- // label: 'Enter Setup Mode',
- // description: 'Enter setup mode',
- // run: () => toggleSetupMode(true),
- // testId: 'enterSetupMode'
- // }];
-
- // angularState.scope.topNavMenu = [...navItems];
+ checkAngularState();
+
+ const globalState = angularState.injector.get('globalState');
+ const navItems = globalState.inSetupMode
+ ? [
+ {
+ id: 'exit',
+ label: 'Exit Setup Mode',
+ description: 'Exit setup mode',
+ run: () => toggleSetupMode(false),
+ testId: 'exitSetupMode'
+ },
+ {
+ id: 'refresh',
+ label: 'Refresh Setup Data',
+ description: 'Refresh data used for setup mode',
+ run: () => updateSetupModeData(),
+ testId: 'refreshSetupModeData'
+ }
+ ]
+ : [{
+ id: 'enter',
+ label: 'Enter Setup Mode',
+ description: 'Enter setup mode',
+ run: () => toggleSetupMode(true),
+ testId: 'enterSetupMode'
+ }];
+
+ angularState.scope.topNavMenu = [...navItems];
+ // LOL angular
+ if (!angularState.scope.$$phase) {
+ angularState.scope.$apply();
+ }
};
export const initSetupModeState = ($scope, $injector, callback) => {
diff --git a/x-pack/legacy/plugins/monitoring/public/services/breadcrumbs_provider.js b/x-pack/legacy/plugins/monitoring/public/services/breadcrumbs_provider.js
index 4bc7d31b0a92c..1648507161ae9 100644
--- a/x-pack/legacy/plugins/monitoring/public/services/breadcrumbs_provider.js
+++ b/x-pack/legacy/plugins/monitoring/public/services/breadcrumbs_provider.js
@@ -6,6 +6,7 @@
import chrome from 'ui/chrome';
import { i18n } from '@kbn/i18n';
+import { getSetupModeState } from '../lib/setup_mode';
// Helper for making objects to use in a link element
const createCrumb = (url, label, testSubj) => {
@@ -120,12 +121,17 @@ function getApmBreadcrumbs(mainInstance) {
export function breadcrumbsProvider() {
return function createBreadcrumbs(clusterName, mainInstance) {
- let breadcrumbs = [ createCrumb('#/home',
- i18n.translate(
+ const setupMode = getSetupModeState();
+ // This mimics how the edit mode works for dashboards
+ const homeCrumb = setupMode.enabled
+ ? i18n.translate(
+ 'xpack.monitoring.breadcrumbs.clustersInSetupModeLabel', { defaultMessage: 'Clusters (Setup Mode)' }
+ )
+ : i18n.translate(
'xpack.monitoring.breadcrumbs.clustersLabel', { defaultMessage: 'Clusters' }
- ),
- 'breadcrumbClusters')
- ];
+ );
+
+ let breadcrumbs = [ createCrumb('#/home', homeCrumb, 'breadcrumbClusters')];
if (!mainInstance.inOverview && clusterName) {
breadcrumbs.push(createCrumb('#/overview', clusterName));
diff --git a/x-pack/legacy/plugins/monitoring/public/views/loading/index.js b/x-pack/legacy/plugins/monitoring/public/views/loading/index.js
index 683a1e1ac5264..79b1f3ef46c56 100644
--- a/x-pack/legacy/plugins/monitoring/public/views/loading/index.js
+++ b/x-pack/legacy/plugins/monitoring/public/views/loading/index.js
@@ -10,8 +10,8 @@ import { PageLoading } from 'plugins/monitoring/components';
import uiRoutes from 'ui/routes';
import { I18nContext } from 'ui/i18n';
import template from './index.html';
-import { toggleSetupMode, getSetupModeState, initSetupModeState } from '../../lib/setup_mode';
import { CODE_PATH_LICENSE } from '../../../common/constants';
+import { toggleSetupMode, getSetupModeState } from '../../lib/setup_mode';
const REACT_DOM_ID = 'monitoringLoadingReactApp';
@@ -23,8 +23,6 @@ uiRoutes
const monitoringClusters = $injector.get('monitoringClusters');
const kbnUrl = $injector.get('kbnUrl');
- initSetupModeState($scope, $injector);
-
const setupMode = getSetupModeState();
// For phase 3, this is not an valid route unless
// setup mode is currently enabled. For phase 4,
@@ -48,7 +46,6 @@ uiRoutes
kbnUrl.changePath('/home');
return;
}
- initSetupModeState($scope, $injector);
return toggleSetupMode(true)
.then(() => {
kbnUrl.changePath('/elasticsearch/nodes');
From 3f0c65aac4a3be3a5231ea3fcc9295953b0a91da Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Mon, 19 Aug 2019 15:02:19 -0400
Subject: [PATCH 02/43] We want to keep the no data page but update the copy
---
.../public/components/no_data/no_data.js | 84 ++++++++++++++-----
.../monitoring/public/views/loading/index.js | 17 +---
.../monitoring/public/views/no_data/index.js | 22 ++++-
3 files changed, 86 insertions(+), 37 deletions(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js b/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js
index 4671850ceed7c..8edf072c08b01 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React from 'react';
+import React, { useState } from 'react';
import PropTypes from 'prop-types';
import {
EuiSpacer,
@@ -12,26 +12,37 @@ import {
EuiPage,
EuiPageBody,
EuiPageContent,
+ EuiHorizontalRule,
+ EuiFlexGroup,
+ EuiFlexItem,
+ EuiButton,
+ EuiText
} from '@elastic/eui';
-import { CheckingSettings } from './checking_settings';
-import { ReasonFound, WeTried } from './reasons';
-import { CheckerErrors } from './checker_errors';
+import { WhatIs } from './blurbs';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { toggleSetupMode } from '../../lib/setup_mode';
-function NoDataMessage(props) {
- const { isLoading, reason, checkMessage } = props;
+// function NoDataMessage(props) {
+// const { isLoading, reason, checkMessage } = props;
- if (isLoading && checkMessage !== null) {
- return ;
- }
+// if (isLoading && checkMessage !== null) {
+// return ;
+// }
- if (reason) {
- return ;
- }
+// if (reason) {
+// return ;
+// }
- return ;
-}
+// return ;
+// }
-export function NoData(props) {
+export function NoData({ changePath }) {
+ const [isLoading, setIsLoading] = useState(false);
+ async function startSetup() {
+ setIsLoading(true);
+ await toggleSetupMode(true);
+ changePath('/elasticsearch/nodes');
+ }
return (
@@ -43,8 +54,43 @@ export function NoData(props) {
>
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -52,7 +98,5 @@ export function NoData(props) {
}
NoData.propTypes = {
- isLoading: PropTypes.bool.isRequired,
- reason: PropTypes.object,
- checkMessage: PropTypes.string
+ changePath: PropTypes.func.isRequired,
};
diff --git a/x-pack/legacy/plugins/monitoring/public/views/loading/index.js b/x-pack/legacy/plugins/monitoring/public/views/loading/index.js
index 79b1f3ef46c56..2b79e047177a6 100644
--- a/x-pack/legacy/plugins/monitoring/public/views/loading/index.js
+++ b/x-pack/legacy/plugins/monitoring/public/views/loading/index.js
@@ -11,7 +11,6 @@ import uiRoutes from 'ui/routes';
import { I18nContext } from 'ui/i18n';
import template from './index.html';
import { CODE_PATH_LICENSE } from '../../../common/constants';
-import { toggleSetupMode, getSetupModeState } from '../../lib/setup_mode';
const REACT_DOM_ID = 'monitoringLoadingReactApp';
@@ -23,15 +22,6 @@ uiRoutes
const monitoringClusters = $injector.get('monitoringClusters');
const kbnUrl = $injector.get('kbnUrl');
- const setupMode = getSetupModeState();
- // For phase 3, this is not an valid route unless
- // setup mode is currently enabled. For phase 4,
- // we will remove this check.
- if (!setupMode.enabled) {
- kbnUrl.changePath('/no-data');
- return;
- }
-
$scope.$on('$destroy', () => {
unmountComponentAtNode(document.getElementById(REACT_DOM_ID));
});
@@ -46,11 +36,8 @@ uiRoutes
kbnUrl.changePath('/home');
return;
}
- return toggleSetupMode(true)
- .then(() => {
- kbnUrl.changePath('/elasticsearch/nodes');
- $scope.$apply();
- });
+ kbnUrl.changePath('/no-data');
+ return;
});
}
diff --git a/x-pack/legacy/plugins/monitoring/public/views/no_data/index.js b/x-pack/legacy/plugins/monitoring/public/views/no_data/index.js
index bd0cee74225c6..9aa5b985da6f7 100644
--- a/x-pack/legacy/plugins/monitoring/public/views/no_data/index.js
+++ b/x-pack/legacy/plugins/monitoring/public/views/no_data/index.js
@@ -4,10 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import React from 'react';
import uiRoutes from 'ui/routes';
import template from './index.html';
-import { NoDataController } from './controller';
import { CODE_PATH_LICENSE } from '../../../common/constants';
+import { I18nContext } from 'ui/i18n';
+import { render } from 'react-dom';
+import { NoData } from '../../components/no_data/no_data';
+
+const REACT_NODE_ID_NO_DATA = 'noDataReact';
+
uiRoutes
.when('/no-data', {
template,
@@ -25,6 +31,18 @@ uiRoutes
});
}
},
- controller: NoDataController
+ controller: class {
+ constructor($injector, $scope) {
+ $scope.$$postDigest(() => {
+ render(
+
+ $scope.$apply(() => $injector.get('kbnUrl').changePath(path))} />
+ ,
+ document.getElementById(REACT_NODE_ID_NO_DATA)
+ );
+ });
+
+ }
+ }
})
.otherwise({ redirectTo: '/home' });
From 8c7e679de1449fb74ef4dc36b7c1b8ac97f64c54 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Mon, 19 Aug 2019 15:02:53 -0400
Subject: [PATCH 03/43] More updated copy
---
.../public/components/no_data/no_data.js | 24 ++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js b/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js
index 8edf072c08b01..fb4e36825caee 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/no_data/no_data.js
@@ -16,9 +16,10 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiButton,
- EuiText
+ EuiText,
+ EuiTitle,
+ EuiTextColor,
} from '@elastic/eui';
-import { WhatIs } from './blurbs';
import { FormattedMessage } from '@kbn/i18n/react';
import { toggleSetupMode } from '../../lib/setup_mode';
@@ -54,7 +55,24 @@ export function NoData({ changePath }) {
>
-
+
+
+
+
+
+
+
+
+
+
+
+
From 10aeb2b53c61f17b1ad995d188c89a65d26a6536 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Mon, 19 Aug 2019 15:28:01 -0400
Subject: [PATCH 04/43] Remove manual checks for logstash, beats, apm and
kibana
---
...isable_internal_collection_instructions.js | 137 +++++-------------
...isable_internal_collection_instructions.js | 137 +++++-------------
...isable_internal_collection_instructions.js | 137 +++++-------------
...isable_internal_collection_instructions.js | 137 +++++-------------
4 files changed, 160 insertions(+), 388 deletions(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/apm/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/apm/disable_internal_collection_instructions.js
index 827e535a57262..023f29fc6c28e 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/apm/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/apm/disable_internal_collection_instructions.js
@@ -8,9 +8,6 @@ import React, { Fragment } from 'react';
import {
EuiSpacer,
EuiCodeBlock,
- EuiFlexGroup,
- EuiFlexItem,
- EuiButton,
EuiCallOut,
EuiText
} from '@elastic/eui';
@@ -20,12 +17,7 @@ import { Monospace } from '../components/monospace';
import { FormattedMessage } from '@kbn/i18n/react';
import { statusTitle } from './common_apm_instructions';
-export function getApmInstructionsForDisablingInternalCollection(product, meta, {
- checkForMigrationStatus,
- checkingMigrationStatus,
- hasCheckedStatus,
- autoCheckIntervalInMs,
-}) {
+export function getApmInstructionsForDisablingInternalCollection(product, meta) {
const disableInternalCollectionStep = {
title: i18n.translate('xpack.monitoring.metricbeatMigration.apmInstructions.disableInternalCollection.title', {
defaultMessage: 'Disable internal collection of the APM server\'s monitoring metrics'
@@ -67,100 +59,51 @@ export function getApmInstructionsForDisablingInternalCollection(product, meta,
let migrationStatusStep = null;
if (!product || !product.isFullyMigrated) {
- let status = null;
- if (hasCheckedStatus) {
- let lastInternallyCollectedMessage = '';
- // It is possible that, during the migration steps, products are not reporting
- // monitoring data for a period of time outside the window of our server-side check
- // and this is most likely temporary so we want to be defensive and not error out
- // and hopefully wait for the next check and this state will be self-corrected.
- if (product) {
- const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
- const secondsSinceLastInternalCollectionLabel =
- formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
- lastInternallyCollectedMessage = ();
- }
-
- status = (
-
-
-
-
-
-
-
- {lastInternallyCollectedMessage}
-
-
-
- );
- }
-
- let buttonLabel;
- if (checkingMigrationStatus) {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.apmInstructions.disableInternalCollection.checkingStatusButtonLabel',
- {
- defaultMessage: 'Checking...'
- }
- );
- } else {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.apmInstructions.disableInternalCollection.checkStatusButtonLabel',
- {
- defaultMessage: 'Check'
- }
- );
+ let lastInternallyCollectedMessage = '';
+ // It is possible that, during the migration steps, products are not reporting
+ // monitoring data for a period of time outside the window of our server-side check
+ // and this is most likely temporary so we want to be defensive and not error out
+ // and hopefully wait for the next check and this state will be self-corrected.
+ if (product) {
+ const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
+ const secondsSinceLastInternalCollectionLabel =
+ formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
+ lastInternallyCollectedMessage = ();
}
migrationStatusStep = {
title: statusTitle,
status: 'incomplete',
children: (
-
-
-
-
-
- {i18n.translate(
- 'xpack.monitoring.metricbeatMigration.apmInstructions.disableInternalCollection.statusDescription',
- {
- defaultMessage: 'Check that no documents are coming from internal collection.'
- }
- )}
-
-
-
-
-
- {buttonLabel}
-
-
-
- {status}
-
+
+
+
+
+
+ {lastInternallyCollectedMessage}
+
+
)
};
}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js
index 4a843ff286598..e597de68e30fb 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js
@@ -8,9 +8,6 @@ import React, { Fragment } from 'react';
import {
EuiSpacer,
EuiCodeBlock,
- EuiFlexGroup,
- EuiFlexItem,
- EuiButton,
EuiCallOut,
EuiText
} from '@elastic/eui';
@@ -20,12 +17,7 @@ import { Monospace } from '../components/monospace';
import { FormattedMessage } from '@kbn/i18n/react';
import { statusTitle, UNDETECTED_BEAT_TYPE } from './common_beats_instructions';
-export function getBeatsInstructionsForDisablingInternalCollection(product, meta, {
- checkForMigrationStatus,
- checkingMigrationStatus,
- hasCheckedStatus,
- autoCheckIntervalInMs,
-}) {
+export function getBeatsInstructionsForDisablingInternalCollection(product, meta) {
const beatType = product.beatType;
const disableInternalCollectionStep = {
title: i18n.translate('xpack.monitoring.metricbeatMigration.beatsInstructions.disableInternalCollection.title', {
@@ -75,100 +67,51 @@ export function getBeatsInstructionsForDisablingInternalCollection(product, meta
let migrationStatusStep = null;
if (!product || !product.isFullyMigrated) {
- let status = null;
- if (hasCheckedStatus) {
- let lastInternallyCollectedMessage = '';
- // It is possible that, during the migration steps, products are not reporting
- // monitoring data for a period of time outside the window of our server-side check
- // and this is most likely temporary so we want to be defensive and not error out
- // and hopefully wait for the next check and this state will be self-corrected.
- if (product) {
- const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
- const secondsSinceLastInternalCollectionLabel =
- formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
- lastInternallyCollectedMessage = ();
- }
-
- status = (
-
-
-
-
-
-
-
- {lastInternallyCollectedMessage}
-
-
-
- );
- }
-
- let buttonLabel;
- if (checkingMigrationStatus) {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.beatsInstructions.disableInternalCollection.checkingStatusButtonLabel',
- {
- defaultMessage: 'Checking...'
- }
- );
- } else {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.beatsInstructions.disableInternalCollection.checkStatusButtonLabel',
- {
- defaultMessage: 'Check'
- }
- );
+ let lastInternallyCollectedMessage = '';
+ // It is possible that, during the migration steps, products are not reporting
+ // monitoring data for a period of time outside the window of our server-side check
+ // and this is most likely temporary so we want to be defensive and not error out
+ // and hopefully wait for the next check and this state will be self-corrected.
+ if (product) {
+ const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
+ const secondsSinceLastInternalCollectionLabel =
+ formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
+ lastInternallyCollectedMessage = ();
}
migrationStatusStep = {
title: statusTitle,
status: 'incomplete',
children: (
-
-
-
-
-
- {i18n.translate(
- 'xpack.monitoring.metricbeatMigration.beatsInstructions.disableInternalCollection.statusDescription',
- {
- defaultMessage: 'Check that no documents are coming from internal collection.'
- }
- )}
-
-
-
-
-
- {buttonLabel}
-
-
-
- {status}
-
+
+
+
+
+
+ {lastInternallyCollectedMessage}
+
+
)
};
}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
index e4219fe47c3c2..b0618d36d2d4f 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
@@ -8,9 +8,6 @@ import React, { Fragment } from 'react';
import {
EuiSpacer,
EuiCodeBlock,
- EuiFlexGroup,
- EuiFlexItem,
- EuiButton,
EuiCallOut,
EuiText
} from '@elastic/eui';
@@ -20,12 +17,7 @@ import { Monospace } from '../components/monospace';
import { FormattedMessage } from '@kbn/i18n/react';
import { statusTitle } from './common_kibana_instructions';
-export function getKibanaInstructionsForDisablingInternalCollection(product, meta, {
- checkForMigrationStatus,
- checkingMigrationStatus,
- hasCheckedStatus,
- autoCheckIntervalInMs,
-}) {
+export function getKibanaInstructionsForDisablingInternalCollection(product, meta) {
let restartWarning = null;
if (product.isPrimary) {
restartWarning = (
@@ -105,100 +97,51 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
let migrationStatusStep = null;
if (!product || !product.isFullyMigrated) {
- let status = null;
- if (hasCheckedStatus) {
- let lastInternallyCollectedMessage = '';
- // It is possible that, during the migration steps, products are not reporting
- // monitoring data for a period of time outside the window of our server-side check
- // and this is most likely temporary so we want to be defensive and not error out
- // and hopefully wait for the next check and this state will be self-corrected.
- if (product) {
- const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
- const secondsSinceLastInternalCollectionLabel =
- formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
- lastInternallyCollectedMessage = ();
- }
-
- status = (
-
-
-
-
-
-
-
- {lastInternallyCollectedMessage}
-
-
-
- );
- }
-
- let buttonLabel;
- if (checkingMigrationStatus) {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.kibanaInstructions.disableInternalCollection.checkingStatusButtonLabel',
- {
- defaultMessage: 'Checking...'
- }
- );
- } else {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.kibanaInstructions.disableInternalCollection.checkStatusButtonLabel',
- {
- defaultMessage: 'Check'
- }
- );
+ let lastInternallyCollectedMessage = '';
+ // It is possible that, during the migration steps, products are not reporting
+ // monitoring data for a period of time outside the window of our server-side check
+ // and this is most likely temporary so we want to be defensive and not error out
+ // and hopefully wait for the next check and this state will be self-corrected.
+ if (product) {
+ const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
+ const secondsSinceLastInternalCollectionLabel =
+ formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
+ lastInternallyCollectedMessage = ();
}
migrationStatusStep = {
title: statusTitle,
status: 'incomplete',
children: (
-
-
-
-
-
- {i18n.translate(
- 'xpack.monitoring.metricbeatMigration.kibanaInstructions.disableInternalCollection.statusDescription',
- {
- defaultMessage: 'Check that no documents are coming from internal collection.'
- }
- )}
-
-
-
-
-
- {buttonLabel}
-
-
-
- {status}
-
+
+
+
+
+
+ {lastInternallyCollectedMessage}
+
+
)
};
}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js
index 9efc5a26ef822..7c7a91eb7e536 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js
@@ -8,9 +8,6 @@ import React, { Fragment } from 'react';
import {
EuiSpacer,
EuiCodeBlock,
- EuiFlexGroup,
- EuiFlexItem,
- EuiButton,
EuiCallOut,
EuiText
} from '@elastic/eui';
@@ -20,12 +17,7 @@ import { Monospace } from '../components/monospace';
import { FormattedMessage } from '@kbn/i18n/react';
import { statusTitle } from './common_logstash_instructions';
-export function getLogstashInstructionsForDisablingInternalCollection(product, meta, {
- checkForMigrationStatus,
- checkingMigrationStatus,
- hasCheckedStatus,
- autoCheckIntervalInMs,
-}) {
+export function getLogstashInstructionsForDisablingInternalCollection(product, meta) {
const disableInternalCollectionStep = {
title: i18n.translate('xpack.monitoring.metricbeatMigration.logstashInstructions.disableInternalCollection.title', {
defaultMessage: 'Disable internal collection of Logstash monitoring metrics'
@@ -67,100 +59,51 @@ export function getLogstashInstructionsForDisablingInternalCollection(product, m
let migrationStatusStep = null;
if (!product || !product.isFullyMigrated) {
- let status = null;
- if (hasCheckedStatus) {
- let lastInternallyCollectedMessage = '';
- // It is possible that, during the migration steps, products are not reporting
- // monitoring data for a period of time outside the window of our server-side check
- // and this is most likely temporary so we want to be defensive and not error out
- // and hopefully wait for the next check and this state will be self-corrected.
- if (product) {
- const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
- const secondsSinceLastInternalCollectionLabel =
- formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
- lastInternallyCollectedMessage = ();
- }
-
- status = (
-
-
-
-
-
-
-
- {lastInternallyCollectedMessage}
-
-
-
- );
- }
-
- let buttonLabel;
- if (checkingMigrationStatus) {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.logstashInstructions.disableInternalCollection.checkingStatusButtonLabel',
- {
- defaultMessage: 'Checking...'
- }
- );
- } else {
- buttonLabel = i18n.translate(
- 'xpack.monitoring.metricbeatMigration.logstashInstructions.disableInternalCollection.checkStatusButtonLabel',
- {
- defaultMessage: 'Check'
- }
- );
+ let lastInternallyCollectedMessage = '';
+ // It is possible that, during the migration steps, products are not reporting
+ // monitoring data for a period of time outside the window of our server-side check
+ // and this is most likely temporary so we want to be defensive and not error out
+ // and hopefully wait for the next check and this state will be self-corrected.
+ if (product) {
+ const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
+ const secondsSinceLastInternalCollectionLabel =
+ formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
+ lastInternallyCollectedMessage = ();
}
migrationStatusStep = {
title: statusTitle,
status: 'incomplete',
children: (
-
-
-
-
-
- {i18n.translate(
- 'xpack.monitoring.metricbeatMigration.logstashInstructions.disableInternalCollection.statusDescription',
- {
- defaultMessage: 'Check that no documents are coming from internal collection.'
- }
- )}
-
-
-
-
-
- {buttonLabel}
-
-
-
- {status}
-
+
+
+
+
+
+ {lastInternallyCollectedMessage}
+
+
)
};
}
From 3b3363700f2bd60aea12053dc01d2ecdf3365339 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Wed, 21 Aug 2019 13:01:56 -0400
Subject: [PATCH 05/43] Hide the setup mode controls on the no data page. There
is nothing different in setup mode
---
.../legacy/plugins/monitoring/public/lib/setup_mode.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js b/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js
index 99b9b5bfc0df5..18ec506dea965 100644
--- a/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js
+++ b/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.js
@@ -5,7 +5,11 @@
*/
import { ajaxErrorHandlersProvider } from './ajax_error_handler';
-import { get } from 'lodash';
+import { get, contains } from 'lodash';
+
+function isOnPage(hash) {
+ return contains(window.location.hash, hash);
+}
const angularState = {
injector: null,
@@ -136,6 +140,10 @@ export const toggleSetupMode = inSetupMode => {
const setSetupModeMenuItem = () => {
checkAngularState();
+ if (isOnPage('no-data')) {
+ return;
+ }
+
const globalState = angularState.injector.get('globalState');
const navItems = globalState.inSetupMode
? [
From 100da8b056e452acfff4fae6ab2e0ec3cc8d89ab Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Wed, 21 Aug 2019 15:27:32 -0400
Subject: [PATCH 06/43] Setup mode test
---
.../monitoring/public/lib/setup_mode.test.js | 163 ++++++++++++++++++
1 file changed, 163 insertions(+)
create mode 100644 x-pack/legacy/plugins/monitoring/public/lib/setup_mode.test.js
diff --git a/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.test.js b/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.test.js
new file mode 100644
index 0000000000000..0321c5d978667
--- /dev/null
+++ b/x-pack/legacy/plugins/monitoring/public/lib/setup_mode.test.js
@@ -0,0 +1,163 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { toggleSetupMode, initSetupModeState, getSetupModeState, updateSetupModeData } from './setup_mode';
+
+jest.mock('./ajax_error_handler', () => ({
+ ajaxErrorHandlersProvider: err => {
+ throw err;
+ }
+}));
+
+let data = {};
+
+const injectorModulesMock = {
+ globalState: {
+ save: jest.fn()
+ },
+ Private: module => module,
+ $http: {
+ post: jest.fn().mockImplementation(() => {
+ return { data };
+ })
+ },
+ $executor: {
+ run: jest.fn()
+ }
+};
+
+const angularStateMock = {
+ injector: {
+ get: module => {
+ return injectorModulesMock[module] || {};
+ }
+ },
+ scope: {
+ $apply: fn => fn && fn()
+ }
+};
+
+describe('setup_mode', () => {
+ describe('setup', () => {
+ afterEach(async () => {
+ toggleSetupMode(false);
+ });
+
+ it('should require angular state', async () => {
+ expect(toggleSetupMode(true)).rejects.toEqual('Unable to interact with setup '
+ + 'mode because the angular injector was not previously set. This needs to be '
+ + 'set by calling `initSetupModeState`.');
+ });
+
+ it('should enable toggle mode', async () => {
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await toggleSetupMode(true);
+ expect(injectorModulesMock.globalState.inSetupMode).toBe(true);
+ });
+
+ it('should disable toggle mode', async () => {
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await toggleSetupMode(false);
+ expect(injectorModulesMock.globalState.inSetupMode).toBe(false);
+ });
+
+ it('should set top nav config', async () => {
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ expect(angularStateMock.scope.topNavMenu.length).toBe(1);
+ await toggleSetupMode(true);
+ expect(angularStateMock.scope.topNavMenu.length).toBe(2);
+ });
+ });
+
+ describe('in setup mode', () => {
+ afterEach(async () => {
+ data = {};
+ toggleSetupMode(false);
+ });
+
+ it('should enable it through clicking top nav item', async () => {
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await angularStateMock.scope.topNavMenu[0].run();
+ expect(injectorModulesMock.globalState.inSetupMode).toBe(true);
+ });
+
+ it('should not fetch data if on cloud', async () => {
+ data = {
+ _meta: {
+ isOnCloud: true
+ }
+ };
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await toggleSetupMode(true);
+ const state = getSetupModeState();
+ expect(state.enabled).toBe(false);
+ });
+
+ it('should set the newly discovered cluster uuid', async () => {
+ const clusterUuid = '1ajy';
+ data = {
+ _meta: {
+ liveClusterUuid: clusterUuid
+ },
+ elasticsearch: {
+ byUuid: {
+ 123: {
+ isPartiallyMigrated: true
+ }
+ }
+ }
+ };
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await toggleSetupMode(true);
+ expect(injectorModulesMock.globalState.cluster_uuid).toBe(clusterUuid);
+ });
+
+ it('should fetch data for a given cluster', async () => {
+ const clusterUuid = '1ajy';
+ data = {
+ _meta: {
+ liveClusterUuid: clusterUuid
+ },
+ elasticsearch: {
+ byUuid: {
+ 123: {
+ isPartiallyMigrated: true
+ }
+ }
+ }
+ };
+
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await toggleSetupMode(true);
+ expect(injectorModulesMock.$http.post).toHaveBeenCalledWith(
+ `../api/monitoring/v1/setup/collection/cluster/${clusterUuid}`,
+ { ccs: undefined }
+ );
+ });
+
+ it('should fetch data for a single node', async () => {
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await toggleSetupMode(true);
+ injectorModulesMock.$http.post.mockClear();
+ await updateSetupModeData('45asd');
+ expect(injectorModulesMock.$http.post).toHaveBeenCalledWith(
+ '../api/monitoring/v1/setup/collection/node/45asd',
+ { ccs: undefined }
+ );
+ });
+
+ it('should fetch data without a cluster uuid', async () => {
+ initSetupModeState(angularStateMock.scope, angularStateMock.injector);
+ await toggleSetupMode(true);
+ injectorModulesMock.$http.post.mockClear();
+ await updateSetupModeData(undefined, true);
+ expect(injectorModulesMock.$http.post).toHaveBeenCalledWith(
+ '../api/monitoring/v1/setup/collection/cluster',
+ { ccs: undefined }
+ );
+ });
+ });
+});
From 236b08bcec99e71d63bca5c96429910f4b80d500 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Wed, 4 Sep 2019 11:31:23 -0400
Subject: [PATCH 07/43] Fix bug with disabling internal collection for ES
---
.../server/lib/setup/collection/get_collection_status.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x-pack/legacy/plugins/monitoring/server/lib/setup/collection/get_collection_status.js b/x-pack/legacy/plugins/monitoring/server/lib/setup/collection/get_collection_status.js
index 85e0745436463..f67c0db5bd3df 100644
--- a/x-pack/legacy/plugins/monitoring/server/lib/setup/collection/get_collection_status.js
+++ b/x-pack/legacy/plugins/monitoring/server/lib/setup/collection/get_collection_status.js
@@ -271,7 +271,7 @@ async function getLiveElasticsearchCollectionEnabled(req) {
});
const sources = ['persistent', 'transient', 'defaults'];
for (const source of sources) {
- const collectionSettings = get(response[source], 'xpack.monitoring.collection');
+ const collectionSettings = get(response[source], 'xpack.monitoring.elasticsearch.collection');
if (collectionSettings && collectionSettings.enabled === 'true') {
return true;
}
From fa80d10fff772b04861a53947467f0df05eac391 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Fri, 6 Sep 2019 08:22:11 -0400
Subject: [PATCH 08/43] First steps towards the redesign of setup mode
---
.../plugins/monitoring/common/constants.js | 23 ++
.../components/apm/instances/instances.js | 2 +-
.../components/beats/listing/listing.js | 44 +--
.../components/cluster/overview/apm_panel.js | 59 +---
.../cluster/overview/beats_panel.js | 59 +---
.../cluster/overview/elasticsearch_panel.js | 65 +---
.../cluster/overview/kibana_panel.js | 58 +---
.../cluster/overview/logstash_panel.js | 61 +---
.../elasticsearch/cluster_status/index.js | 4 +-
.../index_detail_status/index.js | 4 +-
.../components/elasticsearch/nodes/nodes.js | 133 ++++----
.../components/kibana/instances/instances.js | 95 +++---
.../components/logstash/listing/listing.js | 101 +++---
.../metricbeat_migration/flyout/flyout.js | 16 +-
.../enable_metricbeat_instructions.js | 30 +-
...isable_internal_collection_instructions.js | 18 +-
.../public/components/no_data/no_data.js | 88 +++--
.../public/components/renderers/setup_mode.js | 67 +++-
.../public/components/setup_mode/badge.js | 109 +++++++
.../components/setup_mode/common_text.js | 19 ++
.../components/setup_mode/listing_callout.js | 157 +++++++++
.../public/components/setup_mode/tooltip.js | 145 +++++++++
.../public/components/table/eui_table.js | 301 +++++++++---------
.../public/directives/main/index.js | 3 +-
.../monitoring/public/lib/route_init.js | 6 +-
.../monitoring/public/lib/setup_mode.js | 36 +--
.../public/services/breadcrumbs_provider.js | 13 +-
.../public/views/apm/instances/index.js | 3 +-
.../public/views/beats/listing/index.js | 3 +-
.../public/views/cluster/overview/index.js | 3 +-
.../public/views/elasticsearch/nodes/index.js | 3 +-
.../public/views/kibana/instances/index.js | 3 +-
.../public/views/logstash/nodes/index.js | 3 +-
.../monitoring/public/views/no_data/index.js | 21 +-
34 files changed, 1071 insertions(+), 684 deletions(-)
create mode 100644 x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js
create mode 100644 x-pack/legacy/plugins/monitoring/public/components/setup_mode/common_text.js
create mode 100644 x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js
create mode 100644 x-pack/legacy/plugins/monitoring/public/components/setup_mode/tooltip.js
diff --git a/x-pack/legacy/plugins/monitoring/common/constants.js b/x-pack/legacy/plugins/monitoring/common/constants.js
index 9824614113094..60560d6f0fa76 100644
--- a/x-pack/legacy/plugins/monitoring/common/constants.js
+++ b/x-pack/legacy/plugins/monitoring/common/constants.js
@@ -156,6 +156,29 @@ export const METRICBEAT_INDEX_NAME_UNIQUE_TOKEN = '-mb-';
// We use this for metricbeat migration to identify specific products that we do not have constants for
export const ELASTICSEARCH_CUSTOM_ID = 'elasticsearch';
export const APM_CUSTOM_ID = 'apm';
+/**
+ * The name of the Kibana System ID used to publish and look up Kibana stats through the Monitoring system.
+ * @type {string}
+ */
+export const KIBANA_SYSTEM_ID = 'kibana';
+
+/**
+ * The name of the Beats System ID used to publish and look up Beats stats through the Monitoring system.
+ * @type {string}
+ */
+export const BEATS_SYSTEM_ID = 'beats';
+
+/**
+ * The name of the Apm System ID used to publish and look up Apm stats through the Monitoring system.
+ * @type {string}
+ */
+export const APM_SYSTEM_ID = 'beats';
+
+/**
+ * The name of the Kibana System ID used to look up Logstash stats through the Monitoring system.
+ * @type {string}
+ */
+export const LOGSTASH_SYSTEM_ID = 'logstash';
/**
* The id of the infra source owned by the monitoring plugin.
*/
diff --git a/x-pack/legacy/plugins/monitoring/public/components/apm/instances/instances.js b/x-pack/legacy/plugins/monitoring/public/components/apm/instances/instances.js
index 04b6652c6ce0a..86de231baeccc 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/apm/instances/instances.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/apm/instances/instances.js
@@ -135,7 +135,7 @@ export function ApmServerInstances({ apms, setupMode }) {
uuidField="uuid"
nameField="name"
setupNewButtonLabel={i18n.translate('xpack.monitoring.apm.metricbeatMigration.setupNewButtonLabel', {
- defaultMessage: 'Setup monitoring for new APM server'
+ defaultMessage: 'Set up monitoring for new server'
})}
search={{
box: {
diff --git a/x-pack/legacy/plugins/monitoring/public/components/beats/listing/listing.js b/x-pack/legacy/plugins/monitoring/public/components/beats/listing/listing.js
index d11797dc090eb..75cb08ec09cbe 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/beats/listing/listing.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/beats/listing/listing.js
@@ -4,13 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React, { PureComponent, Fragment } from 'react';
-import { uniq, get } from 'lodash';
-import { EuiPage, EuiPageBody, EuiPageContent, EuiSpacer, EuiLink, EuiCallOut } from '@elastic/eui';
+import React, { PureComponent } from 'react';
+import { uniq } from 'lodash';
+import { EuiPage, EuiPageBody, EuiPageContent, EuiSpacer, EuiLink } from '@elastic/eui';
import { Stats } from 'plugins/monitoring/components/beats';
import { formatMetric } from 'plugins/monitoring/lib/format_number';
import { EuiMonitoringTable } from 'plugins/monitoring/components/table';
import { i18n } from '@kbn/i18n';
+import { BEATS_SYSTEM_ID } from '../../../../common/constants';
+import { ListingCallOut } from '../../setup_mode/listing_callout';
export class Listing extends PureComponent {
getColumns() {
@@ -78,26 +80,14 @@ export class Listing extends PureComponent {
setupMode
} = this.props;
- let detectedInstanceMessage = null;
- if (setupMode.enabled && setupMode.data && get(setupMode.data, 'detected.mightExist')) {
- detectedInstanceMessage = (
-
-
-
- {i18n.translate('xpack.monitoring.beats.instances.metricbeatMigration.detectedInstanceDescription', {
- defaultMessage: `Based on your indices, we think you might have a beats instance. Click the 'Setup monitoring'
- button below to start monitoring this instance.`
- })}
-
-
-
-
+ let setupModeCallOut = null;
+ if (setupMode.enabled && setupMode.data) {
+ setupModeCallOut = (
+
);
}
@@ -115,16 +105,12 @@ export class Listing extends PureComponent {
- {detectedInstanceMessage}
+ {setupModeCallOut}
props.changeUrl('apm');
const goToInstances = () => props.changeUrl('apm/instances');
- const setupModeAPMData = get(setupMode.data, 'apm');
- let setupModeInstancesData = null;
- if (setupMode.enabled && setupMode.data) {
- const {
- totalUniqueInstanceCount,
- totalUniqueFullyMigratedCount,
- totalUniquePartiallyMigratedCount
- } = setupModeAPMData;
- const hasInstances = totalUniqueInstanceCount > 0 || get(setupModeAPMData, 'detected.mightExist', false);
- const allMonitoredByMetricbeat = totalUniqueInstanceCount > 0 &&
- (totalUniqueFullyMigratedCount === totalUniqueInstanceCount || totalUniquePartiallyMigratedCount === totalUniqueInstanceCount);
- const internalCollectionOn = totalUniquePartiallyMigratedCount > 0;
- if (hasInstances && (!allMonitoredByMetricbeat || internalCollectionOn)) {
- let tooltipText = null;
-
- if (!allMonitoredByMetricbeat) {
- tooltipText = i18n.translate('xpack.monitoring.cluster.overview.apmPanel.setupModeNodesTooltip.oneInternal', {
- defaultMessage: `There's at least one server that isn't being monitored using Metricbeat. Click the flag
- icon to visit the servers listing page and find out more information about the status of each server.`
- });
- }
- else if (internalCollectionOn) {
- tooltipText = i18n.translate('xpack.monitoring.cluster.overview.apmPanel.setupModeNodesTooltip.disableInternal', {
- defaultMessage: `All servers are being monitored using Metricbeat but internal collection still needs to be turned
- off. Click the flag icon to visit the servers listing page and disable internal collection.`
- });
- }
-
- setupModeInstancesData = (
-
-
-
-
-
-
-
- );
- }
- }
+ const setupModeData = get(setupMode.data, 'apm');
+ const setupModeTooltip = setupMode && setupMode.enabled
+ ? (
+
+ )
+ : null;
return (
- {setupModeInstancesData}
+ {setupModeTooltip}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/beats_panel.js b/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/beats_panel.js
index 8ea987d0a6762..9b13570eb656f 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/beats_panel.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/beats_panel.js
@@ -18,12 +18,11 @@ import {
EuiDescriptionListDescription,
EuiHorizontalRule,
EuiFlexGroup,
- EuiToolTip,
- EuiIcon
} from '@elastic/eui';
import { ClusterItemContainer, DisabledIfNoDataAndInSetupModeLink } from './helpers';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
+import { SetupModeTooltip } from '../../setup_mode/tooltip';
export function BeatsPanel(props) {
const { setupMode } = props;
@@ -36,48 +35,16 @@ export function BeatsPanel(props) {
const goToBeats = () => props.changeUrl('beats');
const goToInstances = () => props.changeUrl('beats/beats');
- const setupModeBeatsData = get(setupMode.data, 'beats');
- let setupModeInstancesData = null;
- if (setupMode.enabled && setupMode.data) {
- const {
- totalUniqueInstanceCount,
- totalUniqueFullyMigratedCount,
- totalUniquePartiallyMigratedCount
- } = setupModeBeatsData;
- const hasInstances = totalUniqueInstanceCount > 0 || get(setupModeBeatsData, 'detected.mightExist', false);
- const allMonitoredByMetricbeat = totalUniqueInstanceCount > 0 &&
- (totalUniqueFullyMigratedCount === totalUniqueInstanceCount || totalUniquePartiallyMigratedCount === totalUniqueInstanceCount);
- const internalCollectionOn = totalUniquePartiallyMigratedCount > 0;
- if (hasInstances && (!allMonitoredByMetricbeat || internalCollectionOn)) {
- let tooltipText = null;
-
- if (!allMonitoredByMetricbeat) {
- tooltipText = i18n.translate('xpack.monitoring.cluster.overview.beatsPanel.setupModeNodesTooltip.oneInternal', {
- defaultMessage: `There's at least one instance that isn't being monitored using Metricbeat. Click the flag
- icon to visit the instances listing page and find out more information about the status of each instance.`
- });
- }
- else if (internalCollectionOn) {
- tooltipText = i18n.translate('xpack.monitoring.cluster.overview.beatsPanel.setupModeNodesTooltip.disableInternal', {
- defaultMessage: `All instances are being monitored using Metricbeat but internal collection still needs to be turned
- off. Click the flag icon to visit the instances listing page and disable internal collection.`
- });
- }
-
- setupModeInstancesData = (
-
-
-
-
-
-
-
- );
- }
- }
+ const setupModeData = get(setupMode.data, 'beats');
+ const setupModeTooltip = setupMode && setupMode.enabled
+ ? (
+
+ )
+ : null;
const beatTypes = props.beats.types.map((beat, index) => {
return [
@@ -111,7 +78,7 @@ export function BeatsPanel(props) {
- {setupModeInstancesData}
+ {setupModeTooltip}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js b/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js
index 3f45d6e07297c..4e81e335a8f5b 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js
@@ -27,12 +27,12 @@ import {
EuiBadge,
EuiToolTip,
EuiFlexGroup,
- EuiIcon
} from '@elastic/eui';
import { LicenseText } from './license_text';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { Reason } from '../../logs/reason';
+import { SetupModeTooltip } from '../../setup_mode/tooltip';
const calculateShards = shards => {
const total = get(shards, 'total', 0);
@@ -160,47 +160,16 @@ export function ElasticsearchPanel(props) {
const licenseText = ;
- const setupModeElasticsearchData = get(setupMode.data, 'elasticsearch');
- let setupModeNodesData = null;
- if (setupMode.enabled && setupModeElasticsearchData) {
- const {
- totalUniqueInstanceCount,
- totalUniqueFullyMigratedCount,
- totalUniquePartiallyMigratedCount
- } = setupModeElasticsearchData;
- const allMonitoredByMetricbeat = totalUniqueInstanceCount > 0 &&
- (totalUniqueFullyMigratedCount === totalUniqueInstanceCount || totalUniquePartiallyMigratedCount === totalUniqueInstanceCount);
- const internalCollectionOn = totalUniquePartiallyMigratedCount > 0;
- if (!allMonitoredByMetricbeat || internalCollectionOn) {
- let tooltipText = null;
-
- if (!allMonitoredByMetricbeat) {
- tooltipText = i18n.translate('xpack.monitoring.cluster.overview.elasticsearchPanel.setupModeNodesTooltip.oneInternal', {
- defaultMessage: `There's at least one node that isn't being monitored using Metricbeat. Click the flag icon to visit the nodes
- listing page and find out more information about the status of each node.`
- });
- }
- else if (internalCollectionOn) {
- tooltipText = i18n.translate('xpack.monitoring.cluster.overview.elasticsearchPanel.setupModeNodesTooltip.disableInternal', {
- defaultMessage: `All nodes are being monitored using Metricbeat but internal collection still needs to be turned off. Click the
- flag icon to visit the nodes listing page and disable internal collection.`
- });
- }
-
- setupModeNodesData = (
-
-
-
-
-
-
-
- );
- }
- }
+ const setupModeData = get(setupMode.data, 'elasticsearch');
+ const setupModeTooltip = setupMode && setupMode.enabled
+ ? (
+
+ )
+ : null;
const showMlJobs = () => {
// if license doesn't support ML, then `ml === null`
@@ -211,7 +180,7 @@ export function ElasticsearchPanel(props) {
{props.ml.jobs}
@@ -251,7 +220,7 @@ export function ElasticsearchPanel(props) {
- {i18n.translate('xpack.monitoring.elasticsearch.nodes.metribeatMigration.disableInternalCollectionDescription', {
- defaultMessage: `All of your Elasticsearch servers are monitored using Metricbeat,
- but you need to disable internal collection to finish the migration.`
- })}
-
- {i18n.translate('xpack.monitoring.elasticsearch.nodes.metribeatMigration.netNewUserDescription', {
- defaultMessage: `We did not detect any monitoring data, but we did detect the following Elasticsearch nodes.
- Each detected node is listed below along with a Setup button. Clicking this button will guide you through
- the process of enabling monitoring for each node.`
- })}
-
+ {i18n.translate('xpack.monitoring.elasticsearch.nodes.metricbeatMigration.disableInternalCollectionDescription', {
+ defaultMessage: `Metricbeat is now monitoring your Elasticsearch servers.
+ Disable internal collection to finish the migration.`
+ })}
+
);
}
},
@@ -152,7 +179,7 @@ export class KibanaInstances extends PureComponent {
onTableChange
} = this.props;
- let netNewUserMessage = null;
+ let setupModeCallOut = null;
// Merge the instances data with the setup data if enabled
const instances = this.props.instances || [];
if (setupMode.enabled && setupMode.data) {
@@ -177,29 +204,13 @@ export class KibanaInstances extends PureComponent {
return instances;
}, []));
- const hasInstances = setupMode.data.totalUniqueInstanceCount > 0;
- if (!hasInstances) {
- netNewUserMessage = (
-
-
-
- {i18n.translate('xpack.monitoring.kibana.nodes.metribeatMigration.netNewUserDescription', {
- defaultMessage: `We did not detect any monitoring data, but we did detect the following Kibana instance.
- This detected instance is listed below along with a Setup button. Clicking this button will guide you through
- the process of enabling monitoring for this instance.`
- })}
-
- {i18n.translate('xpack.monitoring.logstash.nodes.metribeatMigration.netNewUserDescription', {
- defaultMessage: `Based on your indices, we think you might have a Logstash node. Click the 'Setup monitoring'
- button below to start monitoring this node.`
- })}
-
-
-
-
+ let setupModeCallOut = null;
+ if (setupMode.enabled && setupMode.data) {
+ setupModeCallOut = (
+
);
}
@@ -154,17 +171,13 @@ export class Listing extends PureComponent {
- {netNewUserMessage}
+ {setupModeCallOut}
- Read more about this migration.
+ {i18n.translate('xpack.monitoring.metricbeatMigration.flyout.learnMore', {
+ defaultMessage: 'Learn about this migration.'
+ })}
);
@@ -264,7 +266,7 @@ export class Flyout extends Component {
}
let title = i18n.translate('xpack.monitoring.metricbeatMigration.flyout.flyoutTitle', {
- defaultMessage: 'Migrate {instanceName} {instanceType} to Metricbeat',
+ defaultMessage: 'Migrate {instanceType} `{instanceName}` with Metricbeat',
values: {
instanceName,
instanceType
@@ -273,7 +275,7 @@ export class Flyout extends Component {
if (product.isNetNewUser) {
title = i18n.translate('xpack.monitoring.metricbeatMigration.flyout.flyoutTitleNewUser', {
- defaultMessage: 'Monitor {instanceName} {instanceType} with Metricbeat',
+ defaultMessage: 'Monitor {instanceType} `{instanceName}` with Metricbeat',
values: {
instanceName,
instanceType
@@ -363,7 +365,7 @@ export class Flyout extends Component {
{this.renderActiveStep()}
{noClusterUuidPrompt}
-
+
@@ -41,7 +41,7 @@ export function getElasticsearchInstructionsForEnablingMetricbeat(product, _meta
>
@@ -67,7 +67,7 @@ export function getElasticsearchInstructionsForEnablingMetricbeat(product, _meta
>
+
+ modules.d/elasticsearch-xpack.yml
@@ -114,14 +121,14 @@ export function getElasticsearchInstructionsForEnablingMetricbeat(product, _meta
const configureMetricbeatStep = {
title: i18n.translate('xpack.monitoring.metricbeatMigration.elasticsearchInstructions.configureMetricbeatTitle', {
- defaultMessage: 'Configure Metricbeat to send to the monitoring cluster'
+ defaultMessage: 'Configure Metricbeat to send data to the monitoring cluster'
}),
children: (
metricbeat.yml
@@ -161,7 +168,7 @@ export function getElasticsearchInstructionsForEnablingMetricbeat(product, _meta
>
@@ -179,8 +186,7 @@ export function getElasticsearchInstructionsForEnablingMetricbeat(product, _meta
size="s"
color="warning"
title={i18n.translate('xpack.monitoring.metricbeatMigration.elasticsearchInstructions.isInternalCollectorStatusTitle', {
- defaultMessage: `We have not detected any monitoring data coming from Metricbeat for this Elasticsearch node.
- We will continuously check in the background.`,
+ defaultMessage: `No monitoring data detected, but we’ll continue checking.`,
})}
/>
)
@@ -204,7 +210,7 @@ export function getElasticsearchInstructionsForEnablingMetricbeat(product, _meta
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
index b0618d36d2d4f..f0a0c1de51653 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/kibana/disable_internal_collection_instructions.js
@@ -27,7 +27,7 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
title={i18n.translate(
'xpack.monitoring.metricbeatMigration.kibanaInstructions.disableInternalCollection.restartWarningTitle',
{
- defaultMessage: 'Warning'
+ defaultMessage: 'This step requires you to restart the Kibana server'
}
)}
color="warning"
@@ -37,8 +37,7 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
@@ -57,7 +56,7 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
kibana.yml
@@ -78,7 +77,7 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
xpack.monitoring.enabled
@@ -108,7 +107,7 @@ export function getKibanaInstructionsForDisablingInternalCollection(product, met
formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
lastInternallyCollectedMessage = (
- {i18n.translate('xpack.monitoring.apm.instances.metricbeatMigration.detectedInstanceDescription', {
- defaultMessage: `Based on your indices, we think you might have an APM server. Click the 'Setup monitoring'
- button below to start monitoring this APM server.`
- })}
-
-
- )
- };
- }
+ const migrationStatusStep = getMigrationStatusStep(product);
return [
installMetricbeatStep,
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/common_beats_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/common_beats_instructions.js
index 0ada632f9779e..8953b8a858d43 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/common_beats_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/common_beats_instructions.js
@@ -3,11 +3,6 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-import { i18n } from '@kbn/i18n';
-
-export const statusTitle = i18n.translate('xpack.monitoring.metricbeatMigration.beatsInstructions.statusTitle', {
- defaultMessage: `Migration status`
-});
export const UNDETECTED_BEAT_TYPE = 'beat';
export const DEFAULT_BEAT_FOR_URLS = 'metricbeat';
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js
index e597de68e30fb..0032997959c09 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/beats/disable_internal_collection_instructions.js
@@ -8,14 +8,12 @@ import React, { Fragment } from 'react';
import {
EuiSpacer,
EuiCodeBlock,
- EuiCallOut,
EuiText
} from '@elastic/eui';
-import { formatTimestampToDuration } from '../../../../../common';
-import { CALCULATE_DURATION_SINCE } from '../../../../../common/constants';
import { Monospace } from '../components/monospace';
import { FormattedMessage } from '@kbn/i18n/react';
-import { statusTitle, UNDETECTED_BEAT_TYPE } from './common_beats_instructions';
+import { UNDETECTED_BEAT_TYPE } from './common_beats_instructions';
+import { getDisableStatusStep } from '../common_instructions';
export function getBeatsInstructionsForDisablingInternalCollection(product, meta) {
const beatType = product.beatType;
@@ -65,81 +63,7 @@ export function getBeatsInstructionsForDisablingInternalCollection(product, meta
)
};
- let migrationStatusStep = null;
- if (!product || !product.isFullyMigrated) {
- let lastInternallyCollectedMessage = '';
- // It is possible that, during the migration steps, products are not reporting
- // monitoring data for a period of time outside the window of our server-side check
- // and this is most likely temporary so we want to be defensive and not error out
- // and hopefully wait for the next check and this state will be self-corrected.
- if (product) {
- const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
- const secondsSinceLastInternalCollectionLabel =
- formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
- lastInternallyCollectedMessage = ();
- }
-
- migrationStatusStep = {
- title: statusTitle,
- status: 'incomplete',
- children: (
-
-
+
+ )
+ };
+ }
+
+ return null;
+}
+
+export function getDisableStatusStep(product, meta) {
+ if (!product || !product.isFullyMigrated) {
+ let lastInternallyCollectedMessage = '';
+ // It is possible that, during the migration steps, products are not reporting
+ // monitoring data for a period of time outside the window of our server-side check
+ // and this is most likely temporary so we want to be defensive and not error out
+ // and hopefully wait for the next check and this state will be self-corrected.
+ if (product) {
+ const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
+ const secondsSinceLastInternalCollectionLabel =
+ formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
+ lastInternallyCollectedMessage = i18n.translate(
+ 'xpack.monitoring.metricbeatMigration.disableInternalCollection.partiallyMigratedStatusDescription',
+ {
+ defaultMessage: 'Last internal collection occurred {secondsSinceLastInternalCollectionLabel} ago.',
+ values: {
+ secondsSinceLastInternalCollectionLabel
+ }
+ }
+ );
+ }
+
+ return {
+ title: MIGRATION_STATUS_LABEL,
+ status: 'incomplete',
+ children: (
+
+
+ {i18n.translate('xpack.monitoring.metricbeatMigration.partiallyMigratedStatusDescription', {
+ defaultMessage: `Note that it can take up to {secondsAgo} seconds to detect,
+ but we will continuously check in the background.`,
+ values: {
+ secondsAgo: meta.secondsAgo
+ }
+ })}
+
+ {i18n.translate('xpack.monitoring.metricbeatMigration.disableInternalCollection.fullyMigratedStatusDescription', {
+ defaultMessage: 'We are not seeing any documents from internal collection. Migration complete!'
+ })}
+
+
+ )
+ };
+}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/elasticsearch/common_elasticsearch_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/elasticsearch/common_elasticsearch_instructions.js
deleted file mode 100644
index 3c55fef3ab7f3..0000000000000
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/elasticsearch/common_elasticsearch_instructions.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-import { i18n } from '@kbn/i18n';
-
-export const statusTitle = i18n.translate('xpack.monitoring.metricbeatMigration.elasticsearchInstructions.statusTitle', {
- defaultMessage: `Migration status`
-});
-
-export const statusTitleNewUser = i18n.translate('xpack.monitoring.metricbeatMigration.elasticsearchInstructions.statusTitleNewUser', {
- defaultMessage: `Monitoring status`
-});
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/elasticsearch/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/elasticsearch/disable_internal_collection_instructions.js
index d09f134b1d299..eb3da8de73e6a 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/elasticsearch/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/elasticsearch/disable_internal_collection_instructions.js
@@ -8,14 +8,11 @@ import React, { Fragment } from 'react';
import {
EuiSpacer,
EuiCodeBlock,
- EuiCallOut,
EuiText
} from '@elastic/eui';
-import { formatTimestampToDuration } from '../../../../../common';
-import { CALCULATE_DURATION_SINCE } from '../../../../../common/constants';
import { Monospace } from '../components/monospace';
import { FormattedMessage } from '@kbn/i18n/react';
-import { statusTitle } from './common_elasticsearch_instructions';
+import { getDisableStatusStep } from '../common_instructions';
export function getElasticsearchInstructionsForDisablingInternalCollection(product, meta) {
const disableInternalCollectionStep = {
@@ -55,81 +52,7 @@ export function getElasticsearchInstructionsForDisablingInternalCollection(produ
)
};
- let migrationStatusStep = null;
- if (!product || !product.isFullyMigrated) {
- let lastInternallyCollectedMessage = '';
- // It is possible that, during the migration steps, products are not reporting
- // monitoring data for a period of time outside the window of our server-side check
- // and this is most likely temporary so we want to be defensive and not error out
- // and hopefully wait for the next check and this state will be self-corrected.
- if (product) {
- const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
- const secondsSinceLastInternalCollectionLabel =
- formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
- lastInternallyCollectedMessage = ();
- }
-
- migrationStatusStep = {
- title: statusTitle,
- status: 'incomplete',
- children: (
-
-
-
- )
- };
- }
+ const migrationStatusStep = getMigrationStatusStep(product);
return [
installMetricbeatStep,
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/common_logstash_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/common_logstash_instructions.js
deleted file mode 100644
index 642add4d43fc4..0000000000000
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/common_logstash_instructions.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-import { i18n } from '@kbn/i18n';
-
-export const statusTitle = i18n.translate('xpack.monitoring.metricbeatMigration.logstashInstructions.statusTitle', {
- defaultMessage: `Migration status`
-});
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js
index 7c7a91eb7e536..4e94606b01f8d 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/logstash/disable_internal_collection_instructions.js
@@ -8,14 +8,11 @@ import React, { Fragment } from 'react';
import {
EuiSpacer,
EuiCodeBlock,
- EuiCallOut,
EuiText
} from '@elastic/eui';
-import { formatTimestampToDuration } from '../../../../../common';
-import { CALCULATE_DURATION_SINCE } from '../../../../../common/constants';
import { Monospace } from '../components/monospace';
import { FormattedMessage } from '@kbn/i18n/react';
-import { statusTitle } from './common_logstash_instructions';
+import { getDisableStatusStep } from '../common_instructions';
export function getLogstashInstructionsForDisablingInternalCollection(product, meta) {
const disableInternalCollectionStep = {
@@ -57,81 +54,7 @@ export function getLogstashInstructionsForDisablingInternalCollection(product, m
)
};
- let migrationStatusStep = null;
- if (!product || !product.isFullyMigrated) {
- let lastInternallyCollectedMessage = '';
- // It is possible that, during the migration steps, products are not reporting
- // monitoring data for a period of time outside the window of our server-side check
- // and this is most likely temporary so we want to be defensive and not error out
- // and hopefully wait for the next check and this state will be self-corrected.
- if (product) {
- const lastInternallyCollectedTimestamp = product.lastInternallyCollectedTimestamp || product.lastTimestamp;
- const secondsSinceLastInternalCollectionLabel =
- formatTimestampToDuration(lastInternallyCollectedTimestamp, CALCULATE_DURATION_SINCE);
- lastInternallyCollectedMessage = ();
- }
-
- migrationStatusStep = {
- title: statusTitle,
- status: 'incomplete',
- children: (
-
-
+ {i18n.translate('xpack.monitoring.elasticsearch.nodes.metricbeatMigration.detectedNodeDescription', {
+ defaultMessage: `The following nodes are not monitored. Click 'Monitor with Metricbeat' below to start monitoring.`,
+ })}
+
+
+
+
+ );
+ }
+ else if (setupMode.data.totalUniquePartiallyMigratedCount === setupMode.data.totalUniqueInstanceCount) {
const finishMigrationAction = _.get(setupMode.meta, 'liveClusterUuid') === clusterUuid
? setupMode.shortcutToFinishMigration
: setupMode.openFlyout;
From 46ef2af0898c18ea35eed02ebba5bf1a79020a60 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Tue, 17 Sep 2019 10:53:33 -0400
Subject: [PATCH 20/43] Custom callout for kibana instances
---
.../components/kibana/instances/instances.js | 35 ++++++++++++++++++-
.../public/components/setup_mode/tooltip.js | 2 +-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/components/kibana/instances/instances.js b/x-pack/legacy/plugins/monitoring/public/components/kibana/instances/instances.js
index 46876740efa41..9e2134baee368 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/kibana/instances/instances.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/kibana/instances/instances.js
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React, { PureComponent } from 'react';
+import React, { PureComponent, Fragment } from 'react';
import {
EuiPage,
EuiPageBody,
@@ -12,6 +12,7 @@ import {
EuiPanel,
EuiSpacer,
EuiLink,
+ EuiCallOut
} from '@elastic/eui';
import { capitalize, get } from 'lodash';
import { ClusterStatus } from '../cluster_status';
@@ -209,6 +210,38 @@ export class KibanaInstances extends PureComponent {
setupModeData={setupMode.data}
useNodeIdentifier={false}
productName={KIBANA_SYSTEM_ID}
+ customRenderer={() => {
+ const customRenderResponse = {
+ shouldRender: false,
+ componentToRender: null
+ };
+
+ const hasInstances = setupMode.data.totalUniqueInstanceCount > 0;
+ if (!hasInstances) {
+ customRenderResponse.shouldRender = true;
+ customRenderResponse.componentToRender = (
+
+
+
+ {i18n.translate('xpack.monitoring.kibana.instances.metricbeatMigration.detectedNodeDescription', {
+ defaultMessage: `The following instances are not monitored.
+ Click 'Monitor with Metricbeat' below to start monitoring.`,
+ })}
+
{i18n.translate('xpack.monitoring.elasticsearch.nodes.metricbeatMigration.disableInternalCollectionDescription', {
- defaultMessage: `Metricbeat is now monitoring your Elasticsearch servers.
- Disable internal collection to finish the migration.`
+ defaultMessage: `Disable internal collection to finish the migration.`
})}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/common_instructions.js b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/common_instructions.js
index 8821b7e02811a..0b55ecabf1fa0 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/common_instructions.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/metricbeat_migration/instruction_steps/common_instructions.js
@@ -34,7 +34,7 @@ export function getSecurityStep(url) {
@@ -137,7 +137,7 @@ export function getDisableStatusStep(product, meta) {
>
{i18n.translate('xpack.monitoring.metricbeatMigration.partiallyMigratedStatusDescription', {
- defaultMessage: `It can take up to {secondsAgo} seconds to detect data, and we’ll continue checking.`,
+ defaultMessage: `It can take up to {secondsAgo} seconds to detect data.`,
values: {
secondsAgo: meta.secondsAgo
}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/renderers/setup_mode.js b/x-pack/legacy/plugins/monitoring/public/components/renderers/setup_mode.js
index 166e31da5ee6d..9c0c8c1f5f882 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/renderers/setup_mode.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/renderers/setup_mode.js
@@ -130,8 +130,8 @@ export class SetupModeRenderer extends React.Component {
diff --git a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js
index fed53052a59bf..f7d89ee80e548 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js
@@ -54,7 +54,7 @@ export function SetupModeBadge({ setupMode, productName, status, instance, clust
{i18n.translate('xpack.monitoring.setupMode.monitorAllNodes', {
- defaultMessage: 'Monitor all nodes with Metricbeat'
+ defaultMessage: 'Some nodes only use internal collection'
})}
- {i18n.translate('xpack.monitoring.setupMode.disableInternalCollectionDescription', {
+ {i18n.translate('xpack.monitoring.setupMode.migrateToMetricbeatDescription', {
defaultMessage: `These {product} {identifier} are monitored through internal collection. Migrate to monitor with Metricbeat.`,
values: {
product: formatProductName(productName),
diff --git a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/tooltip.js b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/tooltip.js
index 1fe3b4fecb205..07079ce11b169 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/tooltip.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/tooltip.js
@@ -57,7 +57,7 @@ export function SetupModeTooltip({ setupModeData, badgeClickAction, productName
tooltip = (
From 7facf4730fe85fb4ae35679e90cc7317e7e0f51a Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Thu, 19 Sep 2019 13:27:36 -0400
Subject: [PATCH 27/43] Update copy
---
.../monitoring/public/components/setup_mode/badge.js | 2 +-
.../public/components/setup_mode/listing_callout.js | 11 +++--------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js
index f7d89ee80e548..fe653af357e99 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/badge.js
@@ -54,7 +54,7 @@ export function SetupModeBadge({ setupMode, productName, status, instance, clust
{i18n.translate('xpack.monitoring.setupMode.monitorAllNodes', {
- defaultMessage: 'Some nodes only use internal collection'
+ defaultMessage: 'Some nodes use only internal collection'
})}
diff --git a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js
index 4e9c1c4bd9e53..9302af1f59c18 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js
@@ -41,12 +41,7 @@ export function ListingCallOut({ setupModeData, productName, customRenderer = nu
>
{i18n.translate('xpack.monitoring.setupMode.detectedNodeDescription', {
- defaultMessage: `Based on your indices, we think you might have a {product} {identifier}. Click 'Set up monitoring'
- below to start monitoring this {identifier}.`,
- values: {
- product: formatProductName(productName),
- identifier: getIdentifier(productName)
- }
+ defaultMessage: `Click 'Set up monitoring' below to start monitoring this {identifier}.`
})}
@@ -58,7 +53,7 @@ export function ListingCallOut({ setupModeData, productName, customRenderer = nu
{i18n.translate('xpack.monitoring.setupMode.netNewUserDescription', {
- defaultMessage: `If you have {product} {identifier}, click 'Set up monitoring' below to monitor with Metricbeat.`,
+ defaultMessage: `Click 'Set up monitoring' to start monitoring with Metricbeat.`,
values: {
product: formatProductName(productName),
identifier: getIdentifier(productName, true)
From b9c29a80a6e1a0dda951d701b18122a7e8b69335 Mon Sep 17 00:00:00 2001
From: chrisronline
Date: Fri, 20 Sep 2019 09:10:07 -0400
Subject: [PATCH 28/43] Fix a couple i18n issues
---
.../public/components/setup_mode/listing_callout.js | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js
index 9302af1f59c18..f57ea68dd2278 100644
--- a/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js
+++ b/x-pack/legacy/plugins/monitoring/public/components/setup_mode/listing_callout.js
@@ -41,7 +41,10 @@ export function ListingCallOut({ setupModeData, productName, customRenderer = nu
>
{i18n.translate('xpack.monitoring.setupMode.detectedNodeDescription', {
- defaultMessage: `Click 'Set up monitoring' below to start monitoring this {identifier}.`
+ defaultMessage: `Click 'Set up monitoring' below to start monitoring this {identifier}.`,
+ values: {
+ identifier: getIdentifier(productName)
+ }
})}
@@ -64,10 +67,6 @@ export function ListingCallOut({ setupModeData, productName, customRenderer = nu
{i18n.translate('xpack.monitoring.setupMode.netNewUserDescription', {
defaultMessage: `Click 'Set up monitoring' to start monitoring with Metricbeat.`,
- values: {
- product: formatProductName(productName),
- identifier: getIdentifier(productName, true)
- }
})}