Code

Imported upstream version 1.4.8
[pkg-rrdtool.git] / doc / rrdgraph_examples.txt
1 RRDGRAPH_EXAMPLES(1)                rrdtool               RRDGRAPH_EXAMPLES(1)
5 N\bNA\bAM\bME\bE
6        rrdgraph_examples - Examples for rrdtool graph
8 S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
9        r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh /\b/h\bho\bom\bme\be/\b/h\bht\btt\btp\bpd\bd/\b/h\bht\btm\bml\bl/\b/t\bte\bes\bst\bt.\b.p\bpn\bng\bg -\b--\b-i\bim\bmg\bg-\b-f\bfo\bor\brm\bma\bat\bt P\bPN\bNG\bG
11        followed by any of the examples below
13 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
14        For your convenience some of the commands are explained here by using
15        detailed examples. They are not always cut-and-paste ready because
16        comments are intermixed with the examples.
18 E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
19    D\bDa\bat\bta\ba w\bwi\bit\bth\bh m\bmu\bul\blt\bti\bip\bpl\ble\be r\bre\bes\bso\bol\blu\but\bti\bio\bon\bns\bs
20            --end now --start end-120000s --width 400
21            DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
22            DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
23            DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
24            LINE1:ds0a#0000FF:"default resolution\l"
25            LINE1:ds0b#00CCFF:"resolution 1800 seconds per interval\l"
26            LINE1:ds0c#FF00FF:"resolution 7200 seconds per interval\l"
28    N\bNi\bic\bce\bel\bly\by f\bfo\bor\brm\bma\bat\btt\bte\bed\bd l\ble\beg\bge\ben\bnd\bd s\bse\bec\bct\bti\bio\bon\bn
29            DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
30            DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
31            VDEF:ds0max=ds0,MAXIMUM
32            VDEF:ds0avg=ds0,AVERAGE
33            VDEF:ds0min=ds0,MINIMUM
34            VDEF:ds0pct=ds0,95,PERCENT
35            VDEF:ds1max=ds1,MAXIMUM
36            VDEF:ds1avg=ds1,AVERAGE
37            VDEF:ds1min=ds1,MINIMUM
38            VDEF:ds1pct=ds1,95,PERCENT
40        Note: consolidation occurs here.
42            CDEF:ds0bits=ds0,8,*
43            CDEF:ds1bits=ds1,8,*
45        Note: 10 spaces to move text to the right
47            COMMENT:"          "
49        Note: the column titles have to be as wide as the columns
51            COMMENT:"Maximum    "
52            COMMENT:"Average    "
53            COMMENT:"Minimum    "
55            COMMENT:"95th percentile\l"
56            AREA:ds0bits#00C000:"Inbound "
57            GPRINT:ds0max:"%6.2lf %Sbps"
58            GPRINT:ds0avg:"%6.2lf %Sbps"
59            GPRINT:ds0min:"%6.2lf %Sbps"
60            GPRINT:ds0pct:"%6.2lf %Sbps\l"
61            LINE1:ds1bits#0000FF:"Outbound"
62            GPRINT:ds1max:"%6.2lf %Sbps"
63            GPRINT:ds1avg:"%6.2lf %Sbps"
64            GPRINT:ds1min:"%6.2lf %Sbps"
65            GPRINT:ds1pct:"%6.2lf %Sbps\l"
67    O\bOf\bff\bfs\bse\bet\btt\bti\bin\bng\bg a\ba l\bli\bin\bne\be o\bon\bn t\bth\bhe\be y\by-\b-a\bax\bxi\bis\bs
68        Depending on your needs you can do this in two ways:
70        ·   Offset the data, then graph this
72                DEF:mydata=my.rrd:ds:AVERAGE
74            Note: this will also influence any other command that uses "data"
76                CDEF:data=mydata,100,+
77                LINE1:data#FF0000:"Data with offset"
79        ·   Graph the original data, with an offset
81                DEF:mydata=my.rrd:ds:AVERAGE
83            Note: no color in the first line so it is not visible
85                LINE1:100
87            Note: the second line gets stacked on top of the first one
89                LINE1:data#FF0000:"Data with offset":STACK
91    D\bDr\bra\baw\bwi\bin\bng\bg d\bda\bas\bsh\bhe\bed\bd l\bli\bin\bne\bes\bs
92        Also works for HRULE and VRULE
94        ·   default style: - - - - -
95                LINE1:data#FF0000:"dashed line":dashes
97        ·   more fancy style with offset: - -  --- -  --- -
98                LINE1:data#FF0000:"another dashed
99            line":dashes=15,5,5,10:dash-offset=10
101    T\bTi\bim\bme\be r\bra\ban\bng\bge\bes\bs
102            Last four weeks: --start end-4w --end 00:00
103            January 2001:    --start 20010101 --end start+31d
104            January 2001:    --start 20010101 --end 20010201
105            Last hour:       --start end-1h
106            Last 24 hours:   <nothing at all>
107            Yesterday:       --end 00:00
109    V\bVi\bie\bew\bwi\bin\bng\bg t\bth\bhe\be c\bcu\bur\brr\bre\ben\bnt\bt a\ban\bnd\bd p\bpr\bre\bev\bvi\bio\bou\bus\bs w\bwe\bee\bek\bk t\bto\bog\bge\bet\bth\bhe\ber\br
110            --end now --start end-1w
111            DEF:thisweek=router.rrd:ds0:AVERAGE
112            DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w
114        Shift the data forward by one week (604800 seconds)
116            SHIFT:lastweek:604800
117            [ more of the usual VDEF and CDEF stuff if you like ]
118            AREA:lastweek#0000FF:Last\ week
119            LINE1:thisweek#FF0000:This\ week
121    A\bAb\bbe\ber\brr\bra\ban\bnt\bt B\bBe\beh\bha\bav\bvi\bio\bou\bur\br D\bDe\bet\bte\bec\bct\bti\bio\bon\bn
122        If the specialized function R\bRR\bRA\bAs\bs exist for aberrant behavior detection,
123        they can be used to generate the graph of a time series with confidence
124        bands and failures.
126           rrdtool graph example.png \
127                  DEF:obs=monitor.rrd:ifOutOctets:AVERAGE \
128                  DEF:pred=monitor.rrd:ifOutOctets:HWPREDICT \
129                  DEF:dev=monitor.rrd:ifOutOctets:DEVPREDICT \
130                  DEF:fail=monitor.rrd:ifOutOctets:FAILURES \
131                  TICK:fail#ffffa0:1.0:"Failures\: Average bits out" \
132                  CDEF:scaledobs=obs,8,* \
133                  CDEF:upper=pred,dev,2,*,+ \
134                  CDEF:lower=pred,dev,2,*,- \
135                  CDEF:scaledupper=upper,8,* \
136                  CDEF:scaledlower=lower,8,* \
137                  LINE2:scaledobs#0000ff:"Average bits out" \
138                  LINE1:scaledupper#ff0000:"Upper Confidence Bound: Average bits out" \
139                  LINE1:scaledlower#ff0000:"Lower Confidence Bound: Average bits out"
141        This example generates a graph of the data series in blue (LINE2 with
142        the scaledobs virtual data source), confidence bounds in red
143        (scaledupper and scaledlower virtual data sources), and potential
144        failures (i.e. potential aberrant aberrant behavior) marked by vertical
145        yellow lines (the fail data source).
147        The raw data comes from an AVERAGE R\bRR\bRA\bA, the finest resolution of the
148        observed time series (one consolidated data point per primary data
149        point). The predicted (or smoothed) values are stored in the HWPREDICT
150        R\bRR\bRA\bA. The predicted deviations (think standard deviation) values are
151        stored in the DEVPREDICT R\bRR\bRA\bA. Finally, the FAILURES R\bRR\bRA\bA contains
152        indicators, with 1 denoting a potential failure.
154        All of the data is rescaled to bits (instead of Octets) by multiplying
155        by 8.  The confidence bounds are computed by an offset of 2 deviations
156        both above and below the predicted values (the CDEFs upper and lower).
157        Vertical lines indicated potential failures are graphed via the TICK
158        graph element, which converts non-zero values in an R\bRR\bRA\bA into tick
159        marks. Here an axis-fraction argument of 1.0 means the tick marks span
160        the entire y-axis, and hence become vertical lines on the graph.
162        The choice of 2 deviations (a scaling factor) matches the default used
163        internally by the FAILURES R\bRR\bRA\bA. If the internal value is changed (see
164        rrdtune), this graphing command should be changed to be consistent.
166        _\bA _\bn_\bo_\bt_\be _\bo_\bn _\bd_\ba_\bt_\ba _\br_\be_\bd_\bu_\bc_\bt_\bi_\bo_\bn_\b:
168        The r\brr\brd\bdt\bto\boo\bol\bl _\bg_\br_\ba_\bp_\bh command is designed to plot data at a specified
169        temporal resolution, regardless of the actually resolution of the data
170        in the RRD file.  This can present a problem for the specialized
171        consolidation functions which maintain a one-to-one mapping between
172        primary data points and consolidated data points. If a graph insists on
173        viewing the contents of these R\bRR\bRA\bAs\bs on a coarser temporal scale, the
174        _\bg_\br_\ba_\bp_\bh command tries to do something intelligent, but the confidence
175        bands and failures no longer have the same meaning and may be
176        misleading.
178 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
179        rrdgraph gives an overview of how r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh works.  rrdgraph_data
180        describes D\bDE\bEF\bF,C\bCD\bDE\bEF\bF and V\bVD\bDE\bEF\bF in detail.  rrdgraph_rpn describes the R\bRP\bPN\bN
181        language used in the x\bxD\bDE\bEF\bF statements.  rrdgraph_graph page describes
182        all the graph and print functions.
184 A\bAU\bUT\bTH\bHO\bOR\bR
185        Program by Tobias Oetiker <tobi@oetiker.ch>
187        This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
188        corrections and/or additions by several people
192 1.4.8                             2013-05-23              RRDGRAPH_EXAMPLES(1)