Skip to content

Commit

Permalink
[Ingest Manager] Update fleet instructions to run agent as a service (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Jul 29, 2020
1 parent 9494576 commit 9d7cf88
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/

import React from 'react';
import { EuiText, EuiSpacer, EuiCode, EuiCodeBlock, EuiCopy, EuiButton } from '@elastic/eui';
import styled from 'styled-components';
import { EuiText, EuiSpacer, EuiCode, EuiTitle, EuiCodeBlock } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { EnrollmentAPIKey } from '../../../types';

Expand All @@ -15,42 +16,86 @@ interface Props {
kibanaCASha256?: string;
}

// Otherwise the copy button is over the text
const CommandCode = styled.pre({
overflow: 'scroll',
});

export const ManualInstructions: React.FunctionComponent<Props> = ({
kibanaUrl,
apiKey,
kibanaCASha256,
}) => {
const command = `
./elastic-agent enroll ${kibanaUrl} ${apiKey.api_key}${
const enrollArgs = `${kibanaUrl} ${apiKey.api_key}${
kibanaCASha256 ? ` --ca_sha256=${kibanaCASha256}` : ''
}
}`;
const macOsLinuxTarCommand = `./elastic-agent enroll ${enrollArgs}
./elastic-agent run`;

const linuxDebRpmCommand = `./elastic-agent enroll ${enrollArgs}
systemctl enable elastic-agent
systemctl start elastic-agent`;

const windowsCommand = `./elastic-agent enroll ${enrollArgs}
./install-service-elastic-agent.ps1`;

return (
<>
<EuiText>
<FormattedMessage
id="xpack.ingestManager.enrollmentInstructions.descriptionText"
defaultMessage="From the agent’s directory, run these commands to enroll and start the Elastic Agent. {enrollCommand} will write to your agent’s configuration file so that it has the correct settings. You can use this command to setup agents on more than one host."
defaultMessage="From the agent’s directory, run the appropriate commands to enroll and start an Elastic Agent. You can reuse these commands to setup agents on more than one machine."
/>
</EuiText>
<EuiSpacer size="l" />
<EuiTitle size="xs">
<h4>
<FormattedMessage
id="xpack.ingestManager.enrollmentInstructions.windowsTitle"
defaultMessage="Windows"
/>
</h4>
</EuiTitle>
<EuiSpacer size="s" />
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
<CommandCode>{windowsCommand}</CommandCode>
</EuiCodeBlock>
<EuiSpacer size="l" />
<EuiTitle size="xs">
<h4>
<FormattedMessage
id="xpack.ingestManager.enrollmentInstructions.linuxDebRpmTitle"
defaultMessage="Linux (.deb and .rpm)"
/>
</h4>
</EuiTitle>
<EuiSpacer size="s" />
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
<CommandCode>{linuxDebRpmCommand}</CommandCode>
</EuiCodeBlock>
<EuiSpacer size="l" />
<EuiTitle size="xs">
<h4>
<FormattedMessage
id="xpack.ingestManager.enrollmentInstructions.macLinuxTarTitle"
defaultMessage="macOS / Linux (.tar.gz)"
/>
</h4>
</EuiTitle>
<EuiSpacer size="s" />
<EuiText color="subdued" size="s">
<FormattedMessage
id="xpack.ingestManager.enrollmentInstructions.macLinuxTarInstructions"
defaultMessage="You will need to run {command} if the agent’s system reboots."
values={{
enrollCommand: <EuiCode>agent enroll</EuiCode>,
command: <EuiCode>./elastic-agent run</EuiCode>,
}}
/>
</EuiText>
<EuiSpacer size="m" />
<EuiCodeBlock fontSize="m">
<pre>{command}</pre>
<EuiSpacer size="s" />
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
<CommandCode>{macOsLinuxTarCommand}</CommandCode>
</EuiCodeBlock>
<EuiSpacer size="m" />
<EuiCopy textToCopy={command}>
{(copy) => (
<EuiButton iconType="copy" fill onClick={copy}>
<FormattedMessage
id="xpack.ingestManager.enrollmentInstructions.copyButton"
defaultMessage="Copy command"
/>
</EuiButton>
)}
</EuiCopy>
</>
);
};
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -8181,8 +8181,6 @@
"xpack.ingestManager.editPackageConfig.updatedNotificationTitle": "正常に'{packageConfigName}'を更新しました",
"xpack.ingestManager.enrollemntAPIKeyList.emptyMessage": "登録トークンが見つかりません。",
"xpack.ingestManager.enrollemntAPIKeyList.loadingTokensMessage": "登録トークンを読み込んでいます...",
"xpack.ingestManager.enrollmentInstructions.copyButton": "コマンドをコピー",
"xpack.ingestManager.enrollmentInstructions.descriptionText": "エージェントのディレクトリから、これらのコマンドを実行して、Elasticエージェントを登録して起動します。{enrollCommand}はエージェントの構成ファイルに書き込み、正しい設定になるようにします。このコマンドを使用すると、複数のホストでエージェントを設定できます。",
"xpack.ingestManager.enrollmentStepAgentConfig.configSelectAriaLabel": "エージェント構成",
"xpack.ingestManager.enrollmentStepAgentConfig.configSelectLabel": "エージェント構成",
"xpack.ingestManager.enrollmentStepAgentConfig.enrollmentTokenSelectLabel": "登録トークン",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -8185,8 +8185,6 @@
"xpack.ingestManager.editPackageConfig.updatedNotificationTitle": "已成功更新“{packageConfigName}”",
"xpack.ingestManager.enrollemntAPIKeyList.emptyMessage": "未找到任何注册令牌。",
"xpack.ingestManager.enrollemntAPIKeyList.loadingTokensMessage": "正在加载注册令牌......",
"xpack.ingestManager.enrollmentInstructions.copyButton": "复制命令",
"xpack.ingestManager.enrollmentInstructions.descriptionText": "从代理的目录,运行这些命令以注册并启动 Elastic 代理。{enrollCommand} 将写入代理的配置文件,以便其具有正确的设置。可以使用此命令在多个主机上设置代理。",
"xpack.ingestManager.enrollmentStepAgentConfig.configSelectAriaLabel": "代理配置",
"xpack.ingestManager.enrollmentStepAgentConfig.configSelectLabel": "代理配置",
"xpack.ingestManager.enrollmentStepAgentConfig.enrollmentTokenSelectLabel": "注册令牌",
Expand Down

0 comments on commit 9d7cf88

Please sign in to comment.