注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

PostgreSQL research

公益是一辈子的事, I'm 德哥@Digoal, Just Do it!

 
 
 

日志

 
 

CDPs PDPs RRAs RRDTools xff  

2014-09-11 10:21:31|  分类: NOC |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
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

Flag Counter
  评论这张
 
阅读(303)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016