Skip to content

Commit ef0fa03

Browse files
authored
in_nginx: update NGINX exporter metrics documentation (#2286)
- Add missing scrape_interval parameter (default: 5s) - Add TLS/SSL configuration section - Add info hint about metrics pipeline separation - Alphabetize and lowercase config parameter names - Fix NGINX config comment syntax (// → #) - Standardize indentation to 2 spaces in .conf examples - Minor style improvements for consistency with other input docs Signed-off-by: Eric D. Schabell <eric@schabell.org>
1 parent e254c1b commit ef0fa03

File tree

1 file changed

+47
-33
lines changed

1 file changed

+47
-33
lines changed

pipeline/inputs/nginx.md

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,32 @@
22

33
The _NGINX exporter metrics_ input plugin scrapes metrics from the NGINX stub status handler.
44

5+
{% hint style="info" %}
6+
7+
Metrics collected with NGINX Exporter Metrics flow through a separate pipeline from logs, and current filters don't operate on top of metrics.
8+
9+
{% endhint %}
10+
511
## Configuration parameters
612

713
The plugin supports the following configuration parameters:
814

9-
| Key | Description | Default |
10-
|:-------------|:--------------------------------------------------------------------------------------------------------|:------------|
11-
| `Host` | Name of the target host or IP address. | `localhost` |
12-
| `Port` | Port of the target Nginx service to connect to. | `80` |
13-
| `Status_URL` | The URL of the stub status Handler. | `/status` |
14-
| `Nginx_Plus` | Turn on NGINX plus mode. | `true` |
15-
| `Threaded` | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). | `false` |
15+
| Key | Description | Default |
16+
|:------------------|:--------------------------------------------------------------------------------------------------------|:------------|
17+
| `host` | Name of the target host or IP address. | `localhost` |
18+
| `nginx_plus` | Turn on NGINX Plus mode. | `true` |
19+
| `port` | Port of the target NGINX service to connect to. | `80` |
20+
| `scrape_interval` | The interval to scrape metrics from the NGINX service. | `5s` |
21+
| `status_url` | The URL of the stub status handler. | `/status` |
22+
| `threaded` | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). | `false` |
23+
24+
### TLS / SSL
25+
26+
The NGINX exporter metrics input plugin supports TLS/SSL. For more details about the properties available and general configuration, refer to [Transport Security](../../administration/transport-security.md).
1627

1728
## Get started
1829

19-
NGINX must be configured with a location that invokes the stub status handler. Here is an example configuration with such a location:
30+
NGINX must be configured with a location that invokes the stub status handler. The following is an example configuration with such a location:
2031

2132
```text
2233
server {
@@ -27,7 +38,7 @@ server {
2738
root /usr/share/nginx/html;
2839
index index.html index.htm;
2940
}
30-
// configure the stub status handler.
41+
# Configure the stub status handler.
3142
location /status {
3243
stub_status;
3344
}
@@ -44,12 +55,11 @@ server {
4455
listen [::]:80;
4556
server_name localhost;
4657
47-
# enable /api/ location with appropriate access control in order
48-
# to make use of NGINX Plus API
49-
#
58+
# Enable /api/ location with appropriate access control in order
59+
# to make use of NGINX Plus API.
5060
location /api/ {
5161
api write=on;
52-
# configure to allow requests from the server running fluent-bit
62+
# Configure to allow requests from the server running Fluent Bit.
5363
allow 192.168.1.*;
5464
deny all;
5565
}
@@ -64,7 +74,7 @@ From the command line you can let Fluent Bit generate the checks with the follow
6474
fluent-bit -i nginx_metrics -p host=127.0.0.1 -p port=80 -p status_url=/status -p nginx_plus=off -o stdout
6575
```
6676

67-
To gather metrics from the command line with the NGINX Plus REST API you need to turn on the
77+
To gather metrics from the command line with the NGINX Plus REST API, turn on the
6878
`nginx_plus` property:
6979

7080
```shell
@@ -82,10 +92,11 @@ In your main configuration file append the following:
8292
pipeline:
8393
inputs:
8494
- name: nginx_metrics
85-
nginx_plus: off
8695
host: 127.0.0.1
8796
port: 80
88-
status_URL: /status
97+
status_url: /status
98+
nginx_plus: off
99+
scrape_interval: 5s
89100

90101
outputs:
91102
- name: stdout
@@ -97,15 +108,16 @@ pipeline:
97108
98109
```text
99110
[INPUT]
100-
Name nginx_metrics
101-
Nginx_Plus off
102-
Host 127.0.0.1
103-
Port 80
104-
Status_URL /status
111+
Name nginx_metrics
112+
Host 127.0.0.1
113+
Port 80
114+
Status_URL /status
115+
Nginx_Plus off
116+
Scrape_Interval 5s
105117

106118
[OUTPUT]
107-
Name stdout
108-
Match *
119+
Name stdout
120+
Match *
109121
```
110122

111123
{% endtab %}
@@ -120,10 +132,11 @@ And for NGINX Plus API:
120132
pipeline:
121133
inputs:
122134
- name: nginx_metrics
123-
nginx_plus: on
124135
host: 127.0.0.1
125136
port: 80
126-
status_URL: /api
137+
status_url: /api
138+
nginx_plus: on
139+
scrape_interval: 5s
127140

128141
outputs:
129142
- name: stdout
@@ -135,15 +148,16 @@ pipeline:
135148
136149
```text
137150
[INPUT]
138-
Name nginx_metrics
139-
Nginx_Plus on
140-
Host 127.0.0.1
141-
Port 80
142-
Status_URL /api
151+
Name nginx_metrics
152+
Host 127.0.0.1
153+
Port 80
154+
Status_URL /api
155+
Nginx_Plus on
156+
Scrape_Interval 5s
143157

144158
[OUTPUT]
145-
Name stdout
146-
Match *
159+
Name stdout
160+
Match *
147161
```
148162

149163
{% endtab %}
@@ -157,7 +171,7 @@ You can test against the NGINX server running on localhost by invoking it direct
157171
fluent-bit -i nginx_metrics -p host=127.0.0.1 -p nginx_plus=off -o stdout -p match=* -f 1
158172
```
159173

160-
Which should return something like the following:
174+
This returns output similar to the following:
161175

162176
```text
163177
...

0 commit comments

Comments
 (0)