You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
Copy file name to clipboardexpand all lines: docs/en/ingest-management/elastic-agent/example-standalone-monitor-nginx-ess.asciidoc
+72-39
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,22 @@
1
1
[[example-standalone-monitor-nginx]]
2
-
= Example: Use standalone {agent} to monitor nginx
2
+
= Example: Use standalone {agent}with {ess}to monitor nginx
3
3
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.
5
5
6
6
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.
7
7
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>>.
. <<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>>.
16
17
17
18
[discrete]
18
-
[[nginx-guide-prereqs]]
19
+
[[nginx-guide-prereqs-ess]]
19
20
=== Prerequisites
20
21
21
22
To get started, you need:
@@ -24,7 +25,7 @@ To get started, you need:
24
25
. 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.
25
26
26
27
[discrete]
27
-
[[nginx-guide-install-nginx]]
28
+
[[nginx-guide-install-nginx-ess]]
28
29
=== Step 1: Install nginx
29
30
30
31
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
42
43
image::images/guide-nginx-welcome.png["Browser window showing Welcome to nginx!"]
43
44
44
45
[discrete]
45
-
[[nginx-guide-sign-up]]
46
+
[[nginx-guide-sign-up-ess]]
46
47
=== Step 2: Create an {ecloud} deployment
47
48
48
49
NOTE: If you've already signed up for a trial deployment you can skip this step.
49
50
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:
51
52
52
53
. Go to our link:https://cloud.elastic.co/registration?elektra=guide-welcome-cta[{ecloud} Trial] page.
53
54
@@ -56,18 +57,33 @@ Now that your web server is running, let's get set up to monitor it in {ecloud}.
56
57
[role="screenshot"]
57
58
image::images/guide-sign-up-trial.png["Start your free Elastic Cloud trial",width="50%"]
58
59
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*.
63
63
64
64
. While the deployment sets up, make a note of your `elastic` superuser password and keep it in a safe place.
65
65
66
66
. Once the deployment is ready, select *Continue*. At this point, you access {kib} and a selection of setup guides.
67
67
68
68
[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
71
87
72
88
{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.
73
89
@@ -82,15 +98,15 @@ image::images/guide-agent-policies.png["Agent policies tab in Fleet"]
Elastic integrations are a streamlined way to connect your data from popular services and platforms to the {stack}, including nginx.
89
105
90
106
. From the **{fleet} -> Agent policies** tab, click the link for your new `nginx-policy`.
91
107
+
92
108
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.
94
110
. Click **Add integration**.
95
111
. On the Integrations page search for "nginx".
96
112
+
@@ -100,16 +116,16 @@ image::images/guide-integrations-page.png["Integrations page with nginx in the s
100
116
. Click the link to **Add integration only (skip agent installation)**. You'll install standalone {agent} in a later step.
101
117
. 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.
102
118
+
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.
. In the confirmation dialog, select to **Add {agent} later**.
107
123
+
108
124
image::images/guide-nginx-integration-added.png["Nginx Integration added confirmation UI with Add {agent} later selected."]
109
125
110
126
[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}
113
129
114
130
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.
115
131
@@ -120,7 +136,7 @@ Rather than opt for {fleet} to centrally manage {agent}, you'll configure an age
120
136
image::images/guide-add-agent-standalone01.png["Add agent UI with nginx-policy and Run-standalone selected."]
121
137
. 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.
122
138
+
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.
124
140
. For the **Install {agent} on your host** step, select the tab for your host operating system and run the commands on your host.
125
141
+
126
142
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
148
164
+
149
165
Since you're running the agent in standalone mode the `Not enrolled into Fleet` message is expected.
150
166
. 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
+
153
184
. 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`.
154
185
. Replace the default policy file with the version that you downloaded and updated. For example:
155
186
+
@@ -187,8 +218,8 @@ message: Running
187
218
----
188
219
189
220
[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
192
223
193
224
Now that {agent} is running, it's time to confirm that the agent data is flowing into {es}.
194
225
@@ -208,26 +239,28 @@ like the agent logs, the agent metrics should be flowing into {es} and visible i
208
239
image::images/guide-agent-metrics-flowing.png["Kibana Dashboard shows agent metrics are flowing into Elasticsearch."]
209
240
210
241
[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
213
244
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.
215
246
216
247
. View your system logs.
217
248
.. Open the {kib} menu and go to **Management -> Integrations -> Installed integrations**.
218
249
.. 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.
220
252
. View your system metrics.
221
253
222
254
.. Return to **Management -> Integrations -> Installed integrations**.
223
255
.. 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.
225
258
+
226
259
image::images/guide-system-metrics-dashboard.png["The System metrics host overview showing CPU usage, memory usage, and other visualizations"]
227
260
228
261
[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
231
264
232
265
Now let's view your nginx logging data.
233
266
@@ -240,7 +273,7 @@ image::images/guide-nginx-logs-dashboard.png["The nginx logs dashboard shows var
240
273
+
241
274
image::images/guide-nginx-browser-breakdown.png["Kibana Dashboard shows agent metrics are flowing into Elasticsearch."]
242
275
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.
0 commit comments