server_traffic_status
The `server_traffic_status` directive enables monitoring of traffic statistics for a stream server in NGINX.
Description
The server_traffic_status directive in the NGINX stream server traffic status core module allows administrators to enable or disable the collection of traffic statistics for a particular stream server. By setting this directive to 'on', the server will track various traffic-related metrics, such as the number of connections and the volume of data sent and received.
When enabled, the directive actively aggregates data from the specified stream server and makes it available for status monitoring. This helps administrators visualize the traffic patterns and overall performance of their stream servers, based on real-time statistics. The collected data can be queried and displayed in a variety of formats, aiding in troubleshooting and performance tuning. It is essential to include this directive in the context of a stream block or a specific stream server block to function correctly.
The directive supports a simple flag argument, which can either be 'on' or 'off', indicating whether traffic status tracking is active. This flexibility allows for easy configuration depending on the monitoring needs at any given time.
Config Example
stream {
server {
listen 12345;
server_traffic_status on;
...
}
}Ensure the directive is placed within a stream or stream server context; it will not work in the http context.
If the directive is set to 'on', ensure that you have configured the corresponding status zone with stream_server_traffic_status_zone in the appropriate context.
When enabling this directive, be aware of potential performance implications due to increased resource usage for tracking statistics.