http-vhost-traffic-status #

Nginx virtual host traffic status module

Source: upstream source

Directives

vhost_traffic_status #

syntax: vhost_traffic_status on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables the module working. If you set vhost_traffic_status_zone directive, is automatically enabled.

vhost_traffic_status_average_method #

syntax: vhost_traffic_status_average_method 1 arg;  ·  context: http, server, location

Description: Sets the method which is a formula that calculate the average of response processing times. The period is an effective time of the values used for the average calculation.(Default: 60s) If period set to 0, effective time is ignored. In this case, the last average value is displayed even if there is no requests and after the elapse of time.

vhost_traffic_status_bypass_limit #

syntax: vhost_traffic_status_bypass_limit on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables to bypass vhost_traffic_status_limit directives. The limit features is bypassed if this option is enabled. This is mostly useful if you want to connect the status web page like /status regardless of vhost_traffic_status_limit directives as follows:

vhost_traffic_status_bypass_stats #

syntax: vhost_traffic_status_bypass_stats on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables to bypass vhost_traffic_status. The traffic status stats features is bypassed if this option is enabled. In other words, it is excluded from the traffic status stats. This is mostly useful if you want to ignore your request in status web page like /status as follows:

vhost_traffic_status_display #

syntax: vhost_traffic_status_display no args;  ·  context: server, location

Description: Enables or disables the module display handler.

vhost_traffic_status_display_format #

syntax: vhost_traffic_status_display_format 1 arg (enum);  ·  context: server, location

Description: Sets the display handler's output format. If you set json, will respond with a JSON document. If you set html, will respond with the built-in live dashboard in HTML. If you set jsonp, will respond with a JSONP callback function(default: ngx_http_vhost_traffic_status_jsonp_callback). If you set prometheus, will respond with a prometheus document.

vhost_traffic_status_display_jsonp #

syntax: vhost_traffic_status_display_jsonp 1 arg (string);  ·  context: server, location

Description: Sets the callback name for the JSONP.

vhost_traffic_status_display_sum_key #

syntax: vhost_traffic_status_display_sum_key 1 arg (string);  ·  context: server, location

Description: Sets the sum key string in serverZones field's JSON. The default sum key string is the "*".

vhost_traffic_status_dump #

syntax: vhost_traffic_status_dump 1 arg;  ·  context: http

Description: Enables the statistics data dump and restore. The path is a location to dump the statistics data.(e.g. /var/log/nginx/vts.db) The period is a backup cycle time.(Default: 60s) It is backed up immediately regardless of the backup cycle if nginx is exited by signal(SIGKILL).

vhost_traffic_status_filter #

syntax: vhost_traffic_status_filter on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables the filter features.

vhost_traffic_status_filter_by_host #

syntax: vhost_traffic_status_filter_by_host on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables the keys by Host header field. If you set on and nginx's server_name directive set several or wildcard name starting with an asterisk, e.g. “*.example.org” and requested to server with hostname such as (a|b|c).example.org or *.example.org then json serverZones is printed as follows:

vhost_traffic_status_filter_by_set_key #

syntax: vhost_traffic_status_filter_by_set_key 1 arg;  ·  context: http, server, location

Description: Enables the keys by user defined variable. The key is a key string to calculate traffic. The name is a group string to calculate traffic. The key and name can contain variables such as $host, $server_name. The name's group belongs to filterZones if specified. The key's group belongs to serverZones if not specified second argument name.

vhost_traffic_status_filter_check_duplicate #

syntax: vhost_traffic_status_filter_check_duplicate on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables the deduplication of vhost_traffic_status_filter_by_set_key. It is processed only one of duplicate values(key + name) in each directives(http, server, location) if this option is enabled.

vhost_traffic_status_filter_max_node #

syntax: vhost_traffic_status_filter_max_node 1+ args;  ·  context: http

Description: Enables the limit of filter size using the specified number and string values. If the number is exceeded, the existing nodes are deleted by the LRU algorithm. The number argument is the size of the node that will be limited. The default value 0 does not limit filters. The one node is an object in filterZones in JSON document. For examples:

vhost_traffic_status_histogram_buckets #

syntax: vhost_traffic_status_histogram_buckets 1+ args;  ·  context: http, server, location

Description: Sets the observe buckets to be used in the histograms. By default, if you do not set this directive, it will not work. The second can be expressed in decimal places with a minimum value of 0.001(1ms). The maximum size of the buckets is 32. If this value is insufficient for you, For examples: by vhost_traffic_status_histogram_buckets directive.

vhost_traffic_status_ignore_status #

syntax: vhost_traffic_status_ignore_status 1+ args (bitmask);  ·  context: http, server, location

Bitmask — combine several keywords.

vhost_traffic_status_limit #

syntax: vhost_traffic_status_limit on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables the limit features.

vhost_traffic_status_limit_check_duplicate #

syntax: vhost_traffic_status_limit_check_duplicate on | off (on/off flag);  ·  context: http, server, location

Description: Enables or disables the deduplication of vhost_traffic_status_limit_by_set_key. It is processed only one of duplicate values(member | key + member) in each directives(http, server, location) if this option is enabled.

vhost_traffic_status_limit_traffic #

syntax: vhost_traffic_status_limit_traffic 1 arg;  ·  context: http, server, location

Description: Enables the traffic limit for specified member. The member is a member string to limit traffic. The size is a size(k/m/g) to limit traffic. The code is a code to return in response to rejected requests.(Default: 503) The available member strings are as follows:

vhost_traffic_status_limit_traffic_by_set_key #

syntax: vhost_traffic_status_limit_traffic_by_set_key 2 args;  ·  context: http, server, location

Description: Enables the traffic limit for specified key and member. The key is a key string to limit traffic. The member is a member string to limit traffic. The size is a size(k/m/g) to limit traffic. The code is a code to return in response to rejected requests.(Default: 503) The key syntax is as follows: The available group strings are as follows:

vhost_traffic_status_measure_status_codes #

syntax: vhost_traffic_status_measure_status_codes no args;  ·  context: http

Allows tracking of specific HTTP status codes or all status codes in the Vhost Traffic Status module.

vhost_traffic_status_set_by_filter #

syntax: vhost_traffic_status_set_by_filter 2 args;  ·  context: http, server, location, location-if

Description: Get the specified status value stored in shared memory. It can acquire almost all status values and the obtained value is stored in $variable which is first argument. Caveats: The name is case sensitive. All return values take the integer type. For examples:

vhost_traffic_status_stats_by_upstream #

syntax: vhost_traffic_status_stats_by_upstream on | off (on/off flag);  ·  context: http

Description: Enables or disables to stats upstreamZone. The upstreamZone in the traffic status stats features is bypassed if this option is disabled. In other words, it is excluded from the traffic status stats. This is mostly useful if you want to be disable statistics collection for upstream servers to reduce CPU load.

vhost_traffic_status_zone #

syntax: vhost_traffic_status_zone no args;  ·  context: http

Description: Sets parameters for a shared memory zone that will keep states for various keys. The cache is shared between all worker processes. In most cases, the shared memory size used by nginx-module-vts does not increase much. The shared memory size is increased pretty when using vhost_traffic_status_filter_by_set_key it does not continuously increase.

Example

http {
    vhost_traffic_status_zone;

    ...

    server {

        ...

        location /status {
            vhost_traffic_status_bypass_limit on;
            vhost_traffic_status_bypass_stats on;
            vhost_traffic_status_display;
            vhost_traffic_status_display_format html;
        }
    }
}

↑ back to index