From 746dd32b8c9e959268dda50afdd21d1d7e80d9d2 Mon Sep 17 00:00:00 2001 From: Leanid Shutau Date: Mon, 20 Aug 2018 18:14:14 +0300 Subject: [PATCH 1/4] Wrap consts in kibana tutorials --- .../common/tutorials/filebeat_instructions.js | 484 ++++++++--------- .../common/tutorials/logstash_instructions.js | 70 +-- .../tutorials/metricbeat_instructions.js | 491 +++++++++--------- .../tutorials/onprem_cloud_instructions.js | 45 +- .../tutorials/apm/apm_client_instructions.js | 352 +++++++------ .../tutorials/apm/apm_server_instructions.js | 161 +++--- .../server/tutorials/apm/elastic_cloud.js | 113 ++-- .../kibana/server/tutorials/apm/index.js | 19 +- .../kibana/server/tutorials/apm/on_prem.js | 72 ++- .../tutorials/netflow/common_instructions.js | 234 ++++----- .../server/tutorials/netflow/elastic_cloud.js | 59 ++- .../kibana/server/tutorials/netflow/index.js | 15 +- .../server/tutorials/netflow/on_prem.js | 59 ++- .../netflow/on_prem_elastic_cloud.js | 73 +-- 14 files changed, 1153 insertions(+), 1094 deletions(-) diff --git a/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js b/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js index 6ba8f0ec697cf..0dbca9cbeb405 100644 --- a/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js @@ -18,251 +18,242 @@ */ import { INSTRUCTION_VARIANT } from './instruction_variant'; -import { - TRYCLOUD_OPTION1, - TRYCLOUD_OPTION2 -} from './onprem_cloud_instructions'; +import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -export const FILEBEAT_INSTRUCTIONS = { - INSTALL: { - OSX: { - title: 'Download and install Filebeat', - textPre: 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'tar xzvf filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'cd filebeat-{config.kibana.version}-darwin-x86_64/', - ] - }, - DEB: { - title: 'Download and install Filebeat', - textPre: 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-amd64.deb', - 'sudo dpkg -i filebeat-{config.kibana.version}-amd64.deb' - ], - textPost: 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).' - }, - RPM: { - title: 'Download and install Filebeat', - textPre: 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-x86_64.rpm', - 'sudo rpm -vi filebeat-{config.kibana.version}-x86_64.rpm' - ], - textPost: 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).' - }, - WINDOWS: { - title: 'Download and install Filebeat', - textPre: 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).\n' + - '1. Download the Filebeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/filebeat) page.\n' + - '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + - '3. Rename the `filebeat-{config.kibana.version}-windows` directory to `Filebeat`.\n' + - '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + - ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + - '5. From the PowerShell prompt, run the following commands to install Filebeat as a Windows service.', - commands: [ - 'PS > cd C:\\Program Files\\Filebeat', - 'PS C:\\Program Files\\Filebeat> .\\install-service-filebeat.ps1' - ], - textPost: 'Modify the settings under `output.elasticsearch` in the ' + - '`C:\\Program Files\\Filebeat\\filebeat.yml` file to point to your Elasticsearch installation.' - } - }, - START: { - OSX: { - title: 'Start Filebeat', - textPre: 'The `setup` command loads the Kibana dashboards.' + - ' If the dashboards are already set up, omit this command.', - commands: [ - './filebeat setup', - './filebeat -e', - ] - }, - DEB: { - title: 'Start Filebeat', - textPre: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'sudo filebeat setup', - 'sudo service filebeat start', - ] - }, - RPM: { - title: 'Start Filebeat', - textPre: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'sudo filebeat setup', - 'sudo service filebeat start', - ], +export function createFilebeatInstructions() { + return { + INSTALL: { + OSX: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'tar xzvf filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'cd filebeat-{config.kibana.version}-darwin-x86_64/', + ], + }, + DEB: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-amd64.deb', + 'sudo dpkg -i filebeat-{config.kibana.version}-amd64.deb', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).', + }, + RPM: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-x86_64.rpm', + 'sudo rpm -vi filebeat-{config.kibana.version}-x86_64.rpm', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).', + }, + WINDOWS: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).\n' + + '1. Download the Filebeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/filebeat) page.\n' + + '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + + '3. Rename the `filebeat-{config.kibana.version}-windows` directory to `Filebeat`.\n' + + '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + + ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + + '5. From the PowerShell prompt, run the following commands to install Filebeat as a Windows service.', + commands: [ + 'PS > cd C:\\Program Files\\Filebeat', + 'PS C:\\Program Files\\Filebeat> .\\install-service-filebeat.ps1', + ], + textPost: + 'Modify the settings under `output.elasticsearch` in the ' + + '`C:\\Program Files\\Filebeat\\filebeat.yml` file to point to your Elasticsearch installation.', + }, }, - WINDOWS: { - title: 'Start Filebeat', - textPre: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'PS C:\\Program Files\\Filebeat> filebeat.exe setup', - 'PS C:\\Program Files\\Filebeat> Start-Service filebeat', - ] - } - }, - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' + START: { + OSX: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards.' + + ' If the dashboards are already set up, omit this command.', + commands: ['./filebeat setup', './filebeat -e'], + }, + DEB: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo filebeat setup', 'sudo service filebeat start'], + }, + RPM: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo filebeat setup', 'sudo service filebeat start'], + }, + WINDOWS: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: [ + 'PS C:\\Program Files\\Filebeat> filebeat.exe setup', + 'PS C:\\Program Files\\Filebeat> Start-Service filebeat', + ], + }, }, - DEB: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + DEB: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + RPM: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, }, - RPM: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' + PLUGINS: { + GEOIP_AND_UA: { + title: 'Install Elasticsearch GeoIP and user agent plugins', + textPre: + 'This module requires two Elasticsearch plugins that are not ' + + 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', + commands: [ + 'bin/elasticsearch-plugin install ingest-geoip', + 'bin/elasticsearch-plugin install ingest-user-agent', + ], + }, + GEOIP: { + title: 'Install Elasticsearch GeoIP plugin', + textPre: + 'This module requires an Elasticsearch plugin that is not ' + + 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', + commands: ['bin/elasticsearch-plugin install ingest-geoip'], + }, }, - WINDOWS: { - title: 'Edit the configuration', - textPre: 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' - } - }, - PLUGINS: { - GEOIP_AND_UA: { - title: 'Install Elasticsearch GeoIP and user agent plugins', - textPre: 'This module requires two Elasticsearch plugins that are not ' + - 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', - commands: [ - 'bin/elasticsearch-plugin install ingest-geoip', - 'bin/elasticsearch-plugin install ingest-user-agent' - ] - }, - GEOIP: { - title: 'Install Elasticsearch GeoIP plugin', - textPre: 'This module requires an Elasticsearch plugin that is not ' + - 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', - commands: [ - 'bin/elasticsearch-plugin install ingest-geoip' - ] - } - } -}; + }; +} -export const FILEBEAT_CLOUD_INSTRUCTIONS = { - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `filebeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' - }, - DEB: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' - }, - RPM: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' +export function createFilebeatCloudInstructions() { + return { + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + DEB: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + RPM: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, }, - WINDOWS: { - title: 'Edit the configuration', - textPre: 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' - } - } -}; + }; +} export function filebeatEnableInstructions(moduleName) { return { OSX: { title: 'Enable and configure the ' + moduleName + ' module', textPre: 'From the installation directory, run:', - commands: [ - './filebeat modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.' + commands: ['./filebeat modules enable ' + moduleName], + textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.', }, DEB: { title: 'Enable and configure the ' + moduleName + ' module', - commands: [ - 'sudo filebeat modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `/etc/filebeat/modules.d/' + moduleName + '.yml` file.' + commands: ['sudo filebeat modules enable ' + moduleName], + textPost: 'Modify the settings in the `/etc/filebeat/modules.d/' + moduleName + '.yml` file.', }, RPM: { title: 'Enable and configure the ' + moduleName + ' module', - commands: [ - 'sudo filebeat modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `/etc/filebeat/modules.d/' + moduleName + '.yml` file.' + commands: ['sudo filebeat modules enable ' + moduleName], + textPost: 'Modify the settings in the `/etc/filebeat/modules.d/' + moduleName + '.yml` file.', }, WINDOWS: { title: 'Enable and configure the ' + moduleName + ' module', textPre: 'From the `C:\\Program Files\\Filebeat` folder, run:', - commands: [ - 'PS C:\\Program Files\\Filebeat> filebeat.exe modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.' - } + commands: ['PS C:\\Program Files\\Filebeat> filebeat.exe modules enable ' + moduleName], + textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.', + }, }; } @@ -279,16 +270,18 @@ export function filebeatStatusCheck(moduleName) { bool: { filter: { term: { - 'fileset.module': moduleName - } - } - } - } - } + 'fileset.module': moduleName, + }, + }, + }, + }, + }, }; } export function onPremInstructions(moduleName, platforms, geoipRequired, uaRequired) { + const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(); + const variants = []; for (let i = 0; i < platforms.length; i++) { const platform = platforms[i]; @@ -304,7 +297,7 @@ export function onPremInstructions(moduleName, platforms, geoipRequired, uaRequi instructions.push(FILEBEAT_INSTRUCTIONS.START[platform]); variants.push({ id: INSTRUCTION_VARIANT[platform], - instructions: instructions + instructions: instructions, }); } return { @@ -312,13 +305,17 @@ export function onPremInstructions(moduleName, platforms, geoipRequired, uaRequi { title: 'Getting Started', instructionVariants: variants, - statusCheck: filebeatStatusCheck(moduleName) - } - ] + statusCheck: filebeatStatusCheck(moduleName), + }, + ], }; } export function onPremCloudInstructions(moduleName, platforms) { + const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(); + const TRYCLOUD_OPTION1 = createTrycloudOption1(); + const TRYCLOUD_OPTION2 = createTrycloudOption2(); + const variants = []; for (let i = 0; i < platforms.length; i++) { const platform = platforms[i]; @@ -330,8 +327,8 @@ export function onPremCloudInstructions(moduleName, platforms) { FILEBEAT_INSTRUCTIONS.INSTALL[platform], FILEBEAT_INSTRUCTIONS.CONFIG[platform], filebeatEnableInstructions(moduleName)[platform], - FILEBEAT_INSTRUCTIONS.START[platform] - ] + FILEBEAT_INSTRUCTIONS.START[platform], + ], }); } @@ -340,13 +337,16 @@ export function onPremCloudInstructions(moduleName, platforms) { { title: 'Getting Started', instructionVariants: variants, - statusCheck: filebeatStatusCheck(moduleName) - } - ] + statusCheck: filebeatStatusCheck(moduleName), + }, + ], }; } export function cloudInstructions(moduleName, platforms) { + const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(); + const FILEBEAT_CLOUD_INSTRUCTIONS = createFilebeatCloudInstructions(); + const variants = []; for (let i = 0; i < platforms.length; i++) { const platform = platforms[i]; @@ -356,8 +356,8 @@ export function cloudInstructions(moduleName, platforms) { FILEBEAT_INSTRUCTIONS.INSTALL[platform], FILEBEAT_CLOUD_INSTRUCTIONS.CONFIG[platform], filebeatEnableInstructions(moduleName)[platform], - FILEBEAT_INSTRUCTIONS.START[platform] - ] + FILEBEAT_INSTRUCTIONS.START[platform], + ], }); } @@ -366,8 +366,8 @@ export function cloudInstructions(moduleName, platforms) { { title: 'Getting Started', instructionVariants: variants, - statusCheck: filebeatStatusCheck(moduleName) - } - ] + statusCheck: filebeatStatusCheck(moduleName), + }, + ], }; } diff --git a/src/core_plugins/kibana/common/tutorials/logstash_instructions.js b/src/core_plugins/kibana/common/tutorials/logstash_instructions.js index c231fda0a6152..290eff545d8a4 100644 --- a/src/core_plugins/kibana/common/tutorials/logstash_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/logstash_instructions.js @@ -17,35 +17,41 @@ * under the License. */ -export const LOGSTASH_INSTRUCTIONS = { - INSTALL: { - OSX: [ - { - title: 'Download and install the Java Runtime Environment', - textPre: 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jre.html).' - }, - { - title: 'Download and install Logstash', - textPre: 'First time using Logstash? See the ' + - '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.tar.gz', - 'tar xzvf logstash-{config.kibana.version}.tar.gz' - ] - } - ], - WINDOWS: [ - { - title: 'Download and install the Java Runtime Environment', - textPre: 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jre_install.html).' - }, - { - title: 'Download and install Logstash', - textPre: 'First time using Logstash? See the ' + - '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).\n' + - ' 1. [Download](https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.zip) the Logstash Windows zip file.\n' + - ' 2. Extract the contents of the zip file.' - } - ], - } -}; +export function createLogstashInstructions() { + return { + INSTALL: { + OSX: [ + { + title: 'Download and install the Java Runtime Environment', + textPre: + 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jre.html).', + }, + { + title: 'Download and install Logstash', + textPre: + 'First time using Logstash? See the ' + + '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.tar.gz', + 'tar xzvf logstash-{config.kibana.version}.tar.gz', + ], + }, + ], + WINDOWS: [ + { + title: 'Download and install the Java Runtime Environment', + textPre: + 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jre_install.html).', + }, + { + title: 'Download and install Logstash', + textPre: + 'First time using Logstash? See the ' + + '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).\n' + + ' 1. [Download](https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.zip) the Logstash Windows zip file.\n' + + ' 2. Extract the contents of the zip file.', + }, + ], + }, + }; +} diff --git a/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js b/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js index 13a9aabb5a60b..c48642741ba60 100644 --- a/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js @@ -18,229 +18,225 @@ */ import { INSTRUCTION_VARIANT } from './instruction_variant'; -import { TRYCLOUD_OPTION1, TRYCLOUD_OPTION2 } from './onprem_cloud_instructions'; +import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -export const METRICBEAT_INSTRUCTIONS = { - INSTALL: { - OSX: { - title: 'Download and install Metricbeat', - textPre: 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'tar xzvf metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'cd metricbeat-{config.kibana.version}-darwin-x86_64/', - ] - }, - DEB: { - title: 'Download and install Metricbeat', - textPre: 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-amd64.deb', - 'sudo dpkg -i metricbeat-{config.kibana.version}-amd64.deb' - ], - textPost: 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).' - }, - RPM: { - title: 'Download and install Metricbeat', - textPre: 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-x86_64.rpm', - 'sudo rpm -vi metricbeat-{config.kibana.version}-x86_64.rpm' - ], - textPost: 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).' - }, - WINDOWS: { - title: 'Download and install Metricbeat', - textPre: 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).\n' + - '1. Download the Metricbeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/metricbeat) page.\n' + - '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + - '3. Rename the `metricbeat-{config.kibana.version}-windows` directory to `Metricbeat`.\n' + - '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + - ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + - '5. From the PowerShell prompt, run the following commands to install Metricbeat as a Windows service.', - commands: [ - 'PS > cd C:\\Program Files\\Metricbeat', - 'PS C:\\Program Files\\Metricbeat> .\\install-service-metricbeat.ps1' - ], - textPost: 'Modify the settings under `output.elasticsearch` in the ' + - '`C:\\Program Files\\Metricbeat\\metricbeat.yml` file to point to your Elasticsearch installation.' - } - }, - START: { - OSX: { - title: 'Start Metricbeat', - textPre: 'The `setup` command loads the Kibana dashboards.' + - ' If the dashboards are already set up, omit this command.', - commands: [ - './metricbeat setup', - './metricbeat -e', - ] - }, - DEB: { - title: 'Start Metricbeat', - textPre: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'sudo metricbeat setup', - 'sudo service metricbeat start', - ] - }, - RPM: { - title: 'Start Metricbeat', - textPre: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'sudo metricbeat setup', - 'sudo service metricbeat start', - ], - }, - WINDOWS: { - title: 'Start Metricbeat', - textPre: 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'PS C:\\Program Files\\Metricbeat> metricbeat.exe setup', - 'PS C:\\Program Files\\Metricbeat> Start-Service metricbeat', - ] - } - }, - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' +export function createMetricbeatInstructions() { + return { + INSTALL: { + OSX: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'tar xzvf metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'cd metricbeat-{config.kibana.version}-darwin-x86_64/', + ], + }, + DEB: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-amd64.deb', + 'sudo dpkg -i metricbeat-{config.kibana.version}-amd64.deb', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).', + }, + RPM: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-x86_64.rpm', + 'sudo rpm -vi metricbeat-{config.kibana.version}-x86_64.rpm', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).', + }, + WINDOWS: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).\n' + + '1. Download the Metricbeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/metricbeat) page.\n' + + '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + + '3. Rename the `metricbeat-{config.kibana.version}-windows` directory to `Metricbeat`.\n' + + '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + + ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + + '5. From the PowerShell prompt, run the following commands to install Metricbeat as a Windows service.', + commands: [ + 'PS > cd C:\\Program Files\\Metricbeat', + 'PS C:\\Program Files\\Metricbeat> .\\install-service-metricbeat.ps1', + ], + textPost: + 'Modify the settings under `output.elasticsearch` in the ' + + '`C:\\Program Files\\Metricbeat\\metricbeat.yml` file to point to your Elasticsearch installation.', + }, }, - DEB: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' + START: { + OSX: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards.' + + ' If the dashboards are already set up, omit this command.', + commands: ['./metricbeat setup', './metricbeat -e'], + }, + DEB: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], + }, + RPM: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], + }, + WINDOWS: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: [ + 'PS C:\\Program Files\\Metricbeat> metricbeat.exe setup', + 'PS C:\\Program Files\\Metricbeat> Start-Service metricbeat', + ], + }, }, - RPM: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + DEB: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + RPM: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Metricbeat\\metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, }, - WINDOWS: { - title: 'Edit the configuration', - textPre: 'Modify `C:\\Program Files\\Metricbeat\\metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""' - ], - textPost: 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.' - } - } -}; + }; +} -export const METRICBEAT_CLOUD_INSTRUCTIONS = { - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' - }, - DEB: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' - }, - RPM: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' +export function createMetricbeatCloudInstructions() { + return { + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + DEB: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + RPM: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Filebeat\\metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, }, - WINDOWS: { - title: 'Edit the configuration', - textPre: 'Modify `C:\\Program Files\\Filebeat\\metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"' - ], - textPost: 'Where `` is the password of the `elastic` user.' - } - } -}; + }; +} export function metricbeatEnableInstructions(moduleName) { return { OSX: { title: 'Enable and configure the ' + moduleName + ' module', textPre: 'From the installation directory, run:', - commands: [ - './metricbeat modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.' + commands: ['./metricbeat modules enable ' + moduleName], + textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.', }, DEB: { title: 'Enable and configure the ' + moduleName + ' module', - commands: [ - 'sudo metricbeat modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `/etc/metricbeat/modules.d/' + moduleName + '.yml` file.' + commands: ['sudo metricbeat modules enable ' + moduleName], + textPost: + 'Modify the settings in the `/etc/metricbeat/modules.d/' + moduleName + '.yml` file.', }, RPM: { title: 'Enable and configure the ' + moduleName + ' module', - commands: [ - 'sudo metricbeat modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `/etc/metricbeat/modules.d/' + moduleName + '.yml` file.' + commands: ['sudo metricbeat modules enable ' + moduleName], + textPost: + 'Modify the settings in the `/etc/metricbeat/modules.d/' + moduleName + '.yml` file.', }, WINDOWS: { title: 'Enable and configure the ' + moduleName + ' module', textPre: 'From the `C:\\Program Files\\Metricbeat` folder, run:', - commands: [ - 'PS C:\\Program Files\\Metricbeat> metricbeat.exe modules enable ' + moduleName, - ], - textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.' - } + commands: ['PS C:\\Program Files\\Metricbeat> metricbeat.exe modules enable ' + moduleName], + textPost: 'Modify the settings in the `modules.d/' + moduleName + '.yml` file.', + }, }; } @@ -257,16 +253,18 @@ export function metricbeatStatusCheck(moduleName) { bool: { filter: { term: { - 'metricset.module': moduleName - } - } - } - } - } + 'metricset.module': moduleName, + }, + }, + }, + }, + }, }; } export function onPremInstructions(moduleName) { + const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions(); + return { instructionSets: [ { @@ -278,8 +276,8 @@ export function onPremInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.OSX, METRICBEAT_INSTRUCTIONS.CONFIG.OSX, metricbeatEnableInstructions(moduleName).OSX, - METRICBEAT_INSTRUCTIONS.START.OSX - ] + METRICBEAT_INSTRUCTIONS.START.OSX, + ], }, { id: INSTRUCTION_VARIANT.DEB, @@ -287,8 +285,8 @@ export function onPremInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.DEB, METRICBEAT_INSTRUCTIONS.CONFIG.DEB, metricbeatEnableInstructions(moduleName).DEB, - METRICBEAT_INSTRUCTIONS.START.DEB - ] + METRICBEAT_INSTRUCTIONS.START.DEB, + ], }, { id: INSTRUCTION_VARIANT.RPM, @@ -296,8 +294,8 @@ export function onPremInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.RPM, METRICBEAT_INSTRUCTIONS.CONFIG.RPM, metricbeatEnableInstructions(moduleName).RPM, - METRICBEAT_INSTRUCTIONS.START.RPM - ] + METRICBEAT_INSTRUCTIONS.START.RPM, + ], }, { id: INSTRUCTION_VARIANT.WINDOWS, @@ -305,17 +303,21 @@ export function onPremInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.WINDOWS, METRICBEAT_INSTRUCTIONS.CONFIG.WINDOWS, metricbeatEnableInstructions(moduleName).WINDOWS, - METRICBEAT_INSTRUCTIONS.START.WINDOWS - ] - } + METRICBEAT_INSTRUCTIONS.START.WINDOWS, + ], + }, ], - statusCheck: metricbeatStatusCheck(moduleName) - } - ] + statusCheck: metricbeatStatusCheck(moduleName), + }, + ], }; } export function onPremCloudInstructions(moduleName) { + const TRYCLOUD_OPTION1 = createTrycloudOption1(); + const TRYCLOUD_OPTION2 = createTrycloudOption2(); + const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions(); + return { instructionSets: [ { @@ -329,8 +331,8 @@ export function onPremCloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.OSX, METRICBEAT_INSTRUCTIONS.CONFIG.OSX, metricbeatEnableInstructions(moduleName).OSX, - METRICBEAT_INSTRUCTIONS.START.OSX - ] + METRICBEAT_INSTRUCTIONS.START.OSX, + ], }, { id: INSTRUCTION_VARIANT.DEB, @@ -340,8 +342,8 @@ export function onPremCloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.DEB, METRICBEAT_INSTRUCTIONS.CONFIG.DEB, metricbeatEnableInstructions(moduleName).DEB, - METRICBEAT_INSTRUCTIONS.START.DEB - ] + METRICBEAT_INSTRUCTIONS.START.DEB, + ], }, { id: INSTRUCTION_VARIANT.RPM, @@ -351,8 +353,8 @@ export function onPremCloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.RPM, METRICBEAT_INSTRUCTIONS.CONFIG.RPM, metricbeatEnableInstructions(moduleName).RPM, - METRICBEAT_INSTRUCTIONS.START.RPM - ] + METRICBEAT_INSTRUCTIONS.START.RPM, + ], }, { id: INSTRUCTION_VARIANT.WINDOWS, @@ -362,17 +364,20 @@ export function onPremCloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.WINDOWS, METRICBEAT_INSTRUCTIONS.CONFIG.WINDOWS, metricbeatEnableInstructions(moduleName).WINDOWS, - METRICBEAT_INSTRUCTIONS.START.WINDOWS - ] - } + METRICBEAT_INSTRUCTIONS.START.WINDOWS, + ], + }, ], - statusCheck: metricbeatStatusCheck(moduleName) - } - ] + statusCheck: metricbeatStatusCheck(moduleName), + }, + ], }; } export function cloudInstructions(moduleName) { + const METRICBEAT_INSTRUCTIONS = createMetricbeatInstructions(); + const METRICBEAT_CLOUD_INSTRUCTIONS = createMetricbeatCloudInstructions(); + return { instructionSets: [ { @@ -384,8 +389,8 @@ export function cloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.OSX, METRICBEAT_CLOUD_INSTRUCTIONS.CONFIG.OSX, metricbeatEnableInstructions(moduleName).OSX, - METRICBEAT_INSTRUCTIONS.START.OSX - ] + METRICBEAT_INSTRUCTIONS.START.OSX, + ], }, { id: INSTRUCTION_VARIANT.DEB, @@ -393,8 +398,8 @@ export function cloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.DEB, METRICBEAT_CLOUD_INSTRUCTIONS.CONFIG.DEB, metricbeatEnableInstructions(moduleName).DEB, - METRICBEAT_INSTRUCTIONS.START.DEB - ] + METRICBEAT_INSTRUCTIONS.START.DEB, + ], }, { id: INSTRUCTION_VARIANT.RPM, @@ -402,8 +407,8 @@ export function cloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.RPM, METRICBEAT_CLOUD_INSTRUCTIONS.CONFIG.RPM, metricbeatEnableInstructions(moduleName).RPM, - METRICBEAT_INSTRUCTIONS.START.RPM - ] + METRICBEAT_INSTRUCTIONS.START.RPM, + ], }, { id: INSTRUCTION_VARIANT.WINDOWS, @@ -411,12 +416,12 @@ export function cloudInstructions(moduleName) { METRICBEAT_INSTRUCTIONS.INSTALL.WINDOWS, METRICBEAT_CLOUD_INSTRUCTIONS.CONFIG.WINDOWS, metricbeatEnableInstructions(moduleName).WINDOWS, - METRICBEAT_INSTRUCTIONS.START.WINDOWS - ] - } + METRICBEAT_INSTRUCTIONS.START.WINDOWS, + ], + }, ], - statusCheck: metricbeatStatusCheck(moduleName) - } - ] + statusCheck: metricbeatStatusCheck(moduleName), + }, + ], }; } diff --git a/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js b/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js index 9b0326a1b647a..b308cfdeda6b2 100644 --- a/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js @@ -17,25 +17,28 @@ * under the License. */ -export const TRYCLOUD_OPTION1 = { - title: 'Option 1: Try module in Elastic Cloud', - textPre: 'Go to [Elastic Cloud](https://www.elastic.co/cloud/as-a-service/signup?blade=kib). Register if you ' + - 'do not already have an account. Free 14-day trial available.\n\n' + +export function createTrycloudOption1() { + return { + title: 'Option 1: Try module in Elastic Cloud', + textPre: + 'Go to [Elastic Cloud](https://www.elastic.co/cloud/as-a-service/signup?blade=kib). Register if you ' + + 'do not already have an account. Free 14-day trial available.\n\n' + + 'Log into the Elastic Cloud console\n\n' + + 'To create a cluster, in Elastic Cloud console:\n' + + ' 1. Select **Create Deployment** and specify the **Deployment Name**\n' + + ' 2. Modify the other deployment options as needed (or not, the defaults are great to get started)\n' + + ' 3. Click **Create Deployment**\n' + + ' 4. Wait until deployment creation completes\n' + + ' 5. Go to the new Cloud Kibana instance and follow the Kibana Home instructions', + }; +} - 'Log into the Elastic Cloud console\n\n' + - - 'To create a cluster, in Elastic Cloud console:\n' + - ' 1. Select **Create Deployment** and specify the **Deployment Name**\n' + - ' 2. Modify the other deployment options as needed (or not, the defaults are great to get started)\n' + - ' 3. Click **Create Deployment**\n' + - ' 4. Wait until deployment creation completes\n' + - ' 5. Go to the new Cloud Kibana instance and follow the Kibana Home instructions' - -}; - -export const TRYCLOUD_OPTION2 = { - title: 'Option 2: Connect local Kibana to a Cloud instance', - textPre: 'If you are running this Kibana instance against a hosted Elasticsearch instance,' + - ' proceed with manual setup.\n\n' + - 'Save the **Elasticsearch** endpoint as `` and the cluster **Password** as `` for your records' -}; +export function createTrycloudOption2() { + return { + title: 'Option 2: Connect local Kibana to a Cloud instance', + textPre: + 'If you are running this Kibana instance against a hosted Elasticsearch instance,' + + ' proceed with manual setup.\n\n' + + 'Save the **Elasticsearch** endpoint as `` and the cluster **Password** as `` for your records', + }; +} diff --git a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js index 21276a4dd25ab..0c8dab6d2d0fa 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js @@ -19,20 +19,20 @@ /* eslint-disable max-len */ -export const NODE_CLIENT_INSTRUCTIONS = [ - { - title: 'Install the APM agent', - textPre: - 'Install the APM agent for Node.js as a dependency to your application.', - commands: ['npm install elastic-apm-node --save'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `serviceName`.' + - ' This agent supports Express, Koa, hapi, and custom Node.js.', - commands: `// Add this to the VERY top of the first file loaded in your app +export function createNodeClientInstructions() { + return [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for Node.js as a dependency to your application.', + commands: ['npm install elastic-apm-node --save'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the `serviceName`.' + + ' This agent supports Express, Koa, hapi, and custom Node.js.', + commands: `// Add this to the VERY top of the first file loaded in your app var apm = require('elastic-apm-node').start({curlyOpen} // Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space) serviceName: '', @@ -43,22 +43,24 @@ var apm = require('elastic-apm-node').start({curlyOpen} // Set custom APM Server URL (default: http://localhost:8200) serverUrl: '' {curlyClose})`.split('\n'), - textPost: `See [the documentation]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/index.html) for advanced usage, including how to use with [Babel/ES Modules]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/advanced-setup.html#es-modules).`, - }, -]; - -export const DJANGO_CLIENT_INSTRUCTIONS = [ - { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Python as a dependency.', - commands: ['$ pip install elastic-apm'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `SERVICE_NAME`.', - commands: `# Add the agent to the installed apps + textPost: `See [the documentation]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/index.html) for advanced usage, including how to use with [Babel/ES Modules]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/advanced-setup.html#es-modules).`, + }, + ]; +} + +export function createDjangoClientInstructions() { + return [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for Python as a dependency.', + commands: ['$ pip install elastic-apm'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the `SERVICE_NAME`.', + commands: `# Add the agent to the installed apps INSTALLED_APPS = ( 'elasticapm.contrib.django', # ... @@ -81,24 +83,26 @@ MIDDLEWARE = ( 'elasticapm.contrib.django.middleware.TracingMiddleware', #... )`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/python/2.x/django-support.html) for advanced usage.', - }, -]; - -export const FLASK_CLIENT_INSTRUCTIONS = [ - { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Python as a dependency.', - commands: ['$ pip install elastic-apm[flask]'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `SERVICE_NAME`.', - commands: `# initialize using environment variables + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/python/2.x/django-support.html) for advanced usage.', + }, + ]; +} + +export function createFlaskClientInstructions() { + return [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for Python as a dependency.', + commands: ['$ pip install elastic-apm[flask]'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the `SERVICE_NAME`.', + commands: `# initialize using environment variables from elasticapm.contrib.flask import ElasticAPM app = Flask(__name__) apm = ElasticAPM(app) @@ -118,23 +122,25 @@ app.config['ELASTIC_APM'] = {curlyOpen} {curlyClose} apm = ElasticAPM(app)`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/python/2.x/flask-support.html) for advanced usage.', - }, -]; - -export const RAILS_CLIENT_INSTRUCTIONS = [ - { - title: 'Install the APM agent', - textPre: 'Add the agent to your Gemfile.', - commands: [`gem 'elastic-apm'`], - }, - { - title: 'Configure the agent', - textPre: - 'APM is automatically started when your app boots. Configure the agent, by creating the config file `config/elastic_apm.yml`', - commands: `# config/elastic_apm.yml: + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/python/2.x/flask-support.html) for advanced usage.', + }, + ]; +} + +export function createRailsClientInstructions() { + [ + { + title: 'Install the APM agent', + textPre: 'Add the agent to your Gemfile.', + commands: [`gem 'elastic-apm'`], + }, + { + title: 'Configure the agent', + textPre: + 'APM is automatically started when your app boots. Configure the agent, by creating the config file `config/elastic_apm.yml`', + commands: `# config/elastic_apm.yml: # Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space # Defaults to the name of your Rails app @@ -145,23 +151,25 @@ export const RAILS_CLIENT_INSTRUCTIONS = [ # Set custom APM Server URL (default: http://localhost:8200) # server_url: 'http://localhost:8200'`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', - }, -]; - -export const RACK_CLIENT_INSTRUCTIONS = [ - { - title: 'Install the APM agent', - textPre: 'Add the agent to your Gemfile.', - commands: [`gem 'elastic-apm'`], - }, - { - title: 'Configure the agent', - textPre: - 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', - commands: `# config.ru + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', + }, + ]; +} + +export function createRackClientInstructions() { + return [ + { + title: 'Install the APM agent', + textPre: 'Add the agent to your Gemfile.', + commands: [`gem 'elastic-apm'`], + }, + { + title: 'Configure the agent', + textPre: + 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', + commands: `# config.ru require 'sinatra/base' class MySinatraApp < Sinatra::Base @@ -178,11 +186,11 @@ export const RACK_CLIENT_INSTRUCTIONS = [ run MySinatraApp at_exit {curlyOpen} ElasticAPM.stop {curlyClose}`.split('\n'), - }, - { - title: 'Create config file', - textPre: 'Create a config file `config/elastic_apm.yml`:', - commands: `# config/elastic_apm.yml: + }, + { + title: 'Create config file', + textPre: 'Create a config file `config/elastic_apm.yml`:', + commands: `# config/elastic_apm.yml: # Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space # Defaults to the name of your Rack app's class. @@ -193,28 +201,29 @@ export const RACK_CLIENT_INSTRUCTIONS = [ # Set custom APM Server URL (default: http://localhost:8200) # server_url: 'http://localhost:8200'`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', - }, -]; - -export const JS_CLIENT_INSTRUCTIONS = [ - { - title: 'Enable Real User Monitoring support in the APM server', - textPre: - 'Please refer to [the documentation]({config.docs.base_url}guide/en/apm/server/{config.docs.version}/rum.html).', - }, - { - title: 'Install the APM agent', - textPre: - 'Install the APM agent for JavaScript as a dependency to your application:', - commands: [`npm install elastic-apm-js-base --save`], - }, - { - title: 'Configure the agent', - textPre: 'Agents are libraries that run inside of your application.', - commands: `import {curlyOpen} init as initApm {curlyClose} from 'elastic-apm-js-base' + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', + }, + ]; +} + +export function createJsClientInstructions() { + return [ + { + title: 'Enable Real User Monitoring support in the APM server', + textPre: + 'Please refer to [the documentation]({config.docs.base_url}guide/en/apm/server/{config.docs.version}/rum.html).', + }, + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for JavaScript as a dependency to your application:', + commands: [`npm install elastic-apm-js-base --save`], + }, + { + title: 'Configure the agent', + textPre: 'Agents are libraries that run inside of your application.', + commands: `import {curlyOpen} init as initApm {curlyClose} from 'elastic-apm-js-base' var apm = initApm({curlyOpen} // Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space) @@ -226,25 +235,27 @@ var apm = initApm({curlyOpen} // Set service version (required for sourcemap feature) serviceVersion: '' {curlyClose})`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/js-base/current/index.html) for advanced usage.', - }, -]; - -export const GO_CLIENT_INSTRUCTIONS = [ - { - title: 'Install the APM agent', - textPre: 'Install the APM agent packages for Go.', - commands: ['go get github.com/elastic/apm-agent-go'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the executable ' + - ' file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.', - commands: `# Initialize using environment variables: + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/js-base/current/index.html) for advanced usage.', + }, + ]; +} + +export function createGoClientInstructions() { + return [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent packages for Go.', + commands: ['go get github.com/elastic/apm-agent-go'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the executable ' + + ' file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.', + commands: `# Initialize using environment variables: # Set the service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space. # If ELASTIC_APM_SERVICE_NAME is not specified, the executable name will be used. @@ -256,16 +267,16 @@ export ELASTIC_APM_SERVER_URL= # Set if APM Server requires a token. export ELASTIC_APM_SECRET_TOKEN= `.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/go/current/configuration.html) for advanced configuration.', - }, - { - title: 'Instrument your application', - textPre: - 'Instrument your Go application by using one of the provided instrumentation modules or ' + - 'by using the tracer API directly.', - commands: ` + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/go/current/configuration.html) for advanced configuration.', + }, + { + title: 'Instrument your application', + textPre: + 'Instrument your Go application by using one of the provided instrumentation modules or ' + + 'by using the tracer API directly.', + commands: ` import ( "net/http" @@ -278,35 +289,40 @@ func main() {curlyOpen} http.ListenAndServe(":8080", apmhttp.Wrap(mux)) {curlyClose} `.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html) for a detailed ' + - 'guide to instrumenting Go source code.\n\n' + - '**Warning: The Go agent is currently in Beta and not meant for production use.**', - }, -]; - -export const JAVA_CLIENT_INSTRUCTIONS = [ - { - title: 'Download the APM agent', - textPre: 'Download the agent jar from [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent). ' + - 'Do **not** add the agent as a dependency to your application.' - }, - { - title: 'Start your application with the javaagent flag', - textPre: 'Add the `-javaagent` flag and configure the agent with system properties.\n' + - '\n' + - ' * Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)\n' + - ' * Set custom APM Server URL (default: http://localhost:8200)\n' + - ' * Set the base package of your application', - commands: `java -javaagent:/path/to/elastic-apm-agent-.jar \\ + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html) for a detailed ' + + 'guide to instrumenting Go source code.\n\n' + + '**Warning: The Go agent is currently in Beta and not meant for production use.**', + }, + ]; +} + +export function createJavaClientInstructions() { + return [ + { + title: 'Download the APM agent', + textPre: + 'Download the agent jar from [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent). ' + + 'Do **not** add the agent as a dependency to your application.', + }, + { + title: 'Start your application with the javaagent flag', + textPre: + 'Add the `-javaagent` flag and configure the agent with system properties.\n' + + '\n' + + ' * Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)\n' + + ' * Set custom APM Server URL (default: http://localhost:8200)\n' + + ' * Set the base package of your application', + commands: `java -javaagent:/path/to/elastic-apm-agent-.jar \\ -Delastic.apm.service_name=my-application \\ - -Delastic.apm.server_url=http://localhost:8200 \\ - -Delastic.apm.application_packages=org.example \\ + -Delastic.apm.server_url=http://localhost:8200 \\ + -Delastic.apm.application_packages=org.example \\ -jar my-application.jar`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/java/current/index.html) for configuration options and advanced usage.\n\n' + - '**Warning: The Java agent is currently in Beta and not meant for production use.**', - }, -]; + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/java/current/index.html) for configuration options and advanced usage.\n\n' + + '**Warning: The Java agent is currently in Beta and not meant for production use.**', + }, + ]; +} diff --git a/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js b/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js index a85b6709713d0..121bd1a889b5a 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js @@ -17,84 +17,103 @@ * under the License. */ -export const EDIT_CONFIG = { - title: 'Edit the configuration', - textPre: - `If you're using an X-Pack secured version of Elastic Stack, you must specify` + - ' credentials in the `apm-server.yml` config file.', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: ', - ' password: ', - ], -}; +export function createEditConfig() { + return { + title: 'Edit the configuration', + textPre: + `If you're using an X-Pack secured version of Elastic Stack, you must specify` + + ' credentials in the `apm-server.yml` config file.', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: ', + ' password: ', + ], + }; +} -const START_SERVER = { - title: 'Start APM Server', - textPre: - 'The server processes and stores application performance metrics in Elasticsearch.', -}; +function createStartServer() { + return { + title: 'Start APM Server', + textPre: 'The server processes and stores application performance metrics in Elasticsearch.', + }; +} -export const START_SERVER_UNIX = { - title: START_SERVER.title, - textPre: START_SERVER.textPre, - commands: ['./apm-server -e'], -}; +export function createStartServerUnix() { + const START_SERVER = createStartServer(); -const DOWNLOAD_SERVER_TITLE = 'Download and unpack APM Server'; + return { + title: START_SERVER.title, + textPre: START_SERVER.textPre, + commands: ['./apm-server -e'], + }; +} -export const DOWNLOAD_SERVER_OSX = { - title: DOWNLOAD_SERVER_TITLE, - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', - 'tar xzvf apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', - 'cd apm-server-{config.kibana.version}-darwin-x86_64/', - ], -}; +function createDownloadServerTitle() { + return 'Download and unpack APM Server'; +} -export const DOWNLOAD_SERVER_DEB = { - title: DOWNLOAD_SERVER_TITLE, - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-amd64.deb', - 'sudo dpkg -i apm-server-{config.kibana.version}-amd64.deb', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', -}; +export function createDownloadServerOsx() { + return { + title: createDownloadServerTitle(), + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', + 'tar xzvf apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', + 'cd apm-server-{config.kibana.version}-darwin-x86_64/', + ], + }; +} -export const DOWNLOAD_SERVER_RPM = { - title: DOWNLOAD_SERVER_TITLE, - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-x86_64.rpm', - 'sudo rpm -vi apm-server-{config.kibana.version}-x86_64.rpm', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', -}; +export function createDownloadServerDeb() { + return { + title: createDownloadServerTitle(), + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-amd64.deb', + 'sudo dpkg -i apm-server-{config.kibana.version}-amd64.deb', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', + }; +} -export const WINDOWS_SERVER_INSTRUCTIONS = [ - { - title: DOWNLOAD_SERVER_TITLE, - textPre: - '1. Download the APM Server Windows zip file from the [Download page](https://www.elastic.co/downloads/apm/apm-server).\n' + - '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + - '3. Rename the `apm-server-{config.kibana.version}-windows` directory to `APM-Server`.\n' + - '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + - ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + - '5. From the PowerShell prompt, run the following commands to install APM Server as a Windows service:', +export function createDownloadServerRpm() { + return { + title: createDownloadServerTitle(), commands: [ - `PS > cd 'C:\\Program Files\\APM-Server'`, - `PS C:\\Program Files\\APM-Server> .\\install-service-apm-server.ps1`, + 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-x86_64.rpm', + 'sudo rpm -vi apm-server-{config.kibana.version}-x86_64.rpm', ], textPost: - 'Note: If script execution is disabled on your system, you need to set the execution policy for the current session' + - ' to allow the script to run. For example: `PowerShell.exe -ExecutionPolicy UnRestricted -File .\\install-service-apm-server.ps1`.', - }, - EDIT_CONFIG, - { - title: START_SERVER.title, - textPre: START_SERVER.textPre, - commands: ['apm-server.exe -e'], - }, -]; + 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', + }; +} + +export function createWindowsServerInstructions() { + const START_SERVER = createStartServer(); + + return [ + { + title: createDownloadServerTitle(), + textPre: + '1. Download the APM Server Windows zip file from the [Download page](https://www.elastic.co/downloads/apm/apm-server).\n' + + '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + + '3. Rename the `apm-server-{config.kibana.version}-windows` directory to `APM-Server`.\n' + + '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + + ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + + '5. From the PowerShell prompt, run the following commands to install APM Server as a Windows service:', + commands: [ + `PS > cd 'C:\\Program Files\\APM-Server'`, + `PS C:\\Program Files\\APM-Server> .\\install-service-apm-server.ps1`, + ], + textPost: + 'Note: If script execution is disabled on your system, you need to set the execution policy for the current session' + + ' to allow the script to run. For example: `PowerShell.exe -ExecutionPolicy UnRestricted -File .\\install-service-apm-server.ps1`.', + }, + createEditConfig(), + { + title: START_SERVER.title, + textPre: START_SERVER.textPre, + commands: ['apm-server.exe -e'], + }, + ]; +} diff --git a/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js index a7bf9fa012fd6..a7ba81b2a1654 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js @@ -20,61 +20,66 @@ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { - NODE_CLIENT_INSTRUCTIONS, - DJANGO_CLIENT_INSTRUCTIONS, - FLASK_CLIENT_INSTRUCTIONS, - RAILS_CLIENT_INSTRUCTIONS, - RACK_CLIENT_INSTRUCTIONS, - JS_CLIENT_INSTRUCTIONS, - GO_CLIENT_INSTRUCTIONS, - JAVA_CLIENT_INSTRUCTIONS, + createNodeClientInstructions, + createDjangoClientInstructions, + createFlaskClientInstructions, + createRailsClientInstructions, + createRackClientInstructions, + createJsClientInstructions, + createGoClientInstructions, + createJavaClientInstructions, } from './apm_client_instructions'; -const SERVER_URL_INSTRUCTION = { - title: 'APM Server endpoint', - textPre: - `Retrieve the APM Server URL from the Deployments section on the Elastic Cloud dashboard. +function createServerUrlInstruction() { + return { + title: 'APM Server endpoint', + textPre: `Retrieve the APM Server URL from the Deployments section on the Elastic Cloud dashboard. You will also need the APM Server secret token, which was generated on deployment.`, -}; + }; +} -export const ELASTIC_CLOUD_INSTRUCTIONS = { - instructionSets: [ - { - title: 'APM Agents', - instructionVariants: [ - { - id: INSTRUCTION_VARIANT.NODE, - instructions: [SERVER_URL_INSTRUCTION, ...NODE_CLIENT_INSTRUCTIONS], - }, - { - id: INSTRUCTION_VARIANT.DJANGO, - instructions: [SERVER_URL_INSTRUCTION, ...DJANGO_CLIENT_INSTRUCTIONS], - }, - { - id: INSTRUCTION_VARIANT.FLASK, - instructions: [SERVER_URL_INSTRUCTION, ...FLASK_CLIENT_INSTRUCTIONS], - }, - { - id: INSTRUCTION_VARIANT.RAILS, - instructions: [SERVER_URL_INSTRUCTION, ...RAILS_CLIENT_INSTRUCTIONS], - }, - { - id: INSTRUCTION_VARIANT.RACK, - instructions: [SERVER_URL_INSTRUCTION, ...RACK_CLIENT_INSTRUCTIONS], - }, - { - id: INSTRUCTION_VARIANT.JS, - instructions: [SERVER_URL_INSTRUCTION, ...JS_CLIENT_INSTRUCTIONS], - }, - { - id: INSTRUCTION_VARIANT.GO, - instructions: [SERVER_URL_INSTRUCTION, ...GO_CLIENT_INSTRUCTIONS], - }, - { - id: INSTRUCTION_VARIANT.JAVA, - instructions: [SERVER_URL_INSTRUCTION, ...JAVA_CLIENT_INSTRUCTIONS], - }, - ], - }, - ], -}; +export function createElasticCloudInstructions() { + const SERVER_URL_INSTRUCTION = createServerUrlInstruction(); + + return { + instructionSets: [ + { + title: 'APM Agents', + instructionVariants: [ + { + id: INSTRUCTION_VARIANT.NODE, + instructions: [SERVER_URL_INSTRUCTION, ...createNodeClientInstructions()], + }, + { + id: INSTRUCTION_VARIANT.DJANGO, + instructions: [SERVER_URL_INSTRUCTION, ...createDjangoClientInstructions()], + }, + { + id: INSTRUCTION_VARIANT.FLASK, + instructions: [SERVER_URL_INSTRUCTION, ...createFlaskClientInstructions()], + }, + { + id: INSTRUCTION_VARIANT.RAILS, + instructions: [SERVER_URL_INSTRUCTION, ...createRailsClientInstructions()], + }, + { + id: INSTRUCTION_VARIANT.RACK, + instructions: [SERVER_URL_INSTRUCTION, ...createRackClientInstructions()], + }, + { + id: INSTRUCTION_VARIANT.JS, + instructions: [SERVER_URL_INSTRUCTION, ...createJsClientInstructions()], + }, + { + id: INSTRUCTION_VARIANT.GO, + instructions: [SERVER_URL_INSTRUCTION, ...createGoClientInstructions()], + }, + { + id: INSTRUCTION_VARIANT.JAVA, + instructions: [SERVER_URL_INSTRUCTION, ...createJavaClientInstructions()], + }, + ], + }, + ], + }; +} diff --git a/src/core_plugins/kibana/server/tutorials/apm/index.js b/src/core_plugins/kibana/server/tutorials/apm/index.js index 107b1ad8d1da8..fb92e9acb9609 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/index.js +++ b/src/core_plugins/kibana/server/tutorials/apm/index.js @@ -19,7 +19,7 @@ import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; import { onPremInstructions } from './on_prem'; -import { ELASTIC_CLOUD_INSTRUCTIONS } from './elastic_cloud'; +import { createElasticCloudInstructions } from './elastic_cloud'; import { getSavedObjects } from './saved_objects/get_saved_objects'; const apmIntro = 'Collect in-depth performance metrics and errors from inside your applications.'; @@ -42,14 +42,15 @@ export function apmSpecProvider(server) { { id: '8d3ed660-7828-11e7-8c47-65b845b5cfb3', linkLabel: 'APM dashboard', - isOverview: true - } - ] + isOverview: true, + }, + ], }; + if (isEnabled(config)) { artifacts.application = { path: '/app/apm', - label: 'Launch APM' + label: 'Launch APM', }; } @@ -58,17 +59,19 @@ export function apmSpecProvider(server) { name: 'APM', category: TUTORIAL_CATEGORY.OTHER, shortDescription: apmIntro, - longDescription: 'Application Performance Monitoring (APM) collects in-depth' + + longDescription: + 'Application Performance Monitoring (APM) collects in-depth' + ' performance metrics and errors from inside your application.' + ' It allows you to monitor the performance of thousands of applications in real time.' + ' [Learn more]({config.docs.base_url}guide/en/apm/get-started/{config.docs.version}/index.html).', euiIconType: 'apmApp', artifacts: artifacts, onPrem: onPremInstructions(apmIndexPattern), - elasticCloud: ELASTIC_CLOUD_INSTRUCTIONS, + elasticCloud: createElasticCloudInstructions(), previewImagePath: '/plugins/kibana/home/tutorial_resources/apm/apm.png', savedObjects: getSavedObjects(apmIndexPattern), - savedObjectsInstallMsg: 'Load index pattern, visualizations, and pre-defined dashboards.' + + savedObjectsInstallMsg: + 'Load index pattern, visualizations, and pre-defined dashboards.' + ' An index pattern is required for some features in the APM UI.', }; } diff --git a/src/core_plugins/kibana/server/tutorials/apm/on_prem.js b/src/core_plugins/kibana/server/tutorials/apm/on_prem.js index 3fcca371fbe0e..b1a3938592e73 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/on_prem.js +++ b/src/core_plugins/kibana/server/tutorials/apm/on_prem.js @@ -19,25 +19,27 @@ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { - WINDOWS_SERVER_INSTRUCTIONS, - EDIT_CONFIG, - START_SERVER_UNIX, - DOWNLOAD_SERVER_RPM, - DOWNLOAD_SERVER_DEB, - DOWNLOAD_SERVER_OSX, + createWindowsServerInstructions, + createEditConfig, + createStartServerUnix, + createDownloadServerRpm, + createDownloadServerDeb, + createDownloadServerOsx, } from './apm_server_instructions'; import { - NODE_CLIENT_INSTRUCTIONS, - DJANGO_CLIENT_INSTRUCTIONS, - FLASK_CLIENT_INSTRUCTIONS, - RAILS_CLIENT_INSTRUCTIONS, - RACK_CLIENT_INSTRUCTIONS, - JS_CLIENT_INSTRUCTIONS, - GO_CLIENT_INSTRUCTIONS, - JAVA_CLIENT_INSTRUCTIONS, + createNodeClientInstructions, + createDjangoClientInstructions, + createFlaskClientInstructions, + createRailsClientInstructions, + createRackClientInstructions, + createJsClientInstructions, + createGoClientInstructions, + createJavaClientInstructions, } from './apm_client_instructions'; export function onPremInstructions(apmIndexPattern) { + const EDIT_CONFIG = createEditConfig(); + const START_SERVER_UNIX = createStartServerUnix(); return { instructionSets: [ @@ -46,37 +48,24 @@ export function onPremInstructions(apmIndexPattern) { instructionVariants: [ { id: INSTRUCTION_VARIANT.OSX, - instructions: [ - DOWNLOAD_SERVER_OSX, - EDIT_CONFIG, - START_SERVER_UNIX, - ], + instructions: [createDownloadServerOsx(), EDIT_CONFIG, START_SERVER_UNIX], }, { id: INSTRUCTION_VARIANT.DEB, - instructions: [ - DOWNLOAD_SERVER_DEB, - EDIT_CONFIG, - START_SERVER_UNIX, - ], + instructions: [createDownloadServerDeb(), EDIT_CONFIG, START_SERVER_UNIX], }, { id: INSTRUCTION_VARIANT.RPM, - instructions: [ - DOWNLOAD_SERVER_RPM, - EDIT_CONFIG, - START_SERVER_UNIX, - ], + instructions: [createDownloadServerRpm(), EDIT_CONFIG, START_SERVER_UNIX], }, { id: INSTRUCTION_VARIANT.WINDOWS, - instructions: WINDOWS_SERVER_INSTRUCTIONS, + instructions: createWindowsServerInstructions(), }, ], statusCheck: { title: 'APM Server status', - text: - 'Make sure APM Server is running before you start implementing the APM agents.', + text: 'Make sure APM Server is running before you start implementing the APM agents.', btnLabel: 'Check APM Server status', success: 'You have correctly setup APM-Server', error: 'APM-Server has still not connected to Elasticsearch', @@ -99,41 +88,40 @@ export function onPremInstructions(apmIndexPattern) { instructionVariants: [ { id: INSTRUCTION_VARIANT.NODE, - instructions: NODE_CLIENT_INSTRUCTIONS, + instructions: createNodeClientInstructions(), }, { id: INSTRUCTION_VARIANT.DJANGO, - instructions: DJANGO_CLIENT_INSTRUCTIONS, + instructions: createDjangoClientInstructions(), }, { id: INSTRUCTION_VARIANT.FLASK, - instructions: FLASK_CLIENT_INSTRUCTIONS, + instructions: createFlaskClientInstructions(), }, { id: INSTRUCTION_VARIANT.RAILS, - instructions: RAILS_CLIENT_INSTRUCTIONS, + instructions: createRailsClientInstructions(), }, { id: INSTRUCTION_VARIANT.RACK, - instructions: RACK_CLIENT_INSTRUCTIONS, + instructions: createRackClientInstructions(), }, { id: INSTRUCTION_VARIANT.JS, - instructions: JS_CLIENT_INSTRUCTIONS, + instructions: createJsClientInstructions(), }, { id: INSTRUCTION_VARIANT.GO, - instructions: GO_CLIENT_INSTRUCTIONS, + instructions: createGoClientInstructions(), }, { id: INSTRUCTION_VARIANT.JAVA, - instructions: JAVA_CLIENT_INSTRUCTIONS, + instructions: createJavaClientInstructions(), }, ], statusCheck: { title: 'Agent status', - text: - 'Make sure your application is running and the agents are sending data.', + text: 'Make sure your application is running and the agents are sending data.', btnLabel: 'Check agent status', success: 'Data successfully received from one or more agents', error: `No data has been received from agents yet`, diff --git a/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js b/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js index 2a7364c052972..eaf554d6b2189 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js @@ -17,129 +17,125 @@ * under the License. */ -export const COMMON_NETFLOW_INSTRUCTIONS = { - CONFIG: { - ON_PREM: { - OSX: [ - { - title: 'Edit the configuration', - textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', - commands: [ - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data.' - - } - ], - WINDOWS: [ - { - title: 'Edit the configuration', - textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', - commands: [ - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data.' - } - ] +export function createCommonNetflowInstructions() { + return { + CONFIG: { + ON_PREM: { + OSX: [ + { + title: 'Edit the configuration', + textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', + commands: ['modules:', ' - name: netflow', ' var.input.udp.port: '], + textPost: + 'Where `` is the UDP port on which Logstash will receive Netflow data.', + }, + ], + WINDOWS: [ + { + title: 'Edit the configuration', + textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', + commands: ['modules:', ' - name: netflow', ' var.input.udp.port: '], + textPost: + 'Where `` is the UDP port on which Logstash will receive Netflow data.', + }, + ], + }, + ON_PREM_ELASTIC_CLOUD: { + OSX: [ + { + title: 'Edit the configuration', + textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', + commands: [ + 'modules:', + ' - name: netflow', + ' var.input.udp.port: ', + ' var.elasticsearch.hosts: [ "" ]', + ' var.elasticsearch.username: elastic', + ' var.elasticsearch.password: ', + ], + textPost: + 'Where `` is the UDP port on which Logstash will receive Netflow data, ' + + '`` is the URL of Elasticsearch running on Elastic Cloud, and ' + + '`` is the password of the `elastic` user.', + }, + ], + WINDOWS: [ + { + title: 'Edit the configuration', + textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', + commands: [ + 'modules:', + ' - name: netflow', + ' var.input.udp.port: ', + ' var.elasticsearch.hosts: [ "" ]', + ' var.elasticsearch.username: elastic', + ' var.elasticsearch.password: ', + ], + textPost: + 'Where `` is the UDP port on which Logstash will receive Netflow data, ' + + '`` is the URL of Elasticsearch running on Elastic Cloud, and ' + + '`` is the password of the `elastic` user.', + }, + ], + }, + ELASTIC_CLOUD: { + OSX: [ + { + title: 'Edit the configuration', + textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', + commands: [ + 'cloud.id: "{config.cloud.id}"', + 'cloud.auth: "elastic:"', + ' ', + 'modules:', + ' - name: netflow', + ' var.input.udp.port: ', + ], + textPost: + 'Where `` is the UDP port on which Logstash will receive Netflow data and ' + + '`` is the password of the `elastic` user.', + }, + ], + WINDOWS: [ + { + title: 'Edit the configuration', + textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', + commands: [ + 'cloud.id: "{config.cloud.id}"', + 'cloud.auth: "elastic:"', + ' ', + 'modules:', + ' - name: netflow', + ' var.input.udp.port: ', + ], + textPost: + 'Where `` is the UDP port on which Logstash will receive Netflow data and ' + + '`` is the password of the `elastic` user.', + }, + ], + }, }, - ON_PREM_ELASTIC_CLOUD: { + SETUP: { OSX: [ { - title: 'Edit the configuration', - textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', - commands: [ - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ' var.elasticsearch.hosts: [ "" ]', - ' var.elasticsearch.username: elastic', - ' var.elasticsearch.password: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data, ' - + '`` is the URL of Elasticsearch running on Elastic Cloud, and ' - + '`` is the password of the `elastic` user.' - } + title: 'Run the Netflow module', + textPre: 'Run:', + 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 to avoid overwriting existing dashboards.', + }, ], WINDOWS: [ { - title: 'Edit the configuration', - textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', - commands: [ - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ' var.elasticsearch.hosts: [ "" ]', - ' var.elasticsearch.username: elastic', - ' var.elasticsearch.password: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data, ' - + '`` is the URL of Elasticsearch running on Elastic Cloud, and ' - + '`` is the password of the `elastic` user.' - - } - ] - }, - ELASTIC_CLOUD: { - OSX: [ - { - title: 'Edit the configuration', - textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"', - ' ', - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data and ' - + '`` is the password of the `elastic` user.' - } + title: 'Run the Netflow module', + textPre: 'Run:', + 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 to avoid overwriting existing dashboards.', + }, ], - WINDOWS: [ - { - title: 'Edit the configuration', - textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', - commands: [ - 'cloud.id: "{config.cloud.id}"', - 'cloud.auth: "elastic:"', - ' ', - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data and ' - + '`` is the password of the `elastic` user.' - } - ] - } - }, - SETUP: { - OSX: [ - { - title: 'Run the Netflow module', - textPre: 'Run:', - 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 to avoid overwriting existing dashboards.' - } - ], - WINDOWS: [ - { - title: 'Run the Netflow module', - textPre: 'Run:', - 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 to avoid overwriting existing 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 21e396bb9db28..ddb3afc0488fd 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js @@ -18,32 +18,37 @@ */ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; -import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; -import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; +import { createLogstashInstructions } from '../../../common/tutorials/logstash_instructions'; +import { createCommonNetflowInstructions } from './common_instructions'; // TODO: compare with onPremElasticCloud and onPrem scenarios and extract out common bits -export const ELASTIC_CLOUD_INSTRUCTIONS = { - instructionSets: [ - { - title: 'Getting Started', - instructionVariants: [ - { - id: INSTRUCTION_VARIANT.OSX, - instructions: [ - ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ELASTIC_CLOUD.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX - ] - }, - { - id: INSTRUCTION_VARIANT.WINDOWS, - instructions: [ - ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ELASTIC_CLOUD.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS - ] - } - ] - } - ] -}; +export function createElasticCloudInstructions() { + const COMMON_NETFLOW_INSTRUCTIONS = createCommonNetflowInstructions(); + const LOGSTASH_INSTRUCTIONS = createLogstashInstructions(); + + return { + instructionSets: [ + { + title: 'Getting Started', + instructionVariants: [ + { + id: INSTRUCTION_VARIANT.OSX, + instructions: [ + ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ELASTIC_CLOUD.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX, + ], + }, + { + id: INSTRUCTION_VARIANT.WINDOWS, + instructions: [ + ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ELASTIC_CLOUD.WINDOWS, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS, + ], + }, + ], + }, + ], + }; +} diff --git a/src/core_plugins/kibana/server/tutorials/netflow/index.js b/src/core_plugins/kibana/server/tutorials/netflow/index.js index e634282acc565..9617fe033b630 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/index.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/index.js @@ -18,9 +18,9 @@ */ import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; -import { ON_PREM_INSTRUCTIONS } from './on_prem'; -import { ELASTIC_CLOUD_INSTRUCTIONS } from './elastic_cloud'; -import { ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS } from './on_prem_elastic_cloud'; +import { createOnPremInstructions } from './on_prem'; +import { createElasticCloudInstructions } from './elastic_cloud'; +import { createOnPremElasticCloudInstructions } from './on_prem_elastic_cloud'; export function netflowSpecProvider() { return { @@ -28,14 +28,15 @@ export function netflowSpecProvider() { name: 'Netflow', category: TUTORIAL_CATEGORY.SECURITY, shortDescription: 'Collect Netflow records sent by a Netflow exporter.', - longDescription: 'The Logstash Netflow module collects and parses network flow data, ' + + longDescription: + 'The Logstash Netflow module collects and parses network flow data, ' + ' indexes the events into Elasticsearch, and installs a suite of Kibana dashboards.' + ' This module support Netflow Version 5 and 9.' + ' [Learn more]({config.docs.logstash}/netflow-module.html).', completionTimeMinutes: 10, //previewImagePath: 'kibana-apache.png', TODO - onPrem: ON_PREM_INSTRUCTIONS, - elasticCloud: ELASTIC_CLOUD_INSTRUCTIONS, - onPremElasticCloud: ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS + onPrem: createOnPremInstructions(), + elasticCloud: createElasticCloudInstructions(), + onPremElasticCloud: createOnPremElasticCloudInstructions(), }; } 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 5b0ecbbaac2c7..7d3b648b27de9 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js @@ -18,32 +18,37 @@ */ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; -import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; -import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; +import { createLogstashInstructions } from '../../../common/tutorials/logstash_instructions'; +import { createCommonNetflowInstructions } from './common_instructions'; // TODO: compare with onPremElasticCloud and elasticCloud scenarios and extract out common bits -export const ON_PREM_INSTRUCTIONS = { - instructionSets: [ - { - title: 'Getting Started', - instructionVariants: [ - { - id: INSTRUCTION_VARIANT.OSX, - instructions: [ - ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX - ] - }, - { - id: INSTRUCTION_VARIANT.WINDOWS, - instructions: [ - ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS - ] - } - ] - } - ] -}; +export function createOnPremInstructions() { + const COMMON_NETFLOW_INSTRUCTIONS = createCommonNetflowInstructions(); + const LOGSTASH_INSTRUCTIONS = createLogstashInstructions(); + + { + instructionSets: [ + { + title: 'Getting Started', + instructionVariants: [ + { + id: INSTRUCTION_VARIANT.OSX, + instructions: [ + ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX, + ], + }, + { + id: INSTRUCTION_VARIANT.WINDOWS, + instructions: [ + ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM.WINDOWS, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS, + ], + }, + ], + }, + ]; + } +} 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 0e5cb74064f80..87f647882518f 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 @@ -18,40 +18,47 @@ */ import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; -import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; +import { createLogstashInstructions } from '../../../common/tutorials/logstash_instructions'; import { - TRYCLOUD_OPTION1, - TRYCLOUD_OPTION2 + createTrycloudOption1, + createTrycloudOption2, } from '../../../common/tutorials/onprem_cloud_instructions'; -import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; +import { createCommonNetflowInstructions } from './common_instructions'; // TODO: compare with onPrem and elasticCloud scenarios and extract out common bits -export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { - instructionSets: [ - { - title: 'Getting Started', - instructionVariants: [ - { - id: INSTRUCTION_VARIANT.OSX, - instructions: [ - TRYCLOUD_OPTION1, - TRYCLOUD_OPTION2, - ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM_ELASTIC_CLOUD.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX - ] - }, - { - id: INSTRUCTION_VARIANT.WINDOWS, - instructions: [ - TRYCLOUD_OPTION1, - TRYCLOUD_OPTION2, - ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM_ELASTIC_CLOUD.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS - ] - } - ] - } - ] -}; +export function createOnPremElasticCloudInstructions() { + const COMMON_NETFLOW_INSTRUCTIONS = createCommonNetflowInstructions(); + const TRYCLOUD_OPTION1 = createTrycloudOption1(); + const TRYCLOUD_OPTION2 = createTrycloudOption2(); + const LOGSTASH_INSTRUCTIONS = createLogstashInstructions(); + + return { + instructionSets: [ + { + title: 'Getting Started', + instructionVariants: [ + { + id: INSTRUCTION_VARIANT.OSX, + instructions: [ + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2, + ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM_ELASTIC_CLOUD.OSX, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX, + ], + }, + { + id: INSTRUCTION_VARIANT.WINDOWS, + instructions: [ + TRYCLOUD_OPTION1, + TRYCLOUD_OPTION2, + ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, + ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM_ELASTIC_CLOUD.WINDOWS, + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS, + ], + }, + ], + }, + ], + }; +} From d212595ab88433de6bd629e04cde8423c87fe073 Mon Sep 17 00:00:00 2001 From: Leanid Shutau Date: Tue, 21 Aug 2018 12:38:27 +0300 Subject: [PATCH 2/4] Fix onPrem instructions --- src/core_plugins/kibana/server/tutorials/netflow/on_prem.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 7d3b648b27de9..6fb41ee0eb9d3 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js @@ -26,7 +26,7 @@ export function createOnPremInstructions() { const COMMON_NETFLOW_INSTRUCTIONS = createCommonNetflowInstructions(); const LOGSTASH_INSTRUCTIONS = createLogstashInstructions(); - { + return { instructionSets: [ { title: 'Getting Started', @@ -49,6 +49,6 @@ export function createOnPremInstructions() { }, ], }, - ]; - } + ], + }; } From b2a1a4102004d54e4c96454b9b5eb8c303ec3f7f Mon Sep 17 00:00:00 2001 From: Leanid Shutau Date: Tue, 21 Aug 2018 14:24:35 +0300 Subject: [PATCH 3/4] Fix rails instructions --- .../kibana/server/tutorials/apm/apm_client_instructions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js index 0c8dab6d2d0fa..d09f7da5a38f7 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js @@ -130,7 +130,7 @@ apm = ElasticAPM(app)`.split('\n'), } export function createRailsClientInstructions() { - [ + return [ { title: 'Install the APM agent', textPre: 'Add the agent to your Gemfile.', From 96fad344b2a2001c8cb5b790655d3265d1703279 Mon Sep 17 00:00:00 2001 From: Leanid Shutau Date: Mon, 27 Aug 2018 12:15:07 +0300 Subject: [PATCH 4/4] Use arrow functions and implicit return --- .../common/tutorials/filebeat_instructions.js | 402 +++++++++--------- .../common/tutorials/logstash_instructions.js | 74 ++-- .../tutorials/metricbeat_instructions.js | 366 ++++++++-------- .../tutorials/onprem_cloud_instructions.js | 44 +- .../tutorials/apm/apm_client_instructions.js | 348 ++++++++------- .../tutorials/apm/apm_server_instructions.js | 98 ++--- .../server/tutorials/apm/elastic_cloud.js | 10 +- 7 files changed, 649 insertions(+), 693 deletions(-) diff --git a/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js b/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js index 0dbca9cbeb405..692074d2ce897 100644 --- a/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/filebeat_instructions.js @@ -20,215 +20,211 @@ import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -export function createFilebeatInstructions() { - return { - INSTALL: { - OSX: { - title: 'Download and install Filebeat', - textPre: - 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'tar xzvf filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'cd filebeat-{config.kibana.version}-darwin-x86_64/', - ], - }, - DEB: { - title: 'Download and install Filebeat', - textPre: - 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-amd64.deb', - 'sudo dpkg -i filebeat-{config.kibana.version}-amd64.deb', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).', - }, - RPM: { - title: 'Download and install Filebeat', - textPre: - 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-x86_64.rpm', - 'sudo rpm -vi filebeat-{config.kibana.version}-x86_64.rpm', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).', - }, - WINDOWS: { - title: 'Download and install Filebeat', - textPre: - 'First time using Filebeat? See the [Getting Started Guide]' + - '({config.docs.beats.filebeat}/filebeat-getting-started.html).\n' + - '1. Download the Filebeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/filebeat) page.\n' + - '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + - '3. Rename the `filebeat-{config.kibana.version}-windows` directory to `Filebeat`.\n' + - '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + - ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + - '5. From the PowerShell prompt, run the following commands to install Filebeat as a Windows service.', - commands: [ - 'PS > cd C:\\Program Files\\Filebeat', - 'PS C:\\Program Files\\Filebeat> .\\install-service-filebeat.ps1', - ], - textPost: - 'Modify the settings under `output.elasticsearch` in the ' + - '`C:\\Program Files\\Filebeat\\filebeat.yml` file to point to your Elasticsearch installation.', - }, +export const createFilebeatInstructions = () => ({ + INSTALL: { + OSX: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'tar xzvf filebeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'cd filebeat-{config.kibana.version}-darwin-x86_64/', + ], }, - START: { - OSX: { - title: 'Start Filebeat', - textPre: - 'The `setup` command loads the Kibana dashboards.' + - ' If the dashboards are already set up, omit this command.', - commands: ['./filebeat setup', './filebeat -e'], - }, - DEB: { - title: 'Start Filebeat', - textPre: - 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: ['sudo filebeat setup', 'sudo service filebeat start'], - }, - RPM: { - title: 'Start Filebeat', - textPre: - 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: ['sudo filebeat setup', 'sudo service filebeat start'], - }, - WINDOWS: { - title: 'Start Filebeat', - textPre: - 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'PS C:\\Program Files\\Filebeat> filebeat.exe setup', - 'PS C:\\Program Files\\Filebeat> Start-Service filebeat', - ], - }, + DEB: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-amd64.deb', + 'sudo dpkg -i filebeat-{config.kibana.version}-amd64.deb', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).', }, - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, - DEB: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, - RPM: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, - WINDOWS: { - title: 'Edit the configuration', - textPre: - 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, + RPM: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-x86_64.rpm', + 'sudo rpm -vi filebeat-{config.kibana.version}-x86_64.rpm', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/filebeat).', }, - PLUGINS: { - GEOIP_AND_UA: { - title: 'Install Elasticsearch GeoIP and user agent plugins', - textPre: - 'This module requires two Elasticsearch plugins that are not ' + - 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', - commands: [ - 'bin/elasticsearch-plugin install ingest-geoip', - 'bin/elasticsearch-plugin install ingest-user-agent', - ], - }, - GEOIP: { - title: 'Install Elasticsearch GeoIP plugin', - textPre: - 'This module requires an Elasticsearch plugin that is not ' + - 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', - commands: ['bin/elasticsearch-plugin install ingest-geoip'], - }, + WINDOWS: { + title: 'Download and install Filebeat', + textPre: + 'First time using Filebeat? See the [Getting Started Guide]' + + '({config.docs.beats.filebeat}/filebeat-getting-started.html).\n' + + '1. Download the Filebeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/filebeat) page.\n' + + '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + + '3. Rename the `filebeat-{config.kibana.version}-windows` directory to `Filebeat`.\n' + + '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + + ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + + '5. From the PowerShell prompt, run the following commands to install Filebeat as a Windows service.', + commands: [ + 'PS > cd C:\\Program Files\\Filebeat', + 'PS C:\\Program Files\\Filebeat> .\\install-service-filebeat.ps1', + ], + textPost: + 'Modify the settings under `output.elasticsearch` in the ' + + '`C:\\Program Files\\Filebeat\\filebeat.yml` file to point to your Elasticsearch installation.', }, - }; -} + }, + START: { + OSX: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards.' + + ' If the dashboards are already set up, omit this command.', + commands: ['./filebeat setup', './filebeat -e'], + }, + DEB: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo filebeat setup', 'sudo service filebeat start'], + }, + RPM: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo filebeat setup', 'sudo service filebeat start'], + }, + WINDOWS: { + title: 'Start Filebeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: [ + 'PS C:\\Program Files\\Filebeat> filebeat.exe setup', + 'PS C:\\Program Files\\Filebeat> Start-Service filebeat', + ], + }, + }, + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + DEB: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + RPM: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/filebeat/filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + }, + PLUGINS: { + GEOIP_AND_UA: { + title: 'Install Elasticsearch GeoIP and user agent plugins', + textPre: + 'This module requires two Elasticsearch plugins that are not ' + + 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', + commands: [ + 'bin/elasticsearch-plugin install ingest-geoip', + 'bin/elasticsearch-plugin install ingest-user-agent', + ], + }, + GEOIP: { + title: 'Install Elasticsearch GeoIP plugin', + textPre: + 'This module requires an Elasticsearch plugin that is not ' + + 'installed by default.\n\nFrom the Elasticsearch installation folder, run:', + commands: ['bin/elasticsearch-plugin install ingest-geoip'], + }, + }, +}); -export function createFilebeatCloudInstructions() { - return { - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `filebeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, - DEB: { - title: 'Edit the configuration', - textPre: - 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, - RPM: { - title: 'Edit the configuration', - textPre: - 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, - WINDOWS: { - title: 'Edit the configuration', - textPre: - 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, +export const createFilebeatCloudInstructions = () => ({ + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', }, - }; -} + DEB: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + RPM: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/filebeat/filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Filebeat\\filebeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + }, +}); export function filebeatEnableInstructions(moduleName) { return { diff --git a/src/core_plugins/kibana/common/tutorials/logstash_instructions.js b/src/core_plugins/kibana/common/tutorials/logstash_instructions.js index 290eff545d8a4..4c52314236d10 100644 --- a/src/core_plugins/kibana/common/tutorials/logstash_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/logstash_instructions.js @@ -17,41 +17,39 @@ * under the License. */ -export function createLogstashInstructions() { - return { - INSTALL: { - OSX: [ - { - title: 'Download and install the Java Runtime Environment', - textPre: - 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jre.html).', - }, - { - title: 'Download and install Logstash', - textPre: - 'First time using Logstash? See the ' + - '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.tar.gz', - 'tar xzvf logstash-{config.kibana.version}.tar.gz', - ], - }, - ], - WINDOWS: [ - { - title: 'Download and install the Java Runtime Environment', - textPre: - 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jre_install.html).', - }, - { - title: 'Download and install Logstash', - textPre: - 'First time using Logstash? See the ' + - '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).\n' + - ' 1. [Download](https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.zip) the Logstash Windows zip file.\n' + - ' 2. Extract the contents of the zip file.', - }, - ], - }, - }; -} +export const createLogstashInstructions = () => ({ + INSTALL: { + OSX: [ + { + title: 'Download and install the Java Runtime Environment', + textPre: + 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jre.html).', + }, + { + title: 'Download and install Logstash', + textPre: + 'First time using Logstash? See the ' + + '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.tar.gz', + 'tar xzvf logstash-{config.kibana.version}.tar.gz', + ], + }, + ], + WINDOWS: [ + { + title: 'Download and install the Java Runtime Environment', + textPre: + 'Follow the installation instructions [here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jre_install.html).', + }, + { + title: 'Download and install Logstash', + textPre: + 'First time using Logstash? See the ' + + '[Getting Started Guide]({config.docs.base_url}guide/en/logstash/current/getting-started-with-logstash.html).\n' + + ' 1. [Download](https://artifacts.elastic.co/downloads/logstash/logstash-{config.kibana.version}.zip) the Logstash Windows zip file.\n' + + ' 2. Extract the contents of the zip file.', + }, + ], + }, +}); diff --git a/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js b/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js index c48642741ba60..8e1b9b95bcb47 100644 --- a/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/metricbeat_instructions.js @@ -20,196 +20,192 @@ import { INSTRUCTION_VARIANT } from './instruction_variant'; import { createTrycloudOption1, createTrycloudOption2 } from './onprem_cloud_instructions'; -export function createMetricbeatInstructions() { - return { - INSTALL: { - OSX: { - title: 'Download and install Metricbeat', - textPre: - 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'tar xzvf metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', - 'cd metricbeat-{config.kibana.version}-darwin-x86_64/', - ], - }, - DEB: { - title: 'Download and install Metricbeat', - textPre: - 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-amd64.deb', - 'sudo dpkg -i metricbeat-{config.kibana.version}-amd64.deb', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).', - }, - RPM: { - title: 'Download and install Metricbeat', - textPre: - 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-x86_64.rpm', - 'sudo rpm -vi metricbeat-{config.kibana.version}-x86_64.rpm', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).', - }, - WINDOWS: { - title: 'Download and install Metricbeat', - textPre: - 'First time using Metricbeat? See the [Getting Started Guide]' + - '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).\n' + - '1. Download the Metricbeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/metricbeat) page.\n' + - '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + - '3. Rename the `metricbeat-{config.kibana.version}-windows` directory to `Metricbeat`.\n' + - '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + - ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + - '5. From the PowerShell prompt, run the following commands to install Metricbeat as a Windows service.', - commands: [ - 'PS > cd C:\\Program Files\\Metricbeat', - 'PS C:\\Program Files\\Metricbeat> .\\install-service-metricbeat.ps1', - ], - textPost: - 'Modify the settings under `output.elasticsearch` in the ' + - '`C:\\Program Files\\Metricbeat\\metricbeat.yml` file to point to your Elasticsearch installation.', - }, +export const createMetricbeatInstructions = () => ({ + INSTALL: { + OSX: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'tar xzvf metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz', + 'cd metricbeat-{config.kibana.version}-darwin-x86_64/', + ], }, - START: { - OSX: { - title: 'Start Metricbeat', - textPre: - 'The `setup` command loads the Kibana dashboards.' + - ' If the dashboards are already set up, omit this command.', - commands: ['./metricbeat setup', './metricbeat -e'], - }, - DEB: { - title: 'Start Metricbeat', - textPre: - 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], - }, - RPM: { - title: 'Start Metricbeat', - textPre: - 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], - }, - WINDOWS: { - title: 'Start Metricbeat', - textPre: - 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + - 'omit this command.', - commands: [ - 'PS C:\\Program Files\\Metricbeat> metricbeat.exe setup', - 'PS C:\\Program Files\\Metricbeat> Start-Service metricbeat', - ], - }, + DEB: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-amd64.deb', + 'sudo dpkg -i metricbeat-{config.kibana.version}-amd64.deb', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).', }, - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, - DEB: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, - RPM: { - title: 'Edit the configuration', - textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, - WINDOWS: { - title: 'Edit the configuration', - textPre: - 'Modify `C:\\Program Files\\Metricbeat\\metricbeat.yml` to set the connection information:', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: "elastic"', - ' password: ""', - 'setup.kibana:', - ' host: ""', - ], - textPost: - 'Where `` is the password of the `elastic` user, ' + - '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', - }, + RPM: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).', + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-x86_64.rpm', + 'sudo rpm -vi metricbeat-{config.kibana.version}-x86_64.rpm', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page](https://www.elastic.co/downloads/beats/metricbeat).', }, - }; -} + WINDOWS: { + title: 'Download and install Metricbeat', + textPre: + 'First time using Metricbeat? See the [Getting Started Guide]' + + '({config.docs.beats.metricbeat}/metricbeat-getting-started.html).\n' + + '1. Download the Metricbeat Windows zip file from the [Download](https://www.elastic.co/downloads/beats/metricbeat) page.\n' + + '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + + '3. Rename the `metricbeat-{config.kibana.version}-windows` directory to `Metricbeat`.\n' + + '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + + ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + + '5. From the PowerShell prompt, run the following commands to install Metricbeat as a Windows service.', + commands: [ + 'PS > cd C:\\Program Files\\Metricbeat', + 'PS C:\\Program Files\\Metricbeat> .\\install-service-metricbeat.ps1', + ], + textPost: + 'Modify the settings under `output.elasticsearch` in the ' + + '`C:\\Program Files\\Metricbeat\\metricbeat.yml` file to point to your Elasticsearch installation.', + }, + }, + START: { + OSX: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards.' + + ' If the dashboards are already set up, omit this command.', + commands: ['./metricbeat setup', './metricbeat -e'], + }, + DEB: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], + }, + RPM: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: ['sudo metricbeat setup', 'sudo service metricbeat start'], + }, + WINDOWS: { + title: 'Start Metricbeat', + textPre: + 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, ' + + 'omit this command.', + commands: [ + 'PS C:\\Program Files\\Metricbeat> metricbeat.exe setup', + 'PS C:\\Program Files\\Metricbeat> Start-Service metricbeat', + ], + }, + }, + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + DEB: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + RPM: { + title: 'Edit the configuration', + textPre: 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Metricbeat\\metricbeat.yml` to set the connection information:', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: "elastic"', + ' password: ""', + 'setup.kibana:', + ' host: ""', + ], + textPost: + 'Where `` is the password of the `elastic` user, ' + + '`` is the URL of Elasticsearch, and `` is the URL of Kibana.', + }, + }, +}); -export function createMetricbeatCloudInstructions() { - return { - CONFIG: { - OSX: { - title: 'Edit the configuration', - textPre: 'Modify `metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, - DEB: { - title: 'Edit the configuration', - textPre: - 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, - RPM: { - title: 'Edit the configuration', - textPre: - 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, - WINDOWS: { - title: 'Edit the configuration', - textPre: - 'Modify `C:\\Program Files\\Filebeat\\metricbeat.yml` to set the connection information for Elastic Cloud:', - commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], - textPost: 'Where `` is the password of the `elastic` user.', - }, +export const createMetricbeatCloudInstructions = () => ({ + CONFIG: { + OSX: { + title: 'Edit the configuration', + textPre: 'Modify `metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', }, - }; -} + DEB: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + RPM: { + title: 'Edit the configuration', + textPre: + 'Modify `/etc/metricbeat/metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + WINDOWS: { + title: 'Edit the configuration', + textPre: + 'Modify `C:\\Program Files\\Filebeat\\metricbeat.yml` to set the connection information for Elastic Cloud:', + commands: ['cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"'], + textPost: 'Where `` is the password of the `elastic` user.', + }, + }, +}); export function metricbeatEnableInstructions(moduleName) { return { diff --git a/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js b/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js index b308cfdeda6b2..eec1848c06a93 100644 --- a/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js +++ b/src/core_plugins/kibana/common/tutorials/onprem_cloud_instructions.js @@ -17,28 +17,24 @@ * under the License. */ -export function createTrycloudOption1() { - return { - title: 'Option 1: Try module in Elastic Cloud', - textPre: - 'Go to [Elastic Cloud](https://www.elastic.co/cloud/as-a-service/signup?blade=kib). Register if you ' + - 'do not already have an account. Free 14-day trial available.\n\n' + - 'Log into the Elastic Cloud console\n\n' + - 'To create a cluster, in Elastic Cloud console:\n' + - ' 1. Select **Create Deployment** and specify the **Deployment Name**\n' + - ' 2. Modify the other deployment options as needed (or not, the defaults are great to get started)\n' + - ' 3. Click **Create Deployment**\n' + - ' 4. Wait until deployment creation completes\n' + - ' 5. Go to the new Cloud Kibana instance and follow the Kibana Home instructions', - }; -} +export const createTrycloudOption1 = () => ({ + title: 'Option 1: Try module in Elastic Cloud', + textPre: + 'Go to [Elastic Cloud](https://www.elastic.co/cloud/as-a-service/signup?blade=kib). Register if you ' + + 'do not already have an account. Free 14-day trial available.\n\n' + + 'Log into the Elastic Cloud console\n\n' + + 'To create a cluster, in Elastic Cloud console:\n' + + ' 1. Select **Create Deployment** and specify the **Deployment Name**\n' + + ' 2. Modify the other deployment options as needed (or not, the defaults are great to get started)\n' + + ' 3. Click **Create Deployment**\n' + + ' 4. Wait until deployment creation completes\n' + + ' 5. Go to the new Cloud Kibana instance and follow the Kibana Home instructions', +}); -export function createTrycloudOption2() { - return { - title: 'Option 2: Connect local Kibana to a Cloud instance', - textPre: - 'If you are running this Kibana instance against a hosted Elasticsearch instance,' + - ' proceed with manual setup.\n\n' + - 'Save the **Elasticsearch** endpoint as `` and the cluster **Password** as `` for your records', - }; -} +export const createTrycloudOption2 = () => ({ + title: 'Option 2: Connect local Kibana to a Cloud instance', + textPre: + 'If you are running this Kibana instance against a hosted Elasticsearch instance,' + + ' proceed with manual setup.\n\n' + + 'Save the **Elasticsearch** endpoint as `` and the cluster **Password** as `` for your records', +}); diff --git a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js index d09f7da5a38f7..49c4b999af18e 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js @@ -19,20 +19,19 @@ /* eslint-disable max-len */ -export function createNodeClientInstructions() { - return [ - { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Node.js as a dependency to your application.', - commands: ['npm install elastic-apm-node --save'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `serviceName`.' + - ' This agent supports Express, Koa, hapi, and custom Node.js.', - commands: `// Add this to the VERY top of the first file loaded in your app +export const createNodeClientInstructions = () => [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for Node.js as a dependency to your application.', + commands: ['npm install elastic-apm-node --save'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the `serviceName`.' + + ' This agent supports Express, Koa, hapi, and custom Node.js.', + commands: `// Add this to the VERY top of the first file loaded in your app var apm = require('elastic-apm-node').start({curlyOpen} // Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space) serviceName: '', @@ -43,24 +42,22 @@ var apm = require('elastic-apm-node').start({curlyOpen} // Set custom APM Server URL (default: http://localhost:8200) serverUrl: '' {curlyClose})`.split('\n'), - textPost: `See [the documentation]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/index.html) for advanced usage, including how to use with [Babel/ES Modules]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/advanced-setup.html#es-modules).`, - }, - ]; -} - -export function createDjangoClientInstructions() { - return [ - { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Python as a dependency.', - commands: ['$ pip install elastic-apm'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `SERVICE_NAME`.', - commands: `# Add the agent to the installed apps + textPost: `See [the documentation]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/index.html) for advanced usage, including how to use with [Babel/ES Modules]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/advanced-setup.html#es-modules).`, + }, +]; + +export const createDjangoClientInstructions = () => [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for Python as a dependency.', + commands: ['$ pip install elastic-apm'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the `SERVICE_NAME`.', + commands: `# Add the agent to the installed apps INSTALLED_APPS = ( 'elasticapm.contrib.django', # ... @@ -83,26 +80,24 @@ MIDDLEWARE = ( 'elasticapm.contrib.django.middleware.TracingMiddleware', #... )`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/python/2.x/django-support.html) for advanced usage.', - }, - ]; -} - -export function createFlaskClientInstructions() { - return [ - { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Python as a dependency.', - commands: ['$ pip install elastic-apm[flask]'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `SERVICE_NAME`.', - commands: `# initialize using environment variables + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/python/2.x/django-support.html) for advanced usage.', + }, +]; + +export const createFlaskClientInstructions = () => [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for Python as a dependency.', + commands: ['$ pip install elastic-apm[flask]'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the `SERVICE_NAME`.', + commands: `# initialize using environment variables from elasticapm.contrib.flask import ElasticAPM app = Flask(__name__) apm = ElasticAPM(app) @@ -122,25 +117,23 @@ app.config['ELASTIC_APM'] = {curlyOpen} {curlyClose} apm = ElasticAPM(app)`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/python/2.x/flask-support.html) for advanced usage.', - }, - ]; -} - -export function createRailsClientInstructions() { - return [ - { - title: 'Install the APM agent', - textPre: 'Add the agent to your Gemfile.', - commands: [`gem 'elastic-apm'`], - }, - { - title: 'Configure the agent', - textPre: - 'APM is automatically started when your app boots. Configure the agent, by creating the config file `config/elastic_apm.yml`', - commands: `# config/elastic_apm.yml: + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/python/2.x/flask-support.html) for advanced usage.', + }, +]; + +export const createRailsClientInstructions = () => [ + { + title: 'Install the APM agent', + textPre: 'Add the agent to your Gemfile.', + commands: [`gem 'elastic-apm'`], + }, + { + title: 'Configure the agent', + textPre: + 'APM is automatically started when your app boots. Configure the agent, by creating the config file `config/elastic_apm.yml`', + commands: `# config/elastic_apm.yml: # Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space # Defaults to the name of your Rails app @@ -151,25 +144,23 @@ export function createRailsClientInstructions() { # Set custom APM Server URL (default: http://localhost:8200) # server_url: 'http://localhost:8200'`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', - }, - ]; -} - -export function createRackClientInstructions() { - return [ - { - title: 'Install the APM agent', - textPre: 'Add the agent to your Gemfile.', - commands: [`gem 'elastic-apm'`], - }, - { - title: 'Configure the agent', - textPre: - 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', - commands: `# config.ru + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', + }, +]; + +export const createRackClientInstructions = () => [ + { + title: 'Install the APM agent', + textPre: 'Add the agent to your Gemfile.', + commands: [`gem 'elastic-apm'`], + }, + { + title: 'Configure the agent', + textPre: + 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', + commands: `# config.ru require 'sinatra/base' class MySinatraApp < Sinatra::Base @@ -186,11 +177,11 @@ export function createRackClientInstructions() { run MySinatraApp at_exit {curlyOpen} ElasticAPM.stop {curlyClose}`.split('\n'), - }, - { - title: 'Create config file', - textPre: 'Create a config file `config/elastic_apm.yml`:', - commands: `# config/elastic_apm.yml: + }, + { + title: 'Create config file', + textPre: 'Create a config file `config/elastic_apm.yml`:', + commands: `# config/elastic_apm.yml: # Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space # Defaults to the name of your Rack app's class. @@ -201,29 +192,27 @@ export function createRackClientInstructions() { # Set custom APM Server URL (default: http://localhost:8200) # server_url: 'http://localhost:8200'`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', - }, - ]; -} - -export function createJsClientInstructions() { - return [ - { - title: 'Enable Real User Monitoring support in the APM server', - textPre: - 'Please refer to [the documentation]({config.docs.base_url}guide/en/apm/server/{config.docs.version}/rum.html).', - }, - { - title: 'Install the APM agent', - textPre: 'Install the APM agent for JavaScript as a dependency to your application:', - commands: [`npm install elastic-apm-js-base --save`], - }, - { - title: 'Configure the agent', - textPre: 'Agents are libraries that run inside of your application.', - commands: `import {curlyOpen} init as initApm {curlyClose} from 'elastic-apm-js-base' + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', + }, +]; + +export const createJsClientInstructions = () => [ + { + title: 'Enable Real User Monitoring support in the APM server', + textPre: + 'Please refer to [the documentation]({config.docs.base_url}guide/en/apm/server/{config.docs.version}/rum.html).', + }, + { + title: 'Install the APM agent', + textPre: 'Install the APM agent for JavaScript as a dependency to your application:', + commands: [`npm install elastic-apm-js-base --save`], + }, + { + title: 'Configure the agent', + textPre: 'Agents are libraries that run inside of your application.', + commands: `import {curlyOpen} init as initApm {curlyClose} from 'elastic-apm-js-base' var apm = initApm({curlyOpen} // Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space) @@ -235,27 +224,25 @@ var apm = initApm({curlyOpen} // Set service version (required for sourcemap feature) serviceVersion: '' {curlyClose})`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/js-base/current/index.html) for advanced usage.', - }, - ]; -} - -export function createGoClientInstructions() { - return [ - { - title: 'Install the APM agent', - textPre: 'Install the APM agent packages for Go.', - commands: ['go get github.com/elastic/apm-agent-go'], - }, - { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the executable ' + - ' file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.', - commands: `# Initialize using environment variables: + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/js-base/current/index.html) for advanced usage.', + }, +]; + +export const createGoClientInstructions = () => [ + { + title: 'Install the APM agent', + textPre: 'Install the APM agent packages for Go.', + commands: ['go get github.com/elastic/apm-agent-go'], + }, + { + title: 'Configure the agent', + textPre: + 'Agents are libraries that run inside of your application process.' + + ' APM services are created programmatically based on the executable ' + + ' file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.', + commands: `# Initialize using environment variables: # Set the service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space. # If ELASTIC_APM_SERVICE_NAME is not specified, the executable name will be used. @@ -267,16 +254,16 @@ export ELASTIC_APM_SERVER_URL= # Set if APM Server requires a token. export ELASTIC_APM_SECRET_TOKEN= `.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/go/current/configuration.html) for advanced configuration.', - }, - { - title: 'Instrument your application', - textPre: - 'Instrument your Go application by using one of the provided instrumentation modules or ' + - 'by using the tracer API directly.', - commands: ` + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/go/current/configuration.html) for advanced configuration.', + }, + { + title: 'Instrument your application', + textPre: + 'Instrument your Go application by using one of the provided instrumentation modules or ' + + 'by using the tracer API directly.', + commands: ` import ( "net/http" @@ -289,40 +276,37 @@ func main() {curlyOpen} http.ListenAndServe(":8080", apmhttp.Wrap(mux)) {curlyClose} `.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html) for a detailed ' + - 'guide to instrumenting Go source code.\n\n' + - '**Warning: The Go agent is currently in Beta and not meant for production use.**', - }, - ]; -} - -export function createJavaClientInstructions() { - return [ - { - title: 'Download the APM agent', - textPre: - 'Download the agent jar from [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent). ' + - 'Do **not** add the agent as a dependency to your application.', - }, - { - title: 'Start your application with the javaagent flag', - textPre: - 'Add the `-javaagent` flag and configure the agent with system properties.\n' + - '\n' + - ' * Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)\n' + - ' * Set custom APM Server URL (default: http://localhost:8200)\n' + - ' * Set the base package of your application', - commands: `java -javaagent:/path/to/elastic-apm-agent-.jar \\ + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html) for a detailed ' + + 'guide to instrumenting Go source code.\n\n' + + '**Warning: The Go agent is currently in Beta and not meant for production use.**', + }, +]; + +export const createJavaClientInstructions = () => [ + { + title: 'Download the APM agent', + textPre: + 'Download the agent jar from [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent). ' + + 'Do **not** add the agent as a dependency to your application.', + }, + { + title: 'Start your application with the javaagent flag', + textPre: + 'Add the `-javaagent` flag and configure the agent with system properties.\n' + + '\n' + + ' * Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)\n' + + ' * Set custom APM Server URL (default: http://localhost:8200)\n' + + ' * Set the base package of your application', + commands: `java -javaagent:/path/to/elastic-apm-agent-.jar \\ -Delastic.apm.service_name=my-application \\ -Delastic.apm.server_url=http://localhost:8200 \\ -Delastic.apm.application_packages=org.example \\ -jar my-application.jar`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/java/current/index.html) for configuration options and advanced usage.\n\n' + - '**Warning: The Java agent is currently in Beta and not meant for production use.**', - }, - ]; -} + textPost: + 'See the [documentation]' + + '({config.docs.base_url}guide/en/apm/agent/java/current/index.html) for configuration options and advanced usage.\n\n' + + '**Warning: The Java agent is currently in Beta and not meant for production use.**', + }, +]; diff --git a/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js b/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js index 121bd1a889b5a..59d4d5fe75c1b 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js @@ -17,27 +17,23 @@ * under the License. */ -export function createEditConfig() { - return { - title: 'Edit the configuration', - textPre: - `If you're using an X-Pack secured version of Elastic Stack, you must specify` + - ' credentials in the `apm-server.yml` config file.', - commands: [ - 'output.elasticsearch:', - ' hosts: [""]', - ' username: ', - ' password: ', - ], - }; -} +export const createEditConfig = () => ({ + title: 'Edit the configuration', + textPre: + `If you're using an X-Pack secured version of Elastic Stack, you must specify` + + ' credentials in the `apm-server.yml` config file.', + commands: [ + 'output.elasticsearch:', + ' hosts: [""]', + ' username: ', + ' password: ', + ], +}); -function createStartServer() { - return { - title: 'Start APM Server', - textPre: 'The server processes and stores application performance metrics in Elasticsearch.', - }; -} +const createStartServer = () => ({ + title: 'Start APM Server', + textPre: 'The server processes and stores application performance metrics in Elasticsearch.', +}); export function createStartServerUnix() { const START_SERVER = createStartServer(); @@ -49,44 +45,36 @@ export function createStartServerUnix() { }; } -function createDownloadServerTitle() { - return 'Download and unpack APM Server'; -} +const createDownloadServerTitle = () => 'Download and unpack APM Server'; -export function createDownloadServerOsx() { - return { - title: createDownloadServerTitle(), - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', - 'tar xzvf apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', - 'cd apm-server-{config.kibana.version}-darwin-x86_64/', - ], - }; -} +export const createDownloadServerOsx = () => ({ + title: createDownloadServerTitle(), + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', + 'tar xzvf apm-server-{config.kibana.version}-darwin-x86_64.tar.gz', + 'cd apm-server-{config.kibana.version}-darwin-x86_64/', + ], +}); -export function createDownloadServerDeb() { - return { - title: createDownloadServerTitle(), - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-amd64.deb', - 'sudo dpkg -i apm-server-{config.kibana.version}-amd64.deb', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', - }; -} +export const createDownloadServerDeb = () => ({ + title: createDownloadServerTitle(), + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-amd64.deb', + 'sudo dpkg -i apm-server-{config.kibana.version}-amd64.deb', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', +}); -export function createDownloadServerRpm() { - return { - title: createDownloadServerTitle(), - commands: [ - 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-x86_64.rpm', - 'sudo rpm -vi apm-server-{config.kibana.version}-x86_64.rpm', - ], - textPost: - 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', - }; -} +export const createDownloadServerRpm = () => ({ + title: createDownloadServerTitle(), + commands: [ + 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-x86_64.rpm', + 'sudo rpm -vi apm-server-{config.kibana.version}-x86_64.rpm', + ], + textPost: + 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', +}); export function createWindowsServerInstructions() { const START_SERVER = createStartServer(); diff --git a/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js index a7ba81b2a1654..4bce847b082e7 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js @@ -30,13 +30,11 @@ import { createJavaClientInstructions, } from './apm_client_instructions'; -function createServerUrlInstruction() { - return { - title: 'APM Server endpoint', - textPre: `Retrieve the APM Server URL from the Deployments section on the Elastic Cloud dashboard. +const createServerUrlInstruction = () => ({ + title: 'APM Server endpoint', + textPre: `Retrieve the APM Server URL from the Deployments section on the Elastic Cloud dashboard. You will also need the APM Server secret token, which was generated on deployment.`, - }; -} +}); export function createElasticCloudInstructions() { const SERVER_URL_INSTRUCTION = createServerUrlInstruction();