graphite_data
The `graphite_data` directive configures NGINX to collect and send aggregated metrics about requests to a specified Graphite backend.
Description
The graphite_data directive is integral to the Graphite NGINX module, allowing users to define custom metrics that are aggregated and sent to a Graphite server. By using this directive within an NGINX configuration block (either at the http, server, or location context), administrators can specify a unique metric name that will be recorded and reported. The directive's arguments can include a combination of metric names and parameters that fine-tune what stats are collected, how they are aggregated, and when they are sent.
When graphite_data is invoked, it creates a data stream associated with the defined metric at the specified NGINX context. This metric is then updated in real-time with traffic data such as request counts, response times, and other defined parameters. The parameters are parsed and utilized to format the metric name as defined in the graphite_config, allowing for structured and consistent reporting to the Graphite server. Data is typically aggregated and sent at specified intervals (60 seconds by default). This feature is particularly useful for real-time monitoring and performance tracking of NGINX-hosted applications by sending metrics in a non-blocking manner, ensuring minimal performance impact on the web server itself.
Config Example
http {
graphite_config prefix=playground server=127.0.0.1;
server {
location /foo/ {
graphite_data nginx.foo;
}
}
}Ensure that the Graphite server is correctly configured and reachable from NGINX.
Check that the prefix and metric naming format in graphite_config matches the expected input for your Graphite back-end.
Remember that specifying too many metrics might lead to performance degradation due to memory and processing overhead.