stream_server_traffic_status_display_format
The `stream_server_traffic_status_display_format` directive sets the response format for displaying traffic status in NGINX stream servers.
Description
The stream_server_traffic_status_display_format directive is part of the NGINX stream server traffic status module, which provides statistics about traffic handled by stream servers. This directive allows the user to specify the format of the response returned when querying the traffic status. The formats available typically include JSON and HTML. When this directive is set at the server or location level, it will dictate how metrics are displayed, facilitating monitoring health checks for load balancers and other TCP/UDP services.
The directive has a single argument that defines the output format. When a request is made to the traffic status endpoint, NGINX retrieves traffic metrics from shared memory and formats them according to the specified argument. The system checks the URI and ensures that it is a valid GET request before processing it further. If the format specified is not recognized or an error occurs while fetching statistics, an appropriate error response is sent back to the client.
Proper implementation of this directive enhances observability for administrators, allowing them to quickly ascertain the load and performance of their stream servers. Adjustments to the output format can help integrate this data into various monitoring frameworks or visualization tools, making it a flexible option for managing NGINX deployments effectively.
Config Example
server {
listen 12345;
stream_server_traffic_status on;
stream_server_traffic_status_display_format json;
}Ensure that you set the correct format string; common formats include 'json' and 'html'.
Remember that if the traffic status module is not included during NGINX compilation, this directive will not work.
Check for the proper context; this directive should be used only in the server or location blocks.