|
1 | 1 | --- |
2 | | -title: Metrics Export |
| 2 | +title: Exporting Metrics with NGINX Agent |
3 | 3 | weight: 200 |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | ## Overview |
7 | 7 |
|
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: |
9 | 9 |
|
10 | 10 | * Metrics from NGINX Plus and NGINX OSS |
11 | 11 | * Host metrics (CPU, memory, disk, and network activity) from VMs or Containers |
12 | | - |
13 | 12 |
|
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. |
15 | 14 |
|
16 | | -# Key Benefits |
| 15 | +### Key Benefits |
17 | 16 |
|
18 | 17 | * Seamless Integration: No need to deploy an external OpenTelemetry Collector. All components are embedded within the Agent for streamlined observability. |
19 | 18 | * Standardized Protocol: Support for OpenTelemetry standards ensures interoperability with a wide range of observability backends, including Jaeger, Prometheus, Splunk, and more. |
20 | 19 |
|
21 | | -## Before you begin |
| 20 | +### Verify Metrics Exported |
22 | 21 |
|
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: |
24 | 23 |
|
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** |
28 | 25 |
|
| 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. |
29 | 27 |
|
30 | | -## Configure the OTel Collector - Virtual Machine |
| 28 | +**Agent Logs** |
31 | 29 |
|
32 | | -1. Locate the configuration file for the F5 NGINX Agent: |
| 30 | +Check the OpenTelemetry Collector logs for confirmation of successful metric processing: |
33 | 31 |
|
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 | + ``` |
0 commit comments