GraphiteMergeTree
You can use any ClickHouse table engine to store the Graphite data if you do not need rollup, but if you need a rollup use . The engine reduces the volume of storage and increases the efficiency of queries from Graphite.
The engine inherits properties from MergeTree.
See a detailed description of the query.
A table for the Graphite data should have the following columns for the following data:
Metric name (Graphite sensor). Data type:
String
.Value of the metric. Data type: any numeric.
The names of these columns should be set in the rollup configuration.
GraphiteMergeTree parameters
config_section
— Name of the section in the configuration file, where are the rules of rollup set.
Query clauses
When creating a GraphiteMergeTree
table, the same clauses are required, as when creating a MergeTree
table.
Deprecated Method for Creating a Table
Attention
Do not use this method in new projects and, if possible, switch the old projects to the method described above.
config_section
— Name of the section in the configuration file, where are the rules of rollup set.
Rollup Configuration
The settings for rollup are defined by the graphite_rollup parameter in the server configuration. The name of the parameter could be any. You can create several configurations and use them for different tables.
Rollup configuration structure:
path_column_name
— The name of the column storing the metric name (Graphite sensor). Default value:Path
.time_column_name
— The name of the column storing the time of measuring the metric. Default value:Time
.version_column_name
— The name of the column storing the version of the metric. Default value:Timestamp
.
Structure of the patterns
section:
Attention
Patterns must be strictly ordered:
- Patterns without
function
orretention
. - Patterns with both
function
andretention
. - Pattern
default
.
When processing a row, ClickHouse checks the rules in the pattern
sections. Each of pattern
(including ) sections can contain function
parameter for aggregation, retention
parameters or both. If the metric name matches the regexp
, the rules from the pattern
section (or sections) are applied; otherwise, the rules from the default
section are used.
Fields for pattern
and default
sections:
regexp
– A pattern for the metric name.age
– The minimum age of the data in seconds.function
– The name of the aggregating function to apply to data whose age falls within the range[age, age + precision]
. Accepted functions: min / max / any / avg. The average is calculated imprecisely, like the average of the averages.
Data rollup is performed during merges. Usually, for old partitions, merges are not started, so for rollup it is necessary to trigger an unscheduled merge using . Or use additional tools, for example graphite-ch-optimizer.