Getting statistics from http_stub_status
Nginx base distribution contains a simple module that provides access to several rather basic but useful counters inside Nginx that are very important to monitor on a regular basis. The module is named ngx_http_stub_status
, and we will describe how to use it in monitoring.
This module is not compiled by default. To check if your Nginx distribution is compiled with the stub_status
module, you can use this command:
$ nginx -V 2>&1 | fgrep -c http_stub_status_module 1 $
If you see 1
, then this module is compiled and linked to your Nginx binary. Otherwise, you need to compile it using --with-http_stub_status_module
parameter to configure
script that is invoked during Nginx compilation.
Once you have this module available, you can use its directives (actually, there is only one) in nginx.conf
. This is an example of stub-status
sharing:
location /stub-status { stub_status; }
This module belongs to the family of the so-called content-generating modules...