ITeye博客

rrdtutorial

standalone · 2013-02-06 17:01 · 开源软件 · Markdown

http://oss.oetiker.ch/rrdtool/tut/rrdtutorial.en.html

RRD: Round Robin Database.

RRDtool originated from MRTG (Multi Router Traffic Grapher). MRTG started as a tiny little script for graphing the use of a university's connection to the Internet.

Terminology:

Please read: http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=864861&page=1

DS: data source step: interval RRA: round robin archive

Data Types: COUNTER, GAUGE, DERIVE, ABSOLUTE

Example:


 rrdtool create all.rrd --start 978300900 \
            DS:a:COUNTER:600:U:U \
            DS:b:GAUGE:600:U:U \
            DS:c:DERIVE:600:U:U \
            DS:d:ABSOLUTE:600:U:U \
            RRA:AVERAGE:0.5:1:10
   rrdtool update all.rrd \
            978301200:300:1:600:300    \
            978301500:600:3:1200:600   \
            978301800:900:5:1800:900   \
            978302100:1200:3:2400:1200 \
            978302400:1500:1:2400:1500 \
            978302700:1800:2:1800:1800 \
            978303000:2100:4:0:2100    \
            978303300:2400:6:600:2400  \
            978303600:2700:4:600:2700  \
            978303900:3000:2:1200:3000
   rrdtool graph all1.png -s 978300600 -e 978304200 -h 400 \
            DEF:linea=all.rrd:a:AVERAGE LINE3:linea#FF0000:"Line A" \
            DEF:lineb=all.rrd:b:AVERAGE LINE3:lineb#00FF00:"Line B" \
            DEF:linec=all.rrd:c:AVERAGE LINE3:linec#0000FF:"Line C" \
            DEF:lined=all.rrd:d:AVERAGE LINE3:lined#000000:"Line D"

Line A is a COUNTER type, so it should continuously increment and RRDtool must calculate the differences. Also, RRDtool needs to divide the difference by the amount of time lapsed. This should end up as a straight line at 1 (the deltas are 300, the time is 300). Line B is of type GAUGE. These are "real" values so they should match what we put in: a sort of a wave. Line C is of type DERIVE. It should be a counter that can decrease. It does so between 2400 and 0, with 1800 in-between. Line D is of type ABSOLUTE. This is like counter but it works on values without calculating the difference. The numbers are the same and as you can see (hopefully) this has a different result.

This translates in the following values, starting at 23:10 and ending at 00:10 the next day (where "u" means unknown/unplotted):

  • Line A: u u 1 1 1 1 1 1 1 1 1 u
  • Line B: u 1 3 5 3 1 2 4 6 4 2 u
  • Line C: u u 2 2 2 0 -2 -6 2 0 2 u
  • Line D: u 1 2 3 4 5 6 7 8 9 10 u

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。