Skip to content

Commit 01e4438

Browse files
authored
Merge pull request #1755 from fluent/lynettemiles/sc-136188/update-fluent-bit-docs-pipeline-inputs-nginx
2 parents 1727167 + 55a4005 commit 01e4438

File tree

3 files changed

+31
-139
lines changed

3 files changed

+31
-139
lines changed

pipeline/inputs/nginx.md

Lines changed: 29 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# NGINX Exporter Metrics
1+
# NGINX Exporter metrics
22

3-
_NGINX Exporter Metrics_ input plugin scrapes metrics from the NGINX stub status handler.
3+
The _NGINX Exporter metrics_ input plugin scrapes metrics from the NGINX stub status handler.
44

5-
## Configuration Parameters
5+
## Configuration parameters
66

77
The plugin supports the following configuration parameters:
88

99
| Key | Description | Default |
1010
| :--- | :--- | :--- |
11-
| Host | Name of the target host or IP address to check. | 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` |
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` |
1616

17-
## Getting Started
17+
## Get started
1818

1919
NGINX must be configured with a location that invokes the stub status handler. Here is an example configuration with such a location:
2020

21-
```
21+
```text
2222
server {
2323
listen 80;
2424
listen [::]:80;
@@ -39,7 +39,7 @@ server {
3939
Another metrics API is available with NGINX Plus. You must first configure a path in
4040
NGINX Plus.
4141

42-
```
42+
```text
4343
server {
4444
listen 80;
4545
listen [::]:80;
@@ -57,27 +57,26 @@ server {
5757
}
5858
```
5959

60-
### Command Line
60+
### Command line
6161

6262
From the command line you can let Fluent Bit generate the checks with the following options:
6363

6464
```bash
65-
$ fluent-bit -i nginx_metrics -p host=127.0.0.1 -p port=80 -p status_url=/status -p nginx_plus=off -o stdout
65+
fluent-bit -i nginx_metrics -p host=127.0.0.1 -p port=80 -p status_url=/status -p nginx_plus=off -o stdout
6666
```
6767

68-
To gather metrics from the command line with the NGINX Plus REST API we need to turn on the
69-
nginx_plus property, like so:
68+
To gather metrics from the command line with the NGINX Plus REST API you need to turn on the
69+
`nginx_plus` property:
7070

7171
```bash
72-
$ fluent-bit -i nginx_metrics -p host=127.0.0.1 -p port=80 -p nginx_plus=on -p status_url=/api -o stdout
72+
fluent-bit -i nginx_metrics -p host=127.0.0.1 -p port=80 -p nginx_plus=on -p status_url=/api -o stdout
7373
```
7474

75-
7675
### Configuration File
7776

78-
In your main configuration file append the following _Input_ & _Output_ sections:
77+
In your main configuration file append the following `Input` and `Output` sections:
7978

80-
```ini
79+
```python
8180
[INPUT]
8281
Name nginx_metrics
8382
Host 127.0.0.1
@@ -92,8 +91,7 @@ In your main configuration file append the following _Input_ & _Output_ sections
9291

9392
And for NGINX Plus API:
9493

95-
```ini
96-
[INPUT]
94+
```python
9795
Name nginx_metrics
9896
Nginx_Plus on
9997
Host 127.0.0.1
@@ -105,14 +103,17 @@ And for NGINX Plus API:
105103
Match *
106104
```
107105

106+
## Test your configuration
108107

108+
You can test against the NGINX server running on localhost by invoking it directly from the command line:
109109

110-
## Testing
110+
```bash
111+
fluent-bit -i nginx_metrics -p host=127.0.0.1 -p nginx_plus=off -o stdout -p match=* -f 1
112+
```
111113

112-
You can quickly test against the NGINX server running on localhost by invoking it directly from the command line:
114+
Which should return something like the following:
113115

114-
```bash
115-
$ fluent-bit -i nginx_metrics -p host=127.0.0.1 -p nginx_plus=off -o stdout -p match=* -f 1
116+
```text
116117
Fluent Bit v2.x.x
117118
* Copyright (C) 2019-2020 The Fluent Bit Authors
118119
* Copyright (C) 2015-2018 Treasure Data
@@ -129,117 +130,6 @@ Fluent Bit v2.x.x
129130
2021-10-14T19:37:35.229919621Z nginx_up = 1
130131
```
131132

132-
## Exported Metrics
133-
134-
This documentation is copied from the
135-
[NGINX Prometheus Exporter metrics documentation](https://github.com/nginxinc/nginx-prometheus-exporter/blob/main/README.md)
136-
on GitHub.
137-
138-
### Common metrics:
139-
Name | Type | Description | Labels
140-
----|----|----|----|
141-
`nginx_up` | Gauge | Shows the status of the last metric scrape: `1` for a successful scrape and `0` for a failed one | [] |
142-
143-
### Metrics for NGINX OSS:
144-
#### [Stub status metrics](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html)
145-
Name | Type | Description | Labels
146-
----|----|----|----|
147-
`nginx_connections_accepted` | Counter | Accepted client connections. | [] |
148-
`nginx_connections_active` | Gauge | Active client connections. | [] |
149-
`nginx_connections_handled` | Counter | Handled client connections. | [] |
150-
`nginx_connections_reading` | Gauge | Connections where NGINX is reading the request header. | [] |
151-
`nginx_connections_waiting` | Gauge | Idle client connections. | [] |
152-
`nginx_connections_writing` | Gauge | Connections where NGINX is writing the response back to the client. | [] |
153-
`nginx_http_requests_total` | Counter | Total http requests. | [] |
154-
155-
### Metrics for NGINX Plus:
156-
#### [Connections](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_connections)
157-
Name | Type | Description | Labels
158-
----|----|----|----|
159-
`nginxplus_connections_accepted` | Counter | Accepted client connections | [] |
160-
`nginxplus_connections_active` | Gauge | Active client connections | [] |
161-
`nginxplus_connections_dropped` | Counter | Dropped client connections dropped | [] |
162-
`nginxplus_connections_idle` | Gauge | Idle client connections | [] |
163-
164-
#### [HTTP](https://nginx.org/en/docs/http/ngx_http_api_module.html#http_)
165-
Name | Type | Description | Labels
166-
----|----|----|----|
167-
`nginxplus_http_requests_total` | Counter | Total http requests | [] |
168-
`nginxplus_http_requests_current` | Gauge | Current http requests | [] |
169-
170-
#### [SSL](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_ssl_object)
171-
Name | Type | Description | Labels
172-
----|----|----|----|
173-
`nginxplus_ssl_handshakes` | Counter | Successful SSL handshakes | [] |
174-
`nginxplus_ssl_handshakes_failed` | Counter | Failed SSL handshakes | [] |
175-
`nginxplus_ssl_session_reuses` | Counter | Session reuses during SSL handshake | [] |
176-
177-
#### [HTTP Server Zones](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_http_server_zone)
178-
Name | Type | Description | Labels
179-
----|----|----|----|
180-
`nginxplus_server_zone_processing` | Gauge | Client requests that are currently being processed | `server_zone` |
181-
`nginxplus_server_zone_requests` | Counter | Total client requests | `server_zone` |
182-
`nginxplus_server_zone_responses` | Counter | Total responses sent to clients | `code` (the response status code. The values are: `1xx`, `2xx`, `3xx`, `4xx` and `5xx`), `server_zone` |
183-
`nginxplus_server_zone_discarded` | Counter | Requests completed without sending a response | `server_zone` |
184-
`nginxplus_server_zone_received` | Counter | Bytes received from clients | `server_zone` |
185-
`nginxplus_server_zone_sent` | Counter | Bytes sent to clients | `server_zone` |
186-
187-
#### [Stream Server Zones](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_stream_server_zone)
188-
Name | Type | Description | Labels
189-
----|----|----|----|
190-
`nginxplus_stream_server_zone_processing` | Gauge | Client connections that are currently being processed | `server_zone` |
191-
`nginxplus_stream_server_zone_connections` | Counter | Total connections | `server_zone` |
192-
`nginxplus_stream_server_zone_sessions` | Counter | Total sessions completed | `code` (the response status code. The values are: `2xx`, `4xx`, and `5xx`), `server_zone` |
193-
`nginxplus_stream_server_zone_discarded` | Counter | Connections completed without creating a session | `server_zone` |
194-
`nginxplus_stream_server_zone_received` | Counter | Bytes received from clients | `server_zone` |
195-
`nginxplus_stream_server_zone_sent` | Counter | Bytes sent to clients | `server_zone` |
196-
197-
#### [HTTP Upstreams](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_http_upstream)
198-
199-
> Note: for the `state` metric, the string values are converted to float64 using the following rule: `"up"` = `1.0`, `"draining"` = `2.0`, `"down"` = `3.0`, `"unavail"` = `4.0`, `"checking"` = `5.0`, `"unhealthy"` = `6.0`.
200-
201-
Name | Type | Description | Labels
202-
----|----|----|----|
203-
`nginxplus_upstream_server_state` | Gauge | Current state | `server`, `upstream` |
204-
`nginxplus_upstream_server_active` | Gauge | Active connections | `server`, `upstream` |
205-
`nginxplus_upstream_server_limit` | Gauge | Limit for connections which corresponds to the max_conns parameter of the upstream server. Zero value means there is no limit | `server`, `upstream` |
206-
`nginxplus_upstream_server_requests` | Counter | Total client requests | `server`, `upstream` |
207-
`nginxplus_upstream_server_responses` | Counter | Total responses sent to clients | `code` (the response status code. The values are: `1xx`, `2xx`, `3xx`, `4xx` and `5xx`), `server`, `upstream` |
208-
`nginxplus_upstream_server_sent` | Counter | Bytes sent to this server | `server`, `upstream` |
209-
`nginxplus_upstream_server_received` | Counter | Bytes received to this server | `server`, `upstream` |
210-
`nginxplus_upstream_server_fails` | Counter | Number of unsuccessful attempts to communicate with the server | `server`, `upstream` |
211-
`nginxplus_upstream_server_unavail` | Counter | How many times the server became unavailable for client requests (state 'unavail') due to the number of unsuccessful attempts reaching the max_fails threshold | `server`, `upstream` |
212-
`nginxplus_upstream_server_header_time` | Gauge | Average time to get the response header from the server | `server`, `upstream` |
213-
`nginxplus_upstream_server_response_time` | Gauge | Average time to get the full response from the server | `server`, `upstream` |
214-
`nginxplus_upstream_keepalives` | Gauge | Idle keepalive connections | `upstream` |
215-
`nginxplus_upstream_zombies` | Gauge | Servers removed from the group but still processing active client requests | `upstream` |
216-
217-
#### [Stream Upstreams](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_stream_upstream)
218-
219-
> Note: for the `state` metric, the string values are converted to float64 using the
220-
> following rule: `"up"` = `1.0`, `"down"` = `3.0`, `"unavail"` = `4.0`,
221-
> `"checking"` = `5.0`, `"unhealthy"` = `6.0`.
222-
223-
Name | Type | Description | Labels
224-
----|----|----|----|
225-
`nginxplus_stream_upstream_server_state` | Gauge | Current state | `server`, `upstream` |
226-
`nginxplus_stream_upstream_server_active` | Gauge | Active connections | `server` , `upstream` |
227-
`nginxplus_stream_upstream_server_limit` | Gauge | Limit for connections which corresponds to the max_conns parameter of the upstream server. Zero value means there is no limit | `server` , `upstream` |
228-
`nginxplus_stream_upstream_server_connections` | Counter | Total number of client connections forwarded to this server | `server`, `upstream` |
229-
`nginxplus_stream_upstream_server_connect_time` | Gauge | Average time to connect to the upstream server | `server`, `upstream`
230-
`nginxplus_stream_upstream_server_first_byte_time` | Gauge | Average time to receive the first byte of data | `server`, `upstream` |
231-
`nginxplus_stream_upstream_server_response_time` | Gauge | Average time to receive the last byte of data | `server`, `upstream` |
232-
`nginxplus_stream_upstream_server_sent` | Counter | Bytes sent to this server | `server`, `upstream` |
233-
`nginxplus_stream_upstream_server_received` | Counter | Bytes received from this server | `server`, `upstream` |
234-
`nginxplus_stream_upstream_server_fails` | Counter | Number of unsuccessful attempts to communicate with the server | `server`, `upstream` |
235-
`nginxplus_stream_upstream_server_unavail` | Counter | How many times the server became unavailable for client connections (state 'unavail') due to the number of unsuccessful attempts reaching the max_fails threshold | `server`, `upstream` |
236-
`nginxplus_stream_upstream_zombies` | Gauge | Servers removed from the group but still processing active client connections | `upstream`|
237-
238-
#### [Location Zones](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_http_location_zone)
239-
Name | Type | Description | Labels
240-
----|----|----|----|
241-
`nginxplus_location_zone_requests` | Counter | Total client requests | `location_zone` |
242-
`nginxplus_location_zone_responses` | Counter | Total responses sent to clients | `code` (the response status code. The values are: `1xx`, `2xx`, `3xx`, `4xx` and `5xx`), `location_zone` |
243-
`nginxplus_location_zone_discarded` | Counter | Requests completed without sending a response | `location_zone` |
244-
`nginxplus_location_zone_received` | Counter | Bytes received from clients | `location_zone` |
245-
`nginxplus_location_zone_sent` | Counter | Bytes sent to clients | `location_zone` |
133+
## Exported metrics
134+
135+
For a list of available metrics, see the [NGINX Prometheus Exporter metrics documentation](https://github.com/nginxinc/nginx-prometheus-exporter/blob/main/README.md) on GitHub.

vale-styles/FluentBit/Acronyms.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ exceptions:
5454
- LTS
5555
- MQTT
5656
- NET
57+
- NGINX
5758
- NOTE
5859
- NVDA
5960
- OSS

vale-styles/FluentBit/Spelling-exceptions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ namespace
115115
namespaces
116116
netcat
117117
Nginx
118+
NGINX
118119
OAuth
119120
Okta
120121
Oniguruma

0 commit comments

Comments
 (0)