Nginx virtual host traffic status module
Nginx virtual host traffic status module
Table of Contents
- Version
- Test
- Dependencies
- Compatibility
- Screenshots
- Installation
- Synopsis
- Description
- Calculations and Intervals
- Control
- Set
- JSON
- Variables
- Limit
- Use cases
- To calculate traffic for individual country using GeoIP
- To calculate traffic for individual storage volume
- To calculate traffic for individual user agent
- To calculate traffic for detailed http status code
- To calculate traffic for dynamic dns
- To calculate traffic except for status page
- To maintain statistics data permanently
- Customizing
- React Dashboard
- Directives
- vhost_traffic_status
- vhost_traffic_status_zone
- vhost_traffic_status_dump
- vhost_traffic_status_display
- vhost_traffic_status_display_format
- vhost_traffic_status_display_jsonp
- vhost_traffic_status_display_sum_key
- vhost_traffic_status_filter
- vhost_traffic_status_filter_by_host
- vhost_traffic_status_filter_by_set_key
- vhost_traffic_status_filter_check_duplicate
- vhost_traffic_status_filter_max_node
- vhost_traffic_status_limit
- vhost_traffic_status_limit_traffic
- vhost_traffic_status_limit_traffic_by_set_key
- vhost_traffic_status_limit_check_duplicate
- vhost_traffic_status_set_by_filter
- vhost_traffic_status_average_method
- vhost_traffic_status_histogram_buckets
- vhost_traffic_status_bypass_limit
- vhost_traffic_status_bypass_stats
- vhost_traffic_status_stats_by_upstream
- Releases
- See Also
- TODO
- Author
Version
See the GitHub Releases for the latest tagged release.
Test
Run sudo prove -r t after you have installed this module. The sudo is required because
the test requires Nginx to listen on port 80.
Dependencies
Compatibility
- Nginx
- 1.30.x (last tested: 1.30.4)
- 1.27.x (last tested: 1.27.3)
- 1.22.x (last tested: 1.22.0)
- 1.19.x (last tested: 1.19.6)
- 1.18.x (last tested: 1.18.0)
- 1.16.x (last tested: 1.15.1)
- 1.15.x (last tested: 1.15.0)
- 1.14.x (last tested: 1.14.0)
- 1.13.x (last tested: 1.13.12)
- 1.12.x (last tested: 1.12.2)
- 1.11.x (last tested: 1.11.10)
- 1.10.x (last tested: 1.10.3)
- 1.8.x (last tested: 1.8.0)
- 1.6.x (last tested: 1.6.3)
- 1.4.x (last tested: 1.4.7)
Earlier versions is not tested.
Screenshots


Installation
- Clone the git repository.
shell> git clone git://github.com/vozlt/nginx-module-vts.git
Add the module to the build configuration by adding
--add-module=/path/to/nginx-module-vtsBuild the nginx binary.
Install the nginx binary.
Installtion with Profile-Guided Optimization
It can be built with Profile-Guided Optimization (PGO) using gcc fprofile options. The detail of the PGO mechanisms has refer to the section 7.4 of this paper.
Here is an example of the process to make a PGO supported binary. Please use at your own risk.
- Compile with fprofile-generate.
shell> pwd
/somewhere/nginx
shell> CC=gcc ./auto/configure --with-cc-opt='-fprofile-generate -fprofile-dir=./objs' --with-ld-opt='-lgcov' --add-module=/somewhere/nginx-module-vts
shell> make
- Execute this module tests.
shell> pwd
/somewhere/nginx-module-vts
shell> sudo PATH=/somewhere/nginx/objs:$PATH prove -r t/000.display_html.t
...(during runtime it records coverage data into .gcda files)
- Recompile with fprofile-use
shell> pwd
/somewhere/nginx
shell> CC=gcc ./auto/configure --with-cc-opt='-fprofile-use -fprofile-dir=/somewhere/nginx-module-vts/objs' --with-ld-opt='-lgcov' --add-module=/somewhere/nginx-module-vts
shell> make
Synopsis
http {
vhost_traffic_status_zone;
...
server {
...
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
}
}
}
Description
This is an Nginx module that provides access to virtual host status information. It contains the current status such as servers, upstreams, caches. This is similar to the live activity monitoring of nginx plus. The built-in html is also taken from the demo page of old version.
First of all, the directive vhost_traffic_status_zone is required,
and then if the directive vhost_traffic_status_display is set, can be access to as follows:
- /status/format/json
- If you request
/status/format/json, will respond with a JSON document containing the current activity data for using in live dashboards and third-party monitoring tools.
- If you request
- /status/format/html
- If you request
/status/format/html, will respond with the built-in live dashboard in HTML that requests internally to/status/format/json.
- If you request
- /status/format/jsonp
- If you request
/status/format/jsonp, will respond with a JSONP callback function containing the current activity data for using in live dashboards and third-party monitoring tools.
- If you request
- /status/format/prometheus
- If you request
/status/format/prometheus, will respond with a prometheus document containing the current activity data.
- If you request
- /status/control
- If you request
/status/control, will respond with a J
- If you request