Skip to content

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 NameMetric NameDiffStackedDescription
Active connectionscustom.nginx.connections.connectionsNumber of current connections from clients including Waiting status

Nginx requests

Metric Display NameMetric NameDiffStackedDescription
Accepted connectionscustom.nginx.requests.acceptsTotal number of client connections accepted
Handled connectionscustom.nginx.requests.handledTotal number of client connections processed
Handled requestscustom.nginx.requests.requestsTotal number of client requests

Nginx connection status

Metric Display NameMetric NameDiffStackedDescription
Readingcustom.nginx.queue.readingNumber of current connections reading request headers
Writingcustom.nginx.queue.writingNumber of current connections writing responses back to the client
Waitingcustom.nginx.queue.waitingNumber 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.

OptionEnvironment VariablesDescriptionDefault
-uriURI of the connection destination
-schemeHTTP scheme for connection (http or https)http
-hosthostname of the connection destinationlocalhost
-portport of the connection destination8080
-pathpath where stab_status is provided/nginx_status
-tempfilepath to save temporary files
-headerAdditional 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.

toml
[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