2020-08-12 04:10:41 +08:00
|
|
|
# Nginx Input Plugin
|
2016-02-29 04:38:46 +08:00
|
|
|
|
2022-06-09 05:22:56 +08:00
|
|
|
This plugin gathers basic status from the open source web server Nginx. Nginx
|
|
|
|
|
Plus is a commercial version. For more information about the differences between
|
|
|
|
|
Nginx (F/OSS) and Nginx Plus, see the Nginx [documentation][diff-doc].
|
|
|
|
|
|
|
|
|
|
[diff-doc]: https://www.nginx.com/blog/whats-difference-nginx-foss-nginx-plus/
|
|
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
## Configuration
|
2016-02-29 04:38:46 +08:00
|
|
|
|
2022-05-24 21:49:47 +08:00
|
|
|
```toml @sample.conf
|
2016-02-29 04:38:46 +08:00
|
|
|
# Read Nginx's basic status information (ngx_http_stub_status_module)
|
|
|
|
|
[[inputs.nginx]]
|
|
|
|
|
## An array of Nginx stub_status URI to gather stats.
|
|
|
|
|
urls = ["http://localhost/server_status"]
|
2017-06-08 08:52:10 +08:00
|
|
|
|
2018-05-05 07:33:23 +08:00
|
|
|
## Optional TLS Config
|
|
|
|
|
# tls_ca = "/etc/telegraf/ca.pem"
|
|
|
|
|
# tls_cert = "/etc/telegraf/cert.pem"
|
|
|
|
|
# tls_key = "/etc/telegraf/key.pem"
|
|
|
|
|
## Use TLS but skip chain & host verification
|
2017-06-08 08:52:10 +08:00
|
|
|
# insecure_skip_verify = false
|
|
|
|
|
|
|
|
|
|
## HTTP response timeout (default: 5s)
|
|
|
|
|
response_timeout = "5s"
|
2016-02-29 04:38:46 +08:00
|
|
|
```
|
|
|
|
|
|
2023-02-09 18:04:41 +08:00
|
|
|
## Metrics
|
2016-02-29 04:38:46 +08:00
|
|
|
|
2016-02-29 04:41:16 +08:00
|
|
|
- Measurement
|
2021-11-25 02:50:01 +08:00
|
|
|
- accepts
|
|
|
|
|
- active
|
|
|
|
|
- handled
|
|
|
|
|
- reading
|
|
|
|
|
- requests
|
|
|
|
|
- waiting
|
|
|
|
|
- writing
|
2016-02-29 04:38:46 +08:00
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
## Tags
|
2016-02-29 04:38:46 +08:00
|
|
|
|
|
|
|
|
- All measurements have the following tags:
|
2021-11-25 02:50:01 +08:00
|
|
|
- port
|
|
|
|
|
- server
|
2016-02-29 04:38:46 +08:00
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
## Example Output
|
2016-02-29 04:38:46 +08:00
|
|
|
|
|
|
|
|
Using this configuration:
|
2021-11-25 02:50:01 +08:00
|
|
|
|
2020-08-11 03:50:48 +08:00
|
|
|
```toml
|
2016-02-29 04:38:46 +08:00
|
|
|
[[inputs.nginx]]
|
|
|
|
|
## An array of Nginx stub_status URI to gather stats.
|
|
|
|
|
urls = ["http://localhost/status"]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
When run with:
|
2021-11-25 02:50:01 +08:00
|
|
|
|
2020-08-11 03:50:48 +08:00
|
|
|
```sh
|
2017-05-13 06:22:29 +08:00
|
|
|
./telegraf --config telegraf.conf --input-filter nginx --test
|
2016-02-29 04:38:46 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
It produces:
|
2021-11-25 02:50:01 +08:00
|
|
|
|
2023-04-04 19:43:49 +08:00
|
|
|
```text
|
|
|
|
|
nginx,port=80,server=localhost accepts=605i,active=2i,handled=605i,reading=0i,requests=12132i,waiting=1i,writing=1i 1456690994701784331
|
2016-02-29 04:38:46 +08:00
|
|
|
```
|