Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markuslindenberg/nginx_request_exporter
Nginx Request Exporter for Prometheus
https://github.com/markuslindenberg/nginx_request_exporter
Last synced: 1 day ago
JSON representation
Nginx Request Exporter for Prometheus
- Host: GitHub
- URL: https://github.com/markuslindenberg/nginx_request_exporter
- Owner: markuslindenberg
- License: apache-2.0
- Created: 2016-05-10T20:13:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-16T11:05:42.000Z (about 7 years ago)
- Last Synced: 2024-06-20T16:48:58.378Z (6 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 57
- Watchers: 6
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nginx Request Exporter for Prometheus
This is a [Prometheus](https://prometheus.io/) exporter for [Nginx](http://nginx.org/) requests.
In contrast to existing exporters nginx_request_exporter does *not* scrape the [stub status module](http://nginx.org/en/docs/http/ngx_http_stub_status_module.html) for server status but records statistics for HTTP requests.
By default nginx_request_exporter listens on port 9147 for HTTP requests.
## Installation
### Using `go get`
```
go get github.com/markuslindenberg/nginx_request_exporter
```### Using Docker
```
docker pull markuslindenberg/nginx_request_exporter
docker run --rm -p 9147:9147 -p 9514:9514/udp markuslindenberg/nginx_request_exporter
```## Configuration
nginx_request_exporter consumes access log records using the syslog protocol. Nginx needs to be configured to log to nginx_request_exporter's syslog port. To enable syslog logging add a `access_log` statement to your Nginx configuration:
```
access_log syslog:server=127.0.0.1:9514 prometheus;
```## Log format
nginx_request_exporter uses a custom log format that needs to be defined in the `http` context.
The format has to only include key/value pairs:
* A key/value pair delimited by a colon denotes a metric name&value
* A key/value pair delimited by a equal sign denotes a label name&value that is added to all metrics.Example:
```
log_format prometheus 'time:$request_time status=$status host="$host" method="$request_method" upstream="$upstream_addr"';```
Multiple metrics can be recorded and all [variables](http://nginx.org/en/docs/varindex.html) available in Nginx can be used.
Currently nginx_request_exporter has to be restarted when the log format is changed.