nginx-module-vts
Nginx virtual host traffic status module
What is nginx-module-vts?
Nginx virtual host traffic status module
Overview of nginx-module-vts
What it is
nginx-module-vts is an open-source Nginx module that provides virtual host traffic status information. It exposes current status data for servers, upstreams, and caches, similar to the live activity monitoring available in Nginx Plus. The module can output data in JSON, HTML, JSONP, or Prometheus format, and includes a built-in HTML dashboard. It is licensed under BSD-2-Clause and is categorized under Monitoring.
Key features
- Provides real-time traffic statistics per virtual host, including request count, bytes in/out, and response status code breakdowns (1xx–5xx, cache hit/miss, etc.).
- Supports filtering traffic by custom keys (e.g., country, user agent, storage volume) via the
vhost_traffic_status_filterdirective. - Allows traffic limiting per server, filter, or upstream using
vhost_traffic_status_limitand related directives. - Offers on-the-fly control to reset or delete traffic zones through a query string endpoint (
/status/control). - Exports data in multiple formats: JSON, HTML (built-in dashboard), JSONP, and Prometheus.
- Includes histogram buckets for request latency distribution and supports average method configuration.
- Can be built with Profile-Guided Optimization (PGO) using gcc
-fprofileoptions.
Use cases
- Monitoring traffic for individual virtual hosts on an Nginx server.
- Calculating traffic per country using GeoIP data.
- Tracking traffic per storage volume or per user agent.
- Detailed HTTP status code analysis (e.g., counting 4xx/5xx per server).
- Dynamic DNS traffic accounting.
- Excluding status page traffic from statistics.
- Maintaining persistent statistics data across Nginx reloads or restarts using the dump feature.
Getting started
- Clone the repository:
shell> git clone git://github.com/vozlt/nginx-module-vts.git2. Add the module to the Nginx build configuration:--add-module=/path/to/nginx-module-vts3. Build and install the Nginx binary.4. In the Nginx configuration, enable the module withvhost_traffic_status_zone;in thehttpblock, and set up a location for the status display:location /status { vhost_traffic_status_display; vhost_traffic_status_display_format html;}
License and pricing
The license is BSD-2-Clause. The module is open source and free to use.
Based on the project's public README and repository metadata.