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

[6.x] [Beats] Add space.id to all filebeat and metricbeat tutorials (#22998) #23689

Merged
merged 1 commit into from
Oct 4, 2018
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
@@ -0,0 +1,32 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
* Returns valid configuration for a beat.yml file for adding the space id
* if there is an active space and that space is not the default one.
*
* @param {object} context - Context object generated from tutorial factory (see #22760)
*/
export function getSpaceIdForBeatsTutorial(context) {
if (!context || !context.spaceId || context.isInDefaultSpace) {
return '';
}

return ` space.id: "${context.spaceId}"`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import { i18n } from '@kbn/i18n';
import { INSTRUCTION_VARIANT } from './instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial';

export const createFilebeatInstructions = () => ({
export const createFilebeatInstructions = context => ({
INSTALL: {
OSX: {
title: i18n.translate('kbn.common.tutorials.filebeatInstructions.install.osxTitle', {
Expand Down Expand Up @@ -181,6 +182,7 @@ export const createFilebeatInstructions = () => ({
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.osxTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -209,6 +211,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.',
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.debTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -237,6 +240,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.',
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.rpmTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -265,6 +269,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.',
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.filebeatInstructions.config.windowsTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -484,8 +489,8 @@ export function filebeatStatusCheck(moduleName) {
};
}

export function onPremInstructions(moduleName, platforms, geoipRequired, uaRequired) {
const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions();
export function onPremInstructions(moduleName, platforms, geoipRequired, uaRequired, context) {
const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(context);

const variants = [];
for (let i = 0; i < platforms.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import { i18n } from '@kbn/i18n';
import { INSTRUCTION_VARIANT } from './instruction_variant';
import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions';
import { getSpaceIdForBeatsTutorial } from '../lib/get_space_id_for_beats_tutorial';

export const createMetricbeatInstructions = () => ({
export const createMetricbeatInstructions = context => ({
INSTALL: {
OSX: {
title: i18n.translate('kbn.common.tutorials.metricbeatInstructions.install.osxTitle', {
Expand Down Expand Up @@ -168,6 +169,7 @@ export const createMetricbeatInstructions = () => ({
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.osxTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -196,6 +198,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.',
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.debTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -224,6 +227,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.',
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.rpmTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -252,6 +256,7 @@ and {kibanaUrlTemplate} is the URL of Kibana.',
' password: "<password>"',
'setup.kibana:',
' host: "<kibana_url>"',
getSpaceIdForBeatsTutorial(context)
],
textPost: i18n.translate('kbn.common.tutorials.metricbeatInstructions.config.windowsTextPost', {
defaultMessage: 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
Expand Down Expand Up @@ -444,8 +449,8 @@ export function metricbeatStatusCheck(moduleName) {
};
}

export function onPremInstructions(moduleName) {
const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions();
export function onPremInstructions(moduleName, platforms, geoipRequired, uaRequired, context) {
const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions(context);

return {
instructionSets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function aerospikeMetricsSpecProvider() {
export function aerospikeMetricsSpecProvider(server, context) {
const moduleName = 'aerospike';
return {
id: 'aerospikeMetrics',
Expand Down Expand Up @@ -53,7 +53,7 @@ export function aerospikeMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
4 changes: 2 additions & 2 deletions src/core_plugins/kibana/server/tutorials/apache_logs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function apacheLogsSpecProvider() {
export function apacheLogsSpecProvider(server, context) {
const moduleName = 'apache2';
const geoipRequired = true;
const uaRequired = true;
Expand Down Expand Up @@ -59,7 +59,7 @@ export function apacheLogsSpecProvider() {
},
completionTimeMinutes: 10,
previewImagePath: '/plugins/kibana/home/tutorial_resources/apache_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, geoipRequired, uaRequired),
onPrem: onPremInstructions(moduleName, platforms, geoipRequired, uaRequired, context),
elasticCloud: cloudInstructions(moduleName, platforms),
onPremElasticCloud: onPremCloudInstructions(moduleName, platforms)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function apacheMetricsSpecProvider() {
export function apacheMetricsSpecProvider(server, context) {
const moduleName = 'apache';
return {
id: 'apacheMetrics',
Expand Down Expand Up @@ -56,7 +56,7 @@ export function apacheMetricsSpecProvider() {
},
completionTimeMinutes: 10,
previewImagePath: '/plugins/kibana/home/tutorial_resources/apache_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function cephMetricsSpecProvider() {
export function cephMetricsSpecProvider(server, context) {
const moduleName = 'ceph';
return {
id: 'cephMetrics',
Expand Down Expand Up @@ -53,7 +53,7 @@ export function cephMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function couchbaseMetricsSpecProvider() {
export function couchbaseMetricsSpecProvider(server, context) {
const moduleName = 'couchbase';
return {
id: 'couchbaseMetrics',
Expand Down Expand Up @@ -53,7 +53,7 @@ export function couchbaseMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function dockerMetricsSpecProvider() {
export function dockerMetricsSpecProvider(server, context) {
const moduleName = 'docker';
return {
id: 'dockerMetrics',
Expand Down Expand Up @@ -56,7 +56,7 @@ export function dockerMetricsSpecProvider() {
},
completionTimeMinutes: 10,
previewImagePath: '/plugins/kibana/home/tutorial_resources/docker_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function dropwizardMetricsSpecProvider() {
export function dropwizardMetricsSpecProvider(server, context) {
const moduleName = 'dropwizard';
return {
id: 'dropwizardMetrics',
Expand Down Expand Up @@ -53,7 +53,7 @@ export function dropwizardMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function elasticsearchMetricsSpecProvider() {
export function elasticsearchMetricsSpecProvider(server, context) {
const moduleName = 'elasticsearch';
return {
id: 'elasticsearchMetrics',
Expand Down Expand Up @@ -54,7 +54,7 @@ export function elasticsearchMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function etcdMetricsSpecProvider() {
export function etcdMetricsSpecProvider(server, context) {
const moduleName = 'etcd';
return {
id: 'etcdMetrics',
Expand Down Expand Up @@ -53,7 +53,7 @@ export function etcdMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function golangMetricsSpecProvider() {
export function golangMetricsSpecProvider(server, context) {
const moduleName = 'golang';
return {
id: moduleName + 'Metrics',
Expand Down Expand Up @@ -56,7 +56,7 @@ export function golangMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function haproxyMetricsSpecProvider() {
export function haproxyMetricsSpecProvider(server, context) {
const moduleName = 'haproxy';
return {
id: 'haproxyMetrics',
Expand Down Expand Up @@ -53,7 +53,7 @@ export function haproxyMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
4 changes: 2 additions & 2 deletions src/core_plugins/kibana/server/tutorials/kafka_logs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/filebeat_instructions';

export function kafkaLogsSpecProvider() {
export function kafkaLogsSpecProvider(server, context) {
const moduleName = 'kafka';
const geoipRequired = false;
const uaRequired = false;
Expand Down Expand Up @@ -59,7 +59,7 @@ export function kafkaLogsSpecProvider() {
},
completionTimeMinutes: 10,
previewImagePath: '/plugins/kibana/home/tutorial_resources/kafka_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, geoipRequired, uaRequired),
onPrem: onPremInstructions(moduleName, platforms, geoipRequired, uaRequired, context),
elasticCloud: cloudInstructions(moduleName, platforms),
onPremElasticCloud: onPremCloudInstructions(moduleName, platforms)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function kafkaMetricsSpecProvider() {
export function kafkaMetricsSpecProvider(server, context) {
const moduleName = 'kafka';
return {
id: 'kafkaMetrics',
Expand Down Expand Up @@ -53,7 +53,7 @@ export function kafkaMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category';
import { onPremInstructions, cloudInstructions, onPremCloudInstructions } from '../../../common/tutorials/metricbeat_instructions';

export function kibanaMetricsSpecProvider() {
export function kibanaMetricsSpecProvider(server, context) {
const moduleName = 'kibana';
return {
id: 'kibanaMetrics',
Expand Down Expand Up @@ -54,7 +54,7 @@ export function kibanaMetricsSpecProvider() {
}
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName),
onPrem: onPremInstructions(moduleName, null, null, null, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName)
};
Expand Down
Loading