我正在监视300多台服务器,为此我使用Ganglia。其中使用RRD
作为数据库来收集和存储与各服务器资源相关的数据。我希望有大约2年或更长时间的历史,因此阅读本文,我认为我的RRA
配置应该是:
RRAs "RRA:AVERAGE:0.5:1:17520"
17520 =(365天[年]× 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"
#
这是我的思维方式,还是我遗漏了什么?
在研究了一段时间之后,我想到了一个答案,也许将来会对某人有所帮助。这两篇文章我读了很多遍,我推荐它们。先读这个,创建一个初始RRD,然后再读这个。如何创建RRDTool数据库:
我尽量简单地解释一下。格式RRA:CF:xff:steps:rows
:
RRA: Round Robin Archive
CF: Consolidation Factor
XFF: Xfile Factor
steps
rows
对我来说最大的问题是发现steps
和rows
的正确值。看完后,我想出了这样的解释:
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
请记住,我们的step
是300 seconds
,所以这个想法很简单:如果我想解析具有86400 seconds
的one day
,如第一个示例所示,我需要多少行?答案是288 rows
。为什么?
`86400 seconds [1 day] / 300 seconds [5 minutes`] = 288 rows
另一个例子,如果我想解析:
1周[ = 604800 seconds ]
in 15分钟[ = 900 seconds ]
= 604800/900 = 672 rows
其他值也是如此。这样你就能知道你需要多少rows
。计算你需要多少steps
很简单,你只需要把你的步数乘起来。
让我解释一下:我们的steps
是300 seconds
,对吗?
所以如果我们想要解析5分钟[ = 300 seconds ]
,我们只需要乘以1,对吧?所以,15分钟等于300秒× 3, 1小时等于300 × 12, 6小时等于300 × 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
好吧,我希望这能帮助到一些人,就这样。