Skip to content

Commit e623629

Browse files
Add steps to enable NGINX Plus API and NGINX OSS stub_status for metrics reporting (#227)
* Add steps to enable NGINX Plus API and NGINX OSS stub_status for metrics reporting --------- Co-authored-by: Alan Dooley <a.dooley@f5.com>
1 parent 01c86c8 commit e623629

File tree

4 files changed

+103
-41
lines changed

4 files changed

+103
-41
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
docs:
3+
files:
4+
- content/nim/monitoring/overview-metrics.md
5+
- content/nginx-one/getting-started.md
6+
---
7+
8+
To collect basic metrics about server activity for NGINX Open Source, add the following to your NGINX configuration file:
9+
10+
```nginx
11+
server {
12+
listen 127.0.0.1:8080;
13+
location /api {
14+
stub_status;
15+
allow 127.0.0.1;
16+
deny all;
17+
}
18+
}
19+
```
20+
21+
This configuration:
22+
23+
- Enables the stub status API.
24+
- Allows requests only from `127.0.0.1` (localhost).
25+
- Blocks all other requests for security.
26+
27+
For more details, see the [NGINX Stub Status module documentation](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html).
28+
29+
After saving the changes, reload NGINX to apply the new configuration:
30+
31+
```shell
32+
nginx -s reload
33+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
docs:
3+
files:
4+
- content/nim/monitoring/overview-metrics.md
5+
- content/nginx-one/getting-started.md
6+
---
7+
8+
To collect comprehensive metrics for NGINX Plus--including bytes streamed, information about upstream systems and caches, and counts of all HTTP status codes--add the following to your NGINX Plus configuration file (for example, `/etc/nginx/nginx.conf` or an included file):
9+
10+
```nginx
11+
# Enable the /api/ location with appropriate access control
12+
# to use the NGINX Plus API.
13+
#
14+
location /api/ {
15+
api write=on;
16+
allow 127.0.0.1;
17+
deny all;
18+
}
19+
```
20+
21+
This configuration:
22+
23+
- Enables the NGINX Plus API.
24+
- Allows requests only from `127.0.0.1` (localhost).
25+
- Blocks all other requests for security.
26+
27+
For more details, see the [NGINX Plus API module documentation](https://nginx.org/en/docs/http/ngx_http_api_module.html).
28+
29+
After saving the changes, reload NGINX to apply the new configuration:
30+
31+
```shell
32+
nginx -s reload
33+
```

content/nginx-one/getting-started.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ To get started using NGINX One, enable the service on F5 Distributed Cloud.
1818
1. Select **Enable Service**.
1919
1. After the service has been enabled, select **Visit Service** to load the NGINX One console.
2020

21+
---
22+
2123
## Add your NGINX instances to NGINX One
2224

2325
Next, add your NGINX instances to NGINX One. You'll need to create a data plane key and then install the NGINX Agent on each instance you want to monitor.
@@ -130,6 +132,22 @@ If you followed the [Installation and upgrade](https://docs.nginx.com/nginx-agen
130132
131133
</span>
132134
135+
---
136+
137+
## Enable NGINX metrics reporting
138+
139+
In order for the NGINX One console to show specific traffic and system metrics, you need to enable the appropriate API on your NGINX data plane instances. The sections below provide step-by-step instructions for both NGINX Plus and NGINX Open Source (OSS).
140+
141+
### Enable NGINX Plus API
142+
143+
{{< include "/use-cases/monitoring/enable-nginx-plus-api.md" >}}
144+
145+
### Enable NGINX Open Source Stub Status API
146+
147+
{{< include "/use-cases/monitoring/enable-nginx-oss-stub-status.md" >}}
148+
149+
---
150+
133151
## View instance metrics with the NGINX One dashboard
134152
135153
After connecting your NGINX instances to NGINX One, you can monitor their performance and health. The NGINX One dashboard is designed for this purpose, offering an easy-to-use interface.

content/nim/monitoring/overview-metrics.md

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,37 @@ weight: 100
1212

1313
## Overview
1414

15-
The data that NGINX Instance Manager collects can be divided into two categories:
15+
F5 NGINX Instance Manager collects two types of data:
1616

17-
- **System metrics**: Data collected about the data plane system, such as CPU and memory usage.
18-
- **Traffic metrics**: Data related to processed traffic from sources such as NGINX OSS, NGINX Plus, or NGINX logs.
17+
- **System metrics**: Data about the data plane system, such as CPU and memory usage.
18+
- **Traffic metrics**: Data from processed traffic, including NGINX OSS, NGINX Plus, and NGINX logs.
1919

20-
Metrics are collected every 15 seconds and are published at 60-second intervals.
20+
The NGINX Agent collects metrics every 15 seconds and publishes them every 60 seconds.
2121

22-
For the full list of metrics, see the [Metrics Catalog Reference]({{< relref "/nms/reference/catalogs//metrics.md" >}})
22+
For a full list of available metrics, see the [Metrics Catalog Reference]({{< relref "/nms/reference/catalogs//metrics.md" >}}).
2323

24-
## Metrics Collection and Reporting Process
24+
## How metrics are collected and reported
2525

26-
While the NGINX Agent is running on the host, it collects metrics at regular 15-second intervals. Metrics then are downsampled and sent to the Manager server once per minute.
26+
The NGINX Agent collects metrics every 15 seconds while running on the host. Metrics are then downsampled and sent to the Manager server once per minute.
2727

28-
NGINX Instance Manager stores historical metrics data in an analytics database. Metrics are aggregated and rolled-up as follows:
28+
NGINX Instance Manager stores historical data in an analytics database and applies roll-ups:
2929

30-
- Data not older than 8 days are stored with best possible resolution (usually 1 min).
31-
- Data older than 8 days but not older than 30 days are stored with 5 min resolution.
32-
- Data older than 30 days but not older than 15 months are stored with 1 hour resolution.
33-
- Data older than 15 months are stored with 1 day resolution.
30+
- Data up to **8 days old** is stored with **1-minute resolution**.
31+
- Data **8 to 30 days old** is stored with **5-minute resolution**.
32+
- Data **30 days to 15 months old** is stored with **1-hour resolution**.
33+
- Data older than **15 months** is stored with **1-day resolution**.
3434

35-
### F5 NGINX Plus Metrics
35+
### F5 NGINX Plus metrics
3636

37-
Enable the NGINX Plus API to collect NGINX Plus metrics by uncommenting the `/api/` location section in `/etc/nginx/conf.d/default.conf`:
37+
{{< include "/use-cases/monitoring/enable-nginx-plus-api.md" >}}
3838

39-
```nginx {hl_lines=[4]}
40-
# enable /api/ location with appropriate access control in order
41-
# to make use of NGINX Plus API
42-
#
43-
location /api/ {
44-
api write=on;
45-
allow 127.0.0.1;
46-
deny all;
47-
}
48-
```
49-
50-
### NGINX OSS Metrics
51-
52-
Enable NGINX Stub Status API to collect NGINX metrics in NGINX OSS. A sample Stub Status API configuration is shown below:
39+
### NGINX Open Source metrics
5340

54-
```nginx
55-
server {
56-
listen 127.0.0.1:8080;
57-
location /api {
58-
stub_status;
59-
allow 127.0.0.1;
60-
deny all;
61-
}
62-
}
63-
```
41+
{{< include "/use-cases/monitoring/enable-nginx-oss-stub-status.md" >}}
6442

65-
### NGINX Access Log Metrics
43+
### NGINX access log metrics
6644

67-
Enable NGINX Access Logging to collect metrics from parsing access logs. A sample Access Log format is shown below:
45+
Enable access logging to collect traffic metrics by parsing logs. Use the following log format:
6846

6947
```nginx
7048
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
@@ -78,4 +56,4 @@ access_log /var/log/nginx/access.log main;
7856

7957
## Troubleshooting
8058

81-
System metrics are collected by the NGINX Agent without requiring the user to perform any additional setup. Additional setup is required to enable collection of NGINX related metrics.
59+
System metrics are collected automatically by the NGINX Agent. To collect NGINX-specific metrics, additional configuration is required.

0 commit comments

Comments
 (0)