Skip to content

Commit 61a125f

Browse files
Update metrics docs, add run-container guide
1 parent d9609a5 commit 61a125f

File tree

6 files changed

+116
-259
lines changed

6 files changed

+116
-259
lines changed

content/agent/how-to/export-metrics.md

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: "Running the NGINX Agent in a Container"
3+
weight: 300
4+
docs: DOCS-000
5+
---
6+
7+
## Overview
8+
9+
This guide serves as a step-by-step guide to running the NGINX Agent in a container. It covers the basic setup needed to get the NGINX Agent up and running efficiently and securely.
10+
11+
## Before you begin
12+
13+
Before you begin this guide ensure:
14+
15+
> **Note**: This guide uses docker but the Agent will also work with other application containers.
16+
17+
- **Installed Docker:** Ensure Docker is installed and configured on your system. [You can download Docker here](https://www.docker.com/products/docker-desktop/).
18+
- **NGINX Agent Image:** You need access to the Docker image for the NGINX Agent. Find the appropriate image in your organization's registry or on Docker Hub if publicly available.
19+
- **NGINX Configuration File:** Prepare and validate your NGINX configuration files that the Agent will monitor.
20+
- **Credentials:** Acquire any necessary authentication tokens or credentials required for the NGINX Agent.
21+
22+
1. Pull the NGINX Agent Container Image
23+
24+
The NGINX Agent container image must be downloaded from a trusted source such as Docker Hub or a private container registry.
25+
26+
Run the following command to pull the official image:
27+
28+
```bash
29+
<!-- Registry HERE -->
30+
docker pull <Registry HERE>:latest
31+
```
32+
33+
Ensure you are using the correct image version. Replace `latest` with the desired version tag if necessary.
34+
35+
36+
2. Create a Configuration File
37+
38+
1. Create a configuration file named `nginx-agent.conf` in your current directory.
39+
2. Populate the file with the following structure:
40+
41+
```vim
42+
command:
43+
server:
44+
host: "<NGINX-One-Console-URL>" # Command server host
45+
port: 443 # Command server port
46+
auth:
47+
token: "<your-data-plane-key-here>" # Authentication token for the command server
48+
tls:
49+
skip_verify: false
50+
```
51+
52+
Replace the placeholder values:
53+
54+
- `<NGINX-One-Console-URL>`: The URL of your NGINX One Console instance.
55+
- `<your-data-plane-key-here>`: Your Data Plane access token.
56+
57+
58+
3. Run the Container
59+
60+
Run the NGINX Agent container with the configuration file mounted.
61+
62+
Use the following command:
63+
64+
```bash
65+
docker run -d \
66+
--name nginx-agent \
67+
-v $(pwd)/nginx-agent.conf:/etc/nginx-agent/nginx-agent.conf \
68+
nginx/agent:latest
69+
```
70+
71+
Key options explained:
72+
73+
- `-d`: Runs the container in detached mode.
74+
- `--name nginx-agent`: Assigns a name to the container for easy identification.
75+
- `-v $(pwd)/nginx-agent.conf:/etc/nginx-agent/nginx-agent.conf`: Mounts the configuration file into the container.
76+
77+
78+
4. Verify the Container is Running
79+
80+
Check the running status of the container:
81+
82+
```bash
83+
docker ps
84+
```
85+
86+
You should see an entry for `nginx-agent`. The `STATUS` field should indicate that the container is running.
87+
88+
5. Monitor Logs
89+
90+
To ensure the container is functioning properly and communicating with NGINX One Console, monitor the container logs.
91+
92+
Run the following command:
93+
94+
```bash
95+
docker logs -f nginx-agent
96+
```
97+
98+
Look for log entries indicating successful connection to the NGINX One Console and periodic metric transmission.
Lines changed: 15 additions & 208 deletions
Original file line numberDiff line numberDiff line change
@@ -1,229 +1,36 @@
11
---
2-
title: Metrics Export
2+
title: Exporting Metrics with NGINX Agent
33
weight: 200
44
---
55

66
## Overview
77

8-
The F5 NGINX Agent v3 now includes an embedded [OpenTelemetry](https://opentelemetry.io/) Collector, streamlining observability and metric collection for NGINX instances. With this feature, you can collect:
8+
The F5 NGINX Agent now includes an embedded [OpenTelemetry](https://opentelemetry.io/) Collector, streamlining observability and metric collection for NGINX instances. With this feature, you can collect:
99

1010
* Metrics from NGINX Plus and NGINX OSS
1111
* Host metrics (CPU, memory, disk, and network activity) from VMs or Containers
12-
1312

14-
This guide walks you through enabling and configuring the embedded OpenTelemetry Collector for metric export.
13+
> **Note**: The OpenTelemetry exporter is enabled by default. Once a valid connection to the management plane is established, the Agent will automatically begin exporting metrics.
1514
16-
# Key Benefits
15+
### Key Benefits
1716

1817
* Seamless Integration: No need to deploy an external OpenTelemetry Collector. All components are embedded within the Agent for streamlined observability.
1918
* Standardized Protocol: Support for OpenTelemetry standards ensures interoperability with a wide range of observability backends, including Jaeger, Prometheus, Splunk, and more.
2019

21-
## Before you begin
20+
### Verify Metrics Exported
2221

23-
Before you begin configuring the F5 NGINX Agent OTel Collector:
22+
You can validate that metrics are successfully exported by using the methods below:
2423

25-
- [NGINX One Console Getting Started]({{< relref "/nginx-one/getting-started" >}})
26-
- F5 NGINX OSS/Plus installed on a Virtual Machine
27-
- F5 NGINX Agent v3 is installed
24+
**NGINX One Dashboard**
2825

26+
- When an instance has connected to NGINX One Console [Connect to NGINX One Console]({{< ref "/nginx-one/how-to/nginx-configs/add-instance.md" >}}), you should be able to see metrics showing on the NGINX One Dashboard.
2927

30-
## Configure the OTel Collector - Virtual Machine
28+
**Agent Logs**
3129

32-
1. Locate the configuration file for the F5 NGINX Agent:
30+
Check the OpenTelemetry Collector logs for confirmation of successful metric processing:
3331

34-
```bash
35-
/etc/nginx-agent/nginx-agent.conf
36-
```
37-
2. Open the configuration file for editing:
38-
39-
```bash
40-
sudo vim /etc/nginx-agent/nginx-agent.conf
41-
```
42-
43-
3. Edit the `/etc/nginx-agent/nginx-agent.conf` and add the following.
44-
45-
Make sure to replace your-data-plane-key-here with the real data plane key that you are using for your application or service.
46-
47-
```vim
48-
collector:
49-
receivers:
50-
host_metrics:
51-
collection_interval: 1m0s
52-
initial_delay: 1s
53-
scrapers:
54-
cpu: {}
55-
memory: {}
56-
disk: {}
57-
network: {}
58-
filesystem: {}
59-
processors:
60-
batch: {}
61-
exporters:
62-
otlp_exporters:
63-
- server:
64-
host: <NGINX One Conosle Host>
65-
port: 443
66-
authenticator: headers_setter
67-
tls:
68-
skip_verify: false
69-
extensions:
70-
headers_setter:
71-
headers:
72-
- action: insert
73-
key: "authorization"
74-
value: "your-data-plane-key-here"
75-
```
76-
4. Restart the NGINX Agent service
77-
78-
```bash
79-
sudo systemctl restart nginx-agent
80-
```
81-
82-
## Running a Container to Connect to the NGINX One Console and Send Metrics
83-
84-
This guide provides step-by-step instructions on how to run a container to connect to the NGINX One Console and send metrics. Follow these steps to ensure proper setup and execution.
85-
86-
---
87-
88-
## Prerequisites
89-
Before running the container, ensure the following:
90-
1. **Docker Installed**: Docker must be installed on your system. You can download it from [Docker's official website](https://www.docker.com/).
91-
2. **NGINX One Console**: The NGINX One Console is set up and accessible.
92-
3. **Data Plane Token**: Obtain an access key or Data Plane token from the NGINX One Console for authentication.
93-
4. **Network Connectivity**: Verify that the container can reach the NGINX One Console endpoint.
94-
95-
---
96-
97-
## Steps to Run the Container
98-
99-
### Step 1: Pull the NGINX Metrics Agent Container Image
100-
The NGINX Metrics Agent container image must be downloaded from a trusted source such as Docker Hub or a private container registry.
101-
102-
Run the following command to pull the official image:
103-
```bash
104-
<!-- Registry HERE -->
105-
docker pull <Registry HERE>:latest
106-
```
107-
108-
Ensure you are using the correct image version. Replace `latest` with the desired version tag if necessary.
109-
110-
---
111-
112-
### Step 2: Create a Configuration File
113-
114-
1. Create a configuration file named `nginx-agent.conf` in your current directory.
115-
2. Populate the file with the following structure:
116-
117-
```vim
118-
command:
119-
server:
120-
host: "<NGINX-One-Console-URL>" # Command server host
121-
port: 443 # Command server port
122-
type: 0 # Server type (e.g., 0 for gRPC)
123-
auth:
124-
token: "<your-data-plane-key-here>" # Authentication token for the command server
125-
tls:
126-
skip_verify: false
127-
128-
collector:
129-
receivers:
130-
host_metrics:
131-
collection_interval: 1m0s
132-
initial_delay: 1s
133-
scrapers:
134-
cpu: {}
135-
memory: {}
136-
disk: {}
137-
network: {}
138-
filesystem: {}
139-
processors:
140-
batch: {}
141-
exporters:
142-
otlp_exporters:
143-
- server:
144-
host: <saas-host>
145-
port: 443
146-
authenticator: headers_setter
147-
tls:
148-
skip_verify: false
149-
extensions:
150-
headers_setter:
151-
headers:
152-
- action: insert
153-
key: "authorization"
154-
value: "your-data-plane-key-here"
155-
```
156-
157-
Replace the placeholder values:
158-
- `<NGINX-One-Console-URL>`: The URL of your NGINX One Console instance.
159-
- `<your-data-plane-key-here>`: Your Data Plane access token.
160-
161-
---
162-
163-
### Step 3: Run the Container
164-
Run the NGINX Agent container with the configuration file mounted.
165-
166-
Use the following command:
167-
```bash
168-
docker run -d \
169-
--name nginx-agent \
170-
-v $(pwd)/nginx-agent.conf:/etc/nginx-agent/nginx-agent.conf \
171-
nginx/agent:latest
172-
```
173-
174-
Key options explained:
175-
- `-d`: Runs the container in detached mode.
176-
- `--name nginx-agent`: Assigns a name to the container for easy identification.
177-
- `-v $(pwd)/nginx-agent.conf:/etc/nginx-agent/nginx-agent.conf`: Mounts the configuration file into the container.
178-
179-
---
180-
181-
### Step 4: Verify the Container is Running
182-
Check the running status of the container:
183-
```bash
184-
docker ps
185-
```
186-
187-
You should see an entry for `nginx-agent`. The `STATUS` field should indicate that the container is running.
188-
189-
---
190-
191-
### Step 5: Monitor Logs
192-
To ensure the container is functioning properly and communicating with NGINX One Console, monitor the container logs.
193-
194-
Run the following command:
195-
```bash
196-
docker logs -f nginx-agent
197-
```
198-
199-
Look for log entries indicating successful connection to the NGINX One Console and periodic metric transmission.
200-
201-
---
202-
203-
### Troubleshooting
204-
205-
1. **Container Fails to Start**:
206-
- Check the configuration file for errors.
207-
- Ensure the NGINX One Console endpoint is reachable from the host.
208-
209-
2. **No Metrics Sent**:
210-
- Verify the access token is valid.
211-
- Confirm network connectivity to the NGINX One Console.
212-
213-
3. **Logs Show Errors**:
214-
- Examine the logs for specific error messages.
215-
- Address any permission or network-related issues.
216-
217-
---
218-
219-
## Clean Up
220-
To stop and remove the container when it is no longer needed, run:
221-
```bash
222-
docker stop nginx-metrics-agent
223-
docker rm nginx-metrics-agent
224-
```
225-
226-
---
227-
228-
## Conclusion
229-
Following these instructions, you can successfully run a container to connect to the NGINX One Console and send metrics. For further details or issues, refer to the documentation provided by NGINX or your administrator.
32+
1. Open the file: ```/var/log/nginx-agent/opentelemetry-collector-agent.log```
33+
2. Look for the following logs:
34+
```vim
35+
Everything is ready. Begin running and processing data.
36+
```

content/agent/otel/metrics.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)