Code Monkey home page Code Monkey logo

nginx_request_exporter's Introduction

Nginx Request Exporter for Prometheus

This is a Prometheus exporter for Nginx requests.

In contrast to existing exporters nginx_request_exporter does not scrape the stub status module 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 available in Nginx can be used. Currently nginx_request_exporter has to be restarted when the log format is changed.

nginx_request_exporter's People

Contributors

markuslindenberg avatar bbrown avatar boriseveoh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.