Skip to content

Commit e310d67

Browse files
kilfoylemergify[bot]
authored andcommitted
Add tutorial for standalone agent on serverless monitoring nginx (#906)
* Add tutorial for standalone agent on serverless monitoring nginx * fixup * fixup * Change original guide to use API key auth * Change IDs to -ess; small fixes (cherry picked from commit 4db4aa2)
1 parent c1d9a12 commit e310d67

File tree

3 files changed

+362
-40
lines changed

3 files changed

+362
-40
lines changed

docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx.asciidoc docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-ess.asciidoc

+72-39
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
[[example-standalone-monitor-nginx]]
2-
= Example: Use standalone {agent} to monitor nginx
2+
= Example: Use standalone {agent} with {ess} to monitor nginx
33

4-
This guide walks you through a simple monitoring scenario so you can learn the basics of setting up standalone {agent}, using it to work with {ecloud} and an Elastic integration.
4+
This guide walks you through a simple monitoring scenario so you can learn the basics of setting up standalone {agent}, using it to work with {ess} and an Elastic integration.
55

66
Following these steps, you'll deploy the {stack}, install a standalone {agent} on a host to monitor an nginx web server instance, and access visualizations based on the collected logs.
77

8-
. <<nginx-guide-install-nginx,Install nginx>>.
9-
. <<nginx-guide-sign-up,Create an {ecloud} deployment>>.
10-
. <<nginx-guide-create-policy,Create an {agent} policy>>.
11-
. <<nginx-guide-add-integration,Add the Nginx Integration>>.
12-
. <<nginx-guide-configure-standalone-agent,Configure standalone {agent}>>.
13-
. <<nginx-guide-confirm-agent-data,Confirm that your {agent} data is flowing>>.
14-
. <<nginx-guide-view-system-data,View your system data>>.
15-
. <<nginx-guide-view-nginx-data,View your nginx logging data>>.
8+
. <<nginx-guide-install-nginx-ess,Install nginx>>.
9+
. <<nginx-guide-sign-up-ess,Create an {ecloud} deployment>>.
10+
. <<nginx-guide-create-api-key-ess,Create an {ecloud} API key.>>
11+
. <<nginx-guide-create-policy-ess,Create an {agent} policy>>.
12+
. <<nginx-guide-add-integration-ess,Add the Nginx Integration>>.
13+
. <<nginx-guide-configure-standalone-agent-ess,Configure standalone {agent}>>.
14+
. <<nginx-guide-confirm-agent-data-ess,Confirm that your {agent} data is flowing>>.
15+
. <<nginx-guide-view-system-data-ess,View your system data>>.
16+
. <<nginx-guide-view-nginx-data-ess,View your nginx logging data>>.
1617

1718
[discrete]
18-
[[nginx-guide-prereqs]]
19+
[[nginx-guide-prereqs-ess]]
1920
=== Prerequisites
2021

2122
To get started, you need:
@@ -24,7 +25,7 @@ To get started, you need:
2425
. A Linux host machine on which you'll install an nginx web server. The commands in this guide use an Ubuntu image but any Linux distribution should be fine.
2526

2627
[discrete]
27-
[[nginx-guide-install-nginx]]
28+
[[nginx-guide-install-nginx-ess]]
2829
=== Step 1: Install nginx
2930

3031
To start, we'll set up a basic link:https://docs.nginx.com/nginx/admin-guide/web-server/[nginx web server].
@@ -42,12 +43,12 @@ sudo apt install nginx
4243
image::images/guide-nginx-welcome.png["Browser window showing Welcome to nginx!"]
4344

4445
[discrete]
45-
[[nginx-guide-sign-up]]
46+
[[nginx-guide-sign-up-ess]]
4647
=== Step 2: Create an {ecloud} deployment
4748

4849
NOTE: If you've already signed up for a trial deployment you can skip this step.
4950

50-
Now that your web server is running, let's get set up to monitor it in {ecloud}. An {ecloud} deployment offers you all of the features of the {stack} as a hosted service. To test drive your first deployment, sign up for a free {ecloud} trial:
51+
Now that your web server is running, let's get set up to monitor it in {ecloud}. An {ecloud} {ess} deployment offers you all of the features of the {stack} as a hosted service. To test drive your first deployment, sign up for a free {ecloud} trial:
5152

5253
. Go to our link:https://cloud.elastic.co/registration?elektra=guide-welcome-cta[{ecloud} Trial] page.
5354

@@ -56,18 +57,33 @@ Now that your web server is running, let's get set up to monitor it in {ecloud}.
5657
[role="screenshot"]
5758
image::images/guide-sign-up-trial.png["Start your free Elastic Cloud trial",width="50%"]
5859

59-
. After you've link:https://cloud.elastic.co/login[logged in], you can create a deployment. Give your deployment a name and select *Create deployment*.
60-
+
61-
[role="screenshot"]
62-
image::images/guide-create-first-deployment.png["Create your first deployment",width="70%"]
60+
. After you've link:https://cloud.elastic.co/login[logged in], select *Create deployment* and give your deployment a name. You can leave the default options or select a different cloud provider, region, hardware profile, or version.
61+
62+
. Select *Create deployment*.
6363

6464
. While the deployment sets up, make a note of your `elastic` superuser password and keep it in a safe place.
6565

6666
. Once the deployment is ready, select *Continue*. At this point, you access {kib} and a selection of setup guides.
6767

6868
[discrete]
69-
[[nginx-guide-create-policy]]
70-
=== Step 3: Create an {agent} policy
69+
[[nginx-guide-create-api-key-ess]]
70+
=== Step 3: Create an {ecloud} API key
71+
72+
. From the {kib} menu and go to *Stack Management* -> *API keys*.
73+
74+
. Select *Create API key*.
75+
76+
. Give the key a name, for example `nginx example API key`.
77+
78+
. Leave the other default options and select *Create API key*.
79+
80+
. In the *Create API key* confirmation dialog, change the dropdown menu setting from `Encoded` to `Beats`. This sets the API key format for communication between {agent} (which is based on {beats}) and {es}.
81+
82+
. Copy the generated API key and store it in a safe place. You'll use it in a later step.
83+
84+
[discrete]
85+
[[nginx-guide-create-policy-ess]]
86+
=== Step 4: Create an {agent} policy
7187

7288
{agent} is a single, unified way to add monitoring for logs, metrics, and other types of data to a host. It can also protect hosts from security threats, query data from operating systems, and more. A single agent makes it easy and fast to deploy monitoring across your infrastructure. Each agent has a single policy (a collection of input settings) that you can update to add integrations for new data sources, security protections, and more.
7389

@@ -82,15 +98,15 @@ image::images/guide-agent-policies.png["Agent policies tab in Fleet"]
8298
image::images/guide-create-agent-policy.png["Create agent policy UI"]
8399

84100
[discrete]
85-
[[nginx-guide-add-integration]]
86-
=== Step 4: Add the Nginx Integration
101+
[[nginx-guide-add-integration-ess]]
102+
=== Step 5: Add the Nginx Integration
87103

88104
Elastic integrations are a streamlined way to connect your data from popular services and platforms to the {stack}, including nginx.
89105

90106
. From the **{fleet} -> Agent policies** tab, click the link for your new `nginx-policy`.
91107
+
92108
image::images/guide-nginx-policy.png["The nginx-policy UI with integrations tab selected"]
93-
. Note that `system-` integration is included because you opted earlier to collect system logs and metrics.
109+
. Note that the System integration (`system-1`) is included because you opted earlier to collect system logs and metrics.
94110
. Click **Add integration**.
95111
. On the Integrations page search for "nginx".
96112
+
@@ -100,16 +116,16 @@ image::images/guide-integrations-page.png["Integrations page with nginx in the s
100116
. Click the link to **Add integration only (skip agent installation)**. You'll install standalone {agent} in a later step.
101117
. Here, you can select options such as the paths to where your nginx logs are stored, whether or not to collect metrics data, and various other settings.
102118
+
103-
For now, leave all of the default settings and click **Save and continue** to add the Nginx Integration to your `nginx-policy` policy.
119+
For now, leave all of the default settings and click **Save and continue** to add the Nginx integration to your `nginx-policy` policy.
104120
+
105121
image::images/guide-add-nginx-integration.png["Add Nginx Integration UI"]
106122
. In the confirmation dialog, select to **Add {agent} later**.
107123
+
108124
image::images/guide-nginx-integration-added.png["Nginx Integration added confirmation UI with Add {agent} later selected."]
109125

110126
[discrete]
111-
[[nginx-guide-configure-standalone-agent]]
112-
=== Step 5: Configure standalone {agent}
127+
[[nginx-guide-configure-standalone-agent-ess]]
128+
=== Step 6: Configure standalone {agent}
113129

114130
Rather than opt for {fleet} to centrally manage {agent}, you'll configure an agent to run in standalone mode, so it will be managed by hand.
115131

@@ -120,7 +136,7 @@ Rather than opt for {fleet} to centrally manage {agent}, you'll configure an age
120136
image::images/guide-add-agent-standalone01.png["Add agent UI with nginx-policy and Run-standalone selected."]
121137
. For the **Configure the agent** step, choose **Download Policy**. Save the `elastic-agent.yml` file to a directory on the host where you'll install nginx for monitoring.
122138
+
123-
Notice that the policy contains all of the input, output, and other settings for the Nginx and System Integrations. If you already have a standalone agent installed on a host with an existing {agent} policy, you can use the method described here to add a new integration. Just add the settings from the **Configure the agent** step to your existing `elastic-agent.yml` file.
139+
Have a look inside the policy file and notice that it contains all of the input, output, and other settings for the Nginx and System integrations. If you already have a standalone agent installed on a host with an existing {agent} policy, you can use the method described here to add a new integration. Just add the settings from the **Configure the agent** step to your existing `elastic-agent.yml` file.
124140
. For the **Install {agent} on your host** step, select the tab for your host operating system and run the commands on your host.
125141
+
126142
image::images/guide-install-agent-on-host.png["Install {agent} on your host step, showing tabs with the commands for different operating systems."]
@@ -148,8 +164,23 @@ elastic-agent status
148164
+
149165
Since you're running the agent in standalone mode the `Not enrolled into Fleet` message is expected.
150166
. Open the `elastic-agent.yml` policy file that you saved.
151-
. Near the top of the file, replace `${ES_USERNAME}` with the username for the {ecloud} deployment that you created in <<nginx-guide-sign-up,Step 2>>. The default is `elastic`.
152-
. Similarly, replace `${ES_PASSWORD}` with your superuser password.
167+
. Near the top of the file, replace:
168+
+
169+
[source,yaml]
170+
----
171+
username: '${ES_USERNAME}'
172+
password: '${ES_PASSWORD}'
173+
----
174+
+
175+
with:
176+
+
177+
[source,yaml]
178+
----
179+
api_key: '<your-api-key>'
180+
----
181+
+
182+
where `your-api-key` is the API key that you generated in <<nginx-guide-create-api-key-ess>>.
183+
153184
. Find the location of the default `elastic-agent.yml` policy file that is included in your {agent} install. Install directories for each platform are described in <<installation-layout,Installation layout>>. In our example Ubuntu image the default policy file can be found in `/etc/elastic-agent/elastic-agent.yml`.
154185
. Replace the default policy file with the version that you downloaded and updated. For example:
155186
+
@@ -187,8 +218,8 @@ message: Running
187218
----
188219

189220
[discrete]
190-
[[nginx-guide-confirm-agent-data]]
191-
=== Step 6: Confirm that your {agent} data is flowing
221+
[[nginx-guide-confirm-agent-data-ess]]
222+
=== Step 7: Confirm that your {agent} data is flowing
192223

193224
Now that {agent} is running, it's time to confirm that the agent data is flowing into {es}.
194225

@@ -208,26 +239,28 @@ like the agent logs, the agent metrics should be flowing into {es} and visible i
208239
image::images/guide-agent-metrics-flowing.png["Kibana Dashboard shows agent metrics are flowing into Elasticsearch."]
209240

210241
[discrete]
211-
[[nginx-guide-view-system-data]]
212-
=== Step 7: View your system data
242+
[[nginx-guide-view-system-data-ess]]
243+
=== Step 8: View your system data
213244

214-
In the step to <<nginx-guide-create-policy,create an {agent} policy>> you chose to collect system logs and metrics, so you can access those now.
245+
In the step to <<nginx-guide-create-policy-ess,create an {agent} policy>> you chose to collect system logs and metrics, so you can access those now.
215246

216247
. View your system logs.
217248
.. Open the {kib} menu and go to **Management -> Integrations -> Installed integrations**.
218249
.. Select the **System** card and open the **Assets** tab. This is a quick way to access all of the dashboards, saved searches, and visualizations that come with each integration.
219-
.. Select `[Logs System] Syslog dashboard`. The {kib} Dashboard opens with visualizations of Syslog events, hostnames and processes, and more.
250+
.. Select `[Logs System] Syslog dashboard`.
251+
.. Select the calandar icon and change the time setting to `Today`. The {kib} Dashboard shows visualizations of Syslog events, hostnames and processes, and more.
220252
. View your system metrics.
221253

222254
.. Return to **Management -> Integrations -> Installed integrations**.
223255
.. Select the **System** card and open the **Assets** tab.
224-
.. Select `[Metrics System] Host overview`. The {kib} Dashboard opens with visualizations of host metrics including CPU usage, memory usage, running processes, and others.
256+
.. This time, select `[Metrics System] Host overview`.
257+
.. Select the calandar icon and change the time setting to `Today`. The {kib} Dashboard shows visualizations of host metrics including CPU usage, memory usage, running processes, and others.
225258
+
226259
image::images/guide-system-metrics-dashboard.png["The System metrics host overview showing CPU usage, memory usage, and other visualizations"]
227260

228261
[discrete]
229-
[[nginx-guide-view-nginx-data]]
230-
=== Step 8: View your nginx logging data
262+
[[nginx-guide-view-nginx-data-ess]]
263+
=== Step 9: View your nginx logging data
231264

232265
Now let's view your nginx logging data.
233266

@@ -240,7 +273,7 @@ image::images/guide-nginx-logs-dashboard.png["The nginx logs dashboard shows var
240273
+
241274
image::images/guide-nginx-browser-breakdown.png["Kibana Dashboard shows agent metrics are flowing into Elasticsearch."]
242275

243-
You have now successfully set up monitoring for nginx logs using standalone {agent} and an {ecloud} deployment.
276+
Congratulations! You have successfully set up monitoring for nginx using standalone {agent} and an {ecloud} deployment.
244277

245278
[discrete]
246279
=== What's next?

0 commit comments

Comments
 (0)