From c750d500e35ef1eee1d9ecc858ae53020bcae05d Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 21 Dec 2017 08:32:12 -0800 Subject: [PATCH] [Tutorials] Netflow: instructions for onPremCloud (#18) * Extract common on-prem cloud instructions so LS and Beats can share them * Extracting common instructions; adding onPremCloud instructions --- .../filebeat_onprem_cloud_instructions.js | 15 --------- .../tutorials/onprem_cloud_instructions.js | 16 ++++++++++ .../apache_logs/on_prem_elastic_cloud.js | 20 +++++++----- .../tutorials/netflow/common_instructions.js | 32 +++++++++++++++++++ .../server/tutorials/netflow/elastic_cloud.js | 1 + .../server/tutorials/netflow/on_prem.js | 23 +++---------- .../netflow/on_prem_elastic_cloud.js | 15 +++++++-- 7 files changed, 77 insertions(+), 45 deletions(-) create mode 100644 src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js create mode 100644 src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js diff --git a/src/core_plugins/kibana/common/tutorials/filebeat_onprem_cloud_instructions.js b/src/core_plugins/kibana/common/tutorials/filebeat_onprem_cloud_instructions.js index c940202259586..f7d80c448e38c 100644 --- a/src/core_plugins/kibana/common/tutorials/filebeat_onprem_cloud_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/filebeat_onprem_cloud_instructions.js @@ -1,19 +1,4 @@ export const FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS = { - TRYCLOUD_OPTION1: { - title: 'Option 1: Try module in Elastic Cloud', - textPre: 'Go to [Elastic Cloud](https://cloud.elastic.co/). Register if you ' + - 'don\'t have an account.\n' + - ' * Select **Create Cluster**, leave size slider at 4 GB RAM, and click **Create**\n' + - ' * Wait for the cluster plan to complete.\n' + - ' * Go to the new Cloud Kibana instance and follow the Kibana Home instructions.' - - }, - TRYCLOUD_OPTION2: { - title: 'Option 2: Local Kibana connected to a Cloud instance', - textPre: 'If you are running this Kibana instance against a hosted Elasticsearch instance,' + - ' proceed with manual setup.\n' + - ' * In **Overview >> Endpoints** note **Elasticsearch** as ``' - }, CONFIG: { OSX: { title: 'Edit the configuration', diff --git a/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js b/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js new file mode 100644 index 0000000000000..f429e484de026 --- /dev/null +++ b/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js @@ -0,0 +1,16 @@ +export const TRYCLOUD_OPTION1 = { + title: 'Option 1: Try module in Elastic Cloud', + textPre: 'Go to [Elastic Cloud](https://cloud.elastic.co/). Register if you ' + + 'don\'t have an account.\n' + + ' * Select **Create Cluster**, leave size slider at 4 GB RAM, and click **Create**\n' + + ' * Wait for the cluster plan to complete.\n' + + ' * Go to the new Cloud Kibana instance and follow the Kibana Home instructions.' + +}; + +export const TRYCLOUD_OPTION2 = { + title: 'Option 2: Local Kibana connected to a Cloud instance', + textPre: 'If you are running this Kibana instance against a hosted Elasticsearch instance,' + + ' proceed with manual setup.\n' + + ' * In **Overview >> Endpoints** note **Elasticsearch** as ``' +}; diff --git a/src/core_plugins/kibana/server/tutorials/apache_logs/on_prem_elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/apache_logs/on_prem_elastic_cloud.js index 7a9a65dbe462d..4b06002a996f0 100644 --- a/src/core_plugins/kibana/server/tutorials/apache_logs/on_prem_elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/apache_logs/on_prem_elastic_cloud.js @@ -2,6 +2,10 @@ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_varia import { FILEBEAT_INSTRUCTIONS } from '../../../common/tutorials/filebeat_instructions'; import { FILEBEAT_CLOUD_INSTRUCTIONS } from '../../../common/tutorials/filebeat_cloud_instructions'; import { FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS } from '../../../common/tutorials/filebeat_onprem_cloud_instructions'; +import { + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2 +} from '../../../common/tutorials/onprem_cloud_instructions'; export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { instructionSets: [ @@ -11,8 +15,8 @@ export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { { id: INSTRUCTION_VARIANT.OSX, instructions: [ - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION1, - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION2, + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2, FILEBEAT_CLOUD_INSTRUCTIONS.INSTALL.OSX, FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.CONFIG.OSX, { @@ -29,8 +33,8 @@ export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { { id: INSTRUCTION_VARIANT.DEB, instructions: [ - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION1, - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION2, + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2, FILEBEAT_CLOUD_INSTRUCTIONS.INSTALL.DEB, FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.CONFIG.DEB, { @@ -46,8 +50,8 @@ export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { { id: INSTRUCTION_VARIANT.RPM, instructions: [ - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION1, - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION2, + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2, FILEBEAT_CLOUD_INSTRUCTIONS.INSTALL.RPM, FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.CONFIG.RPM, { @@ -63,8 +67,8 @@ export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { { id: INSTRUCTION_VARIANT.WINDOWS, instructions: [ - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION1, - FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.TRYCLOUD_OPTION2, + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2, FILEBEAT_CLOUD_INSTRUCTIONS.INSTALL.WINDOWS, FILEBEAT_ONPREM_CLOUD_INSTRUCTIONS.CONFIG.WINDOWS, { diff --git a/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js b/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js new file mode 100644 index 0000000000000..a4ed13ebfb5e1 --- /dev/null +++ b/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js @@ -0,0 +1,32 @@ +export const COMMON_NETFLOW_INSTRUCTIONS = { + CONFIG: { + OSX: [ + { + title: 'Edit the configuration', + textPre: 'While in the Logstash install directory, modify `config/logstash.yml` to set the' + + ' configuration parameters for the Netflow module:', + commands: [ + 'modules:', + ' - name: netflow', + ' var.input.udp.port: ', + ' var.elasticsearch.hosts: [ "" ]', + ' var.kibana.host: ":"' + ] + } + ] + }, + SETUP: { + OSX: [ + { + title: 'Set up and run the Netflow module', + textPre: 'In the Logstash install directory, run the following command to set up the Netflow module.', + commands: [ + './bin/logstash --modules netflow --setup', + ], + textPost: 'The `--setup` option creates a `netflow-*` index pattern in Elasticsearch and imports' + + ' Kibana dashboards and visualizations. Omit this option for subsequent runs of the module to avoid' + + ' overwriting existing Kibana dashboards.' + } + ] + } +}; diff --git a/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js index 058a16196e394..cd1923e8bfcae 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js @@ -1,5 +1,6 @@ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; +// TODO: compare with onPremElasticCloud and onPrem scenarios and extract out common bits export const ELASTIC_CLOUD_INSTRUCTIONS = { instructionSets: [ { diff --git a/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js b/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js index 536c55bf5cef8..f5a9ae2a7466c 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js @@ -1,16 +1,9 @@ -import { PARAM_TYPES } from '../../../common/tutorials/param_types'; import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; +import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; +// TODO: compare with onPremElasticCloud and elasticCloud scenarios and extract out common bits export const ON_PREM_INSTRUCTIONS = { - params: [ - { - id: 'netflow_var_input_udp_port', - label: 'netflow.var.input.udp.port', - type: PARAM_TYPES.NUMBER, - defaultValue: 2055 - } - ], instructionSets: [ { title: 'Getting Started', @@ -19,16 +12,8 @@ export const ON_PREM_INSTRUCTIONS = { id: INSTRUCTION_VARIANT.OSX, instructions: [ ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, - { - title: 'Set up and run the Netflow module', - textPre: 'In the Logstash install directory, run the following command to set up the Netflow module.', - commands: [ - './bin/logstash --modules netflow -M netflow.var.input.udp.port={params.netflow_var_input_udp_port} --setup', - ], - textPost: 'The `--setup` option creates a `netflow-*` index pattern in Elasticsearch and imports' + - ' Kibana dashboards and visualizations. Omit this option for subsequent runs of the module to avoid' + - ' overwriting existing Kibana dashboards.' - } + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX ] } ] diff --git a/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js index e01007c368606..167eac24a25e2 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js @@ -1,5 +1,12 @@ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; +import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; +import { + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2 +} from '../../../common/tutorials/onprem_cloud_instructions'; +import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; +// TODO: compare with onPrem and elasticCloud scenarios and extract out common bits export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { instructionSets: [ { @@ -8,9 +15,11 @@ export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { { id: INSTRUCTION_VARIANT.OSX, instructions: [ - { - title: 'onPremElasticCloud instructions - TBD', - } + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2, + ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX ] } ]