如何设置RRD存储2年?

时间:2013-04-02 21:09:05

标签: database linux rrdtool rrd ganglia

我正在监控超过300台服务器,因为我正在使用Ganglia。 其中使用RRD作为数据库来收集和存储与每个服务器的资源相关的数据。 我希望有2年或更长的历史记录,所以请阅读article,我认为我的RRA配置应该是:

RRAs "RRA:AVERAGE:0.5:1:17520"

17520 =(365天[年] x 2)* 24 [小时]

这是Ganglia默认配置,今天正在运行:

#
# Round-Robin Archives
# You can specify custom Round-Robin archives here (defaults are listed below)
#
# RRAs "RRA:AVERAGE:0.5:1:244" "RRA:AVERAGE:0.5:24:244" "RRA:AVERAGE:0.5:168:244" "RRA:AVERAGE:0.5:672:244" \
#      "RRA:AVERAGE:0.5:5760:374"
#

这是我的思维方式还是我错过了什么?

1 个答案:

答案 0 :(得分:21)

在研究了这个主题一段时间之后,我想出了一个可能在将来帮助某人的答案。我多次阅读这两篇文章,我建议这样做。 首先阅读本文,Creating an initial RRD然后阅读本文。 How to create an RRDTool database

我会尽力解释一下。格式RRA:CF:xff:steps:rows

RRA: Round Robin Archive
CF: Consolidation Factor
XFF: Xfile Factor
steps
rows

对我来说,最大的问题是发现stepsrows的正确价值。 看完后,我想出了这个解释:

1 day - 5-minute resolution
1 week - 15-minute resolution
1 month - 1-hour resolution
1 year - 6-hour resolution

RRA:AVERAGE:0.5:1:288 \
RRA:AVERAGE:0.5:3:672 \
RRA:AVERAGE:0.5:12:744 \
RRA:AVERAGE:0.5:72:1480

请注意,我们的step300 seconds,因此这个想法非常简单: 如果我想要解析one day 86400 seconds,如第一个示例所示,我需要多少行?答案是288 rows。为什么?

`86400 seconds [1 day] / 300 seconds [5 minutes`] = 288 rows

另一个例子,如果我想解决:
在15分钟内[ = 604800 seconds ] = 604800/900 = [ = 900 seconds ]

1周672 rows

所以继续其他的价值观。这样您就可以了解需要多少rows。 找出你需要多少steps非常简单,你只需要采取步骤的倍数。

让我解释一下:我们的steps300 seconds,对吧?

因此,如果我们要解决5分钟[ = 300 seconds ],我们只需要乘以1,对吧? 所以,15分钟意味着300秒x 3,1小时意味着300 x 12,6小时意味着300 x 72,依此类推。

在我的具体案例中,我希望steps成为30 seconds,所以我想出了这些结构:

1   every time           30 seconds      1 * 30s = 30s
2   every second time     1 minute       2 * 30s = 1m
4   every third time      2 minutes      4 * 30s = 2m
10  every 10th time       5 minutes     10 * 30s = 5m
20  every 20th time      10 minutes     20 * 30s = 10m
60  every 60th time      30 minutes     60 * 30s = 30m
80  every 80th time      40 minutes     80 * 30s = 40m
100 every 100th time     50 minutes    100 * 30s = 50m
120 every 120th time      1 hour       120 * 30s = 1h
240 every 240th time      2 hours      240 * 30s = 2h
360 every 360th time      3 hours      360 * 30s = 3h

RRA:AVERAGE:0.5:1:120 \
RRA:AVERAGE:0.5:2:120 \
RRA:AVERAGE:0.5:4:120 \
RRA:AVERAGE:0.5:10:288 \
RRA:AVERAGE:0.5:20:1008 \
RRA:AVERAGE:0.5:60:1440 \
RRA:AVERAGE:0.5:80:3240 \
RRA:AVERAGE:0.5:100:5184 \
RRA:AVERAGE:0.5:120:8760 \
RRA:AVERAGE:0.5:240:8760 \
RRA:AVERAGE:0.5:360:8760 \

这意味着:

1 hour    -  30 seconds  resolution
2 hours   -  1 minute    resolution
4 hours   -  2 minutes   resolution
1 day     -  5 minutes   resolution
1 week    - 10 minutes   resolution
1 month   - 30 minutes   resolution
3 months  - 40 minutes   resolution
6 months  - 50 minutes   resolution
1 year    -  1 hour      resolution
2 year    -  2 hour      resolution
3 year    -  3 hour      resolution

嗯,我希望这有助于某人,就是这样。