Metric plugins - mackerel-plugin-nginx

mackerel-plugin-nginx is a plugin to visualize nginx status based on nginx's stub_status.

Metrics you can monitor

Nginx Connections

Metric Display Name Metric Name Diff Stacked Description
Active connections custom.nginx.connections.connections Number of current connections from clients including Waiting status

Nginx requests

Metric Display Name Metric Name Diff Stacked Description
Accepted connections custom.nginx.requests.accepts Total number of client connections accepted
Handled connections custom.nginx.requests.handled Total number of client connections processed
Handled requests custom.nginx.requests.requests Total number of client requests

Nginx connection status

Metric Display Name Metric Name Diff Stacked Description
Reading custom.nginx.queue.reading Number of current connections reading request headers
Writing custom.nginx.queue.writing Number of current connections writing responses back to the client
Waiting custom.nginx.queue.waiting Number of current idle client connections waiting for requests

Options that can be specified

The options that can be specified for the plugin are as follows.

Option Environment Variables Description Default
-uri URI of the connection destination
-scheme HTTP scheme for connection (http or https) http
-host hostname of the connection destination localhost
-port port of the connection destination 8080
-path path where stab_status is provided /nginx_status
-tempfile path to save temporary files
-header Additional headers to be given when connecting (-header is required for each if more than one is specified)

Example configuration for an agent

To monitor nginx serving stub_status as /stub_status on port 8081 on the localhost, configure as follows.

[plugin.metrics.nginx]
command = ["/path/to/mackerel-plugin-nginx","--port","8081","--path","/stab_status"]

In the above configuration, you can verify the operation by executing the following:

$ mackerel-plugin-nginx --port 8081 --path /stab_status

Repository

https://github.com/mackerelio/mackerel-agent-plugins/tree/master/mackerel-plugin-nginx

Reference

See the description of the ngx_http_stub_status_module below for details on how to configure stub_status to be enabled and each variable referenced by the plugin.

Module ngx_http_stub_status_module