NGINX exporter metrics

The NGINX exporter metrics input plugin scrapes metrics from the NGINX stub status handler.

Configuration parameters

The plugin supports the following configuration parameters:

Key
Description
Default

Host

Name of the target host or IP address.

localhost

Port

Port of the target Nginx service to connect to.

80

Status_URL

The URL of the stub status Handler.

/status

Nginx_Plus

Turn on NGINX plus mode.

true

Threaded

Indicates whether to run this input in its own thread.

false

Get started

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

server {
  listen       80;
  listen  [::]:80;
  server_name  localhost;
  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
  }
  // configure the stub status handler.
  location /status {
    stub_status;
  }
}

Configuration with NGINX Plus REST API

Another metrics API is available with NGINX Plus. You must first configure a path in NGINX Plus.

Command line

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

To gather metrics from the command line with the NGINX Plus REST API you need to turn on the nginx_plus property:

Configuration file

In your main configuration file append the following:

And for NGINX Plus API:

Test your configuration

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

Which should return something like the following:

Exported metrics

For a list of available metrics, see the NGINX Prometheus Exporter metrics documentation on GitHub.

Last updated

Was this helpful?