CDPs PDPs RRAs RRDTools xff

RRA的配置格式如下 : 
RRA:AVERAGE | MIN | MAX | LAST:xff:steps:rows
压缩函数支持:  AVERAGE | MIN | MAX | LAST
steps表示把多少个采样点(Primary Data Point  PDP)压缩成一个压缩点(consolidated data point  CDP)
rows表示保留多少个压缩点.
xff表示一次压缩区间允许有多少比例的未知的PDP, 超过比例的话对应的CDP也称为未知.

截取自man rrdcreate
  RRA:CF:cf arguments
       The purpose of an RRD is to store data in the round robin archives (RRA). An archive consists of a number of
       data values or statistics for each of the defined data-sources (DS) and is defined with an RRA line.

       When data is entered into an RRD, it is first fit into time slots of the length defined with the -s option,
       thus becoming a primary data point.

       The data is also processed with the consolidation function (CF) of the archive. There are several consolidation
       functions that consolidate primary data points via an aggregate function: AVERAGE, MIN, MAX, LAST.

       AVERAGE
           the average of the data points is stored.

       MIN the smallest of the data points is stored.

       MAX the largest of the data points is stored.

       LAST
           the last data points is used.

       Note that data aggregation inevitably leads to loss of precision and information. The trick is to pick the
       aggregate function such that the interesting properties of your data is kept across the aggregation process.

       The format of RRA line for these consolidation functions is:

       RRA:AVERAGE | MIN | MAX | LAST:xff:steps:rows

       xff The xfiles factor defines what part of a consolidation interval may be made up from *UNKNOWN* data while
       the consolidated value is still regarded as known. It is given as the ratio of allowed *UNKNOWN* PDPs to the
       number of PDPs in the interval. Thus, it ranges from 0 to 1 (exclusive).

       steps defines how many of these primary data points are used to build a consolidated data point which then goes
       into the archive.

       rows defines how many generations of data values are kept in an RRA.  Obviously, this has to be greater than
       zero.

rrd-beginners的例子讲得比较清晰 : 
截取自man rrd-beginners
      rrdtool create target.rrd \
                --start 1023654125 \
                --step 300 \
                DS:mem:GAUGE:600:0:671744 \
                RRA:AVERAGE:0.5:12:24 \
                RRA:AVERAGE:0.5:288:31

       The next line declares a round robin archive (RRA). The syntax for declaring an RRA is

        RRA:CF:xff:step:rows

       RRA is the keyword to declare RRAs. The consolidation function (CF) can be AVERAGE, MINIMUM, MAXIMUM, and LAST.
       The concept of the consolidated data point (CDP) comes into the picture here. A CDP is CFed (averaged,
       maximum/minimum value or last value) from step number of PDPs. This RRA will hold rows CDPs.

       Lets have a look at the example above. For the first RRA, 12 (steps) PDPs (DS variables) are AVERAGEed (CF) to
       form one CDP. 24 (rows) of theses CDPs are archived. Each PDP occurs at 300 seconds. 12 PDPs represent 12 times
       300 seconds which is 1 hour. It means 1 CDP (which is equal to 12 PDPs) represents data worth 1 hour. 24 such
       CDPs represent 1 day (1 hour times 24 CDPs). This means, this RRA is an archive for one day. After 24 CDPs, CDP
       number 25 will replace the 1st CDP. The second RRA saves 31 CDPs; each CPD represents an AVERAGE value for a
       day (288 PDPs, each covering 300 seconds = 24 hours). Therefore this RRA is an archive for one month. A single
       database can have many RRAs. If there are multiple DSs, each individual RRA will save data for all the DSs in
       the database. For example, if a database has 3 DSs and daily, weekly, monthly, and yearly RRAs are declared,
       then each RRA will hold data from all 3 data sources.


[参考]
1. man rrd-beginners
2. man rrdcreate
一直对 rrdtool 在 create 时 RRA 中的 xff 参数的意义不是很清楚,今天 仔细研究了一下,做个总结。下面是 man rrdcreate 里的说明:
RRA:AVERAGE | MIN | MAX | LAST:xff:steps:rows
xff The xfiles factor defines what part of a consolidation interval may be made up from *UNKNOWN* data while the consolidated value is still regarded as known. It is given as the ratio of allowed *UNKNOWN* PDPs to the number of PDPs in the interval. Thus, it ranges from 0 to 1 (exclusive).
xff 决定在给定间隔中可以有多大比例的未知 PDP,超过这个比例则该间隔内的值 为 UNKNOWN,其取值范围为前闭后开区间,即: [0, 1) 。举两个极端的例子:
xff = 0 表示不能有未知 PDP
xff = 0.9 表示可以有 90% 的 未知PDP
下面是测试的程序(备忘)。
 1 #!/bin/sh
 2 
 3 LANG=C
 4 
 5 xff=0.5
 6 
 7 #t=$(date +%s)
 8 t=1480272727
 9 
10 echo $(date), $t
11 
12 rrdtool create test.rrd -b $(date +%s) --step 1 DS:temp:GAUGE:1:0:100 RRA:AVERAGE:${xff}:5:10
13 for i in `seq 1 20`; do
14     rrdtool update test.rrd ${t}:${i}
15     t=$((t + 1))
16 done
17 
18 rrdtool dump test.rrd
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值