Code

ff3567dc4eedc6c0f06467a65c41b6588d1073c5
[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 com-
16        ments 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
21            --end now --start end-120000s --width 400
22            DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
23            DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
24            DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
25            LINE1:ds0a#0000FF:"default resolution\l"
26            LINE1:ds0b#00CCFF:"resolution 1800 seconds per interval\l"
27            LINE1:ds0c#FF00FF:"resolution 7200 seconds per interval\l"
29        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
31            DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
32            DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
33            VDEF:ds0max=ds0,MAXIMUM
34            VDEF:ds0avg=ds0,AVERAGE
35            VDEF:ds0min=ds0,MINIMUM
36            VDEF:ds0pct=ds0,95,PERCENT
37            VDEF:ds1max=ds1,MAXIMUM
38            VDEF:ds1avg=ds1,AVERAGE
39            VDEF:ds1min=ds1,MINIMUM
40            VDEF:ds1pct=ds1,95,PERCENT
42        Note: consolidation occurs here.
44            CDEF:ds0bits=ds0,8,*
45            CDEF:ds1bits=ds1,8,*
47        Note: 10 spaces to move text to the right
49            COMMENT:"          "
51        Note: the column titles have to be as wide as the columns
53            COMMENT:"Maximum    "
54            COMMENT:"Average    "
55            COMMENT:"Minimum    "
57            COMMENT:"95th percentile\l"
58            AREA:ds0bits#00C000:"Inbound "
59            GPRINT:ds0max:"%6.2lf %Sbps"
60            GPRINT:ds0avg:"%6.2lf %Sbps"
61            GPRINT:ds0min:"%6.2lf %Sbps"
62            GPRINT:ds0pct:"%6.2lf %Sbps\l"
63            LINE1:ds1bits#0000FF:"Outbound"
64            GPRINT:ds1max:"%6.2lf %Sbps"
65            GPRINT:ds1avg:"%6.2lf %Sbps"
66            GPRINT:ds1min:"%6.2lf %Sbps"
67            GPRINT:ds1pct:"%6.2lf %Sbps\l"
69        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
71        Depending on your needs you can do this in two ways:
73        ·   Offset the data, then graph this
75                DEF:mydata=my.rrd:ds:AVERAGE
77            Note: this will also influence any other command that uses "data"
79                CDEF:data=mydata,100,+
80                LINE1:data#FF0000:"Data with offset"
82        ·   Graph the original data, with an offset
84                DEF:mydata=my.rrd:ds:AVERAGE
86            Note: no color in the first line so it is not visible
88                LINE1:100
90            Note: the second line gets stacked on top of the first one
92                LINE1:data#FF0000:"Data with offset":STACK
94        D\bDr\bra\baw\bwi\bin\bng\bg d\bda\bas\bsh\bhe\bed\bd l\bli\bin\bne\bes\bs
96        Also works for HRULE and VRULE
98        ·   default style: - - - - -
99                LINE1:data#FF0000:"dashed line":dashes
101        ·   more fancy style with offset: - -  --- -  --- -
102                LINE1:data#FF0000:"another dashed
103            line":dashes=15,5,5,10:dash-offset=10
105        T\bTi\bim\bme\be r\bra\ban\bng\bge\bes\bs
107            Last four weeks: --start end-4w --end 00:00
108            January 2001:    --start 20010101 --end start+31d
109            January 2001:    --start 20010101 --end 20010201
110            Last hour:       --start end-1h
111            Last 24 hours:   <nothing at all>
112            Yesterday:       --end 00:00
114        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
116            --end now --start end-1w
117            DEF:thisweek=router.rrd:ds0:AVERAGE
118            DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w
120        Shift the data forward by one week (604800 seconds)
122            SHIFT:lastweek:604800
123            [ more of the usual VDEF and CDEF stuff if you like ]
124            AREA:lastweek#0000FF:Last\ week
125            LINE1:thisweek#FF0000:This\ week
127        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
129        If the specialized function R\bRR\bRA\bAs\bs exist for aberrant behavior detection,
130        they can be used to generate the graph of a time series with confidence
131        bands and failures.
133           rrdtool graph example.png \
134                  DEF:obs=monitor.rrd:ifOutOctets:AVERAGE \
135                  DEF:pred=monitor.rrd:ifOutOctets:HWPREDICT \
136                  DEF:dev=monitor.rrd:ifOutOctets:DEVPREDICT \
137                  DEF:fail=monitor.rrd:ifOutOctets:FAILURES \
138                  TICK:fail#ffffa0:1.0:"Failures\: Average bits out" \
139                  CDEF:scaledobs=obs,8,* \
140                  CDEF:upper=pred,dev,2,*,+ \
141                  CDEF:lower=pred,dev,2,*,- \
142                  CDEF:scaledupper=upper,8,* \
143                  CDEF:scaledlower=lower,8,* \
144                  LINE2:scaledobs#0000ff:"Average bits out" \
145                  LINE1:scaledupper#ff0000:"Upper Confidence Bound: Average bits out" \
146                  LINE1:scaledlower#ff0000:"Lower Confidence Bound: Average bits out"
148        This example generates a graph of the data series in blue (LINE2 with
149        the scaledobs virtual data source), confidence bounds in red (scaledup-
150        per and scaledlower virtual data sources), and potential failures (i.e.
151        potential aberrant aberrant behavior) marked by vertical yellow lines
152        (the fail data source).
154        The raw data comes from an AVERAGE R\bRR\bRA\bA, the finest resolution of the
155        observed time series (one consolidated data point per primary data
156        point). The predicted (or smoothed) values are stored in the HWPREDICT
157        R\bRR\bRA\bA. The predicted deviations (think standard deviation) values are
158        stored in the DEVPREDICT R\bRR\bRA\bA. Finally, the FAILURES R\bRR\bRA\bA contains indi-
159        cators, with 1 denoting a potential failure.
161        All of the data is rescaled to bits (instead of Octets) by multiplying
162        by 8.  The confidence bounds are computed by an offset of 2 deviations
163        both above and below the predicted values (the CDEFs upper and lower).
164        Vertical lines indicated potential failures are graphed via the TICK
165        graph element, which converts non-zero values in an R\bRR\bRA\bA into tick
166        marks. Here an axis-fraction argument of 1.0 means the tick marks span
167        the entire y-axis, and hence become vertical lines on the graph.
169        The choice of 2 deviations (a scaling factor) matches the default used
170        internally by the FAILURES R\bRR\bRA\bA. If the internal value is changed (see
171        rrdtune), this graphing command should be changed to be consistent.
173        _\bA _\bn_\bo_\bt_\be _\bo_\bn _\bd_\ba_\bt_\ba _\br_\be_\bd_\bu_\bc_\bt_\bi_\bo_\bn_\b:
175        The r\brr\brd\bdt\bto\boo\bol\bl _\bg_\br_\ba_\bp_\bh command is designed to plot data at a specified tem-
176        poral resolution, regardless of the actually resolution of the data in
177        the RRD file.  This can present a problem for the specialized consoli-
178        dation functions which maintain a one-to-one mapping between primary
179        data points and consolidated data points. If a graph insists on viewing
180        the contents of these R\bRR\bRA\bAs\bs on a coarser temporal scale, the _\bg_\br_\ba_\bp_\bh com-
181        mand tries to do something intelligent, but the confidence bands and
182        failures no longer have the same meaning and may be misleading.
184 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
185        rrdgraph gives an overview of how r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh works.  rrdgraph_data
186        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
187        language used in the x\bxD\bDE\bEF\bF statements.  rrdgraph_graph page describes
188        all the graph and print functions.
190 A\bAU\bUT\bTH\bHO\bOR\bR
191        Program by Tobias Oetiker <tobi@oetiker.ch>
193        This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
194        corrections and/or additions by several people
198 1.3.99909060808                   2009-02-21              RRDGRAPH_EXAMPLES(1)