graphite_default_data

The `graphite_default_data` directive specifies default metrics to be collected and sent to a Graphite server for a given location or server context.

Syntaxgraphite_default_data data_template [data_params];
Defaultnone
Contexthttp, server
Arguments1-2

Description

The graphite_default_data directive allows users to define default metric templates and parameters that the NGINX Graphite module will use when reporting data to a Graphite server. This directive can accept one or two arguments. The first argument typically specifies a data template string that defines how the collected metrics should be named. For example, a template could be nginx.$server.$location, which would result in dynamically generated metric names based on the NGINX server and location contexts. The second optional argument allows for additional parameters to be appended to the metric name, enabling finer granularity in metrics reporting, such as different query parameters or context-specific information.

When this directive is included in either the http or server context, it affects all requests processed within that context. The data is aggregated, and the metrics are sent to the specified Graphite server at defined intervals. This flexibility makes it ideal for environments with multiple server blocks or locations where different metrics may be pertinent. The proper management of default data parameters ensures accurate and comprehensive reporting of metrics, allowing users to monitor performance and health effectively.

Config Example

http {
    graphite_default_data nginx.default;  
    server {
        location /api/ {
            graphite_default_data api.metrics;  
        }
    }
}

The directive cannot be specified in the location context; it must be used within http or server blocks.

Ensure that the data template defined in graphite_default_data corresponds correctly to the structure expected by the Graphite server.

← Back to all directives