关于图:默认使Graphite UI数据累积

Making Graphite UI data cumualtive by default

我正在设置Graphite,当像素不足时,屏幕上的数据表示方式出现了问题。

我发现这则帖子的第一个答案与我要寻找的答案非常接近:

No what is probably happening is that you're looking at a graph with more datapoints than pixels, which forces Graphite to aggregate the datapoints. The default aggregation method is averaging, but you can change it to summing by applying the cumulative() function to your metrics.

默认情况下是否有任何方法可以获取此cumulative()行为?

我已经修改了storage-aggregation.conf以使用'aggregationMethod = sum',但是我相信这是用于历史数据,而不是用于UI中显示的数据。

当我应用cumulative()时,一切都是完美的,我只是想知道是否有一种方法可以默认实现此行为。


我猜想,即使您已经修改了storage-aggregation.conf以使用\\'aggregationMethod = sum \\',但是您已经创建的指标并未更改其AggregationMethod。 storage-aggregation.conf中的规则仅影响新指标。

要更改现有指标以求和而不是求平均值,您需要使用whisper-resize.py。或者,您可以删除现有指标,并使用sum重新创建它们。

以下是您可能需要运行的示例:

1
whisper-resize.py --xFilesFactor=0.0 --aggregationMethod=sum /opt/graphite/storage/whisper/stats_counts/path/to/your/metric.wsp 10s:28d 1m:84d 10m:1y 1h:3y

确保以拥有文件的同一用户身份运行该文件,或者至少确保完成后这些文件具有相同的所有权,否则它们将无法被新数据写入。

如果您使用的是statsd,则另一种可能性是您仅使用stats下的指标,而不是stats_counts。从statsd README:

In the legacy setting rates were recorded under stats.counter_name
directly, whereas the absolute count could be found under
stats_count.counter_name. With disabling the legacy namespacing those
values can be found (with default prefixing) under
stats.counters.counter_name.rate and stats.counters.counter_name.count
now.

基本上,在使用statsd时,度量标准在不同名称空间下的聚合方式不同,并且您需要将stats_count或stats.counters下的内容相加。