1RRDGRAPH_EXAMPLES(1) rrdtool RRDGRAPH_EXAMPLES(1)
2
3
4
6 rrdgraph_examples - Examples for rrdtool graph
7
9 rrdtool graph /home/httpd/html/test.png --img-format PNG
10
11 followed by any of the examples below
12
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.
17
19 Data with multiple resolutions
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"
27
28 Nicely formatted legend section
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
39
40 Note: consolidation occurs here.
41
42 CDEF:ds0bits=ds0,8,*
43 CDEF:ds1bits=ds1,8,*
44
45 Note: 10 spaces to move text to the right
46
47 COMMENT:" "
48
49 Note: the column titles have to be as wide as the columns
50
51 COMMENT:"Maximum "
52 COMMENT:"Average "
53 COMMENT:"Minimum "
54
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"
66
67 Offsetting a line on the y-axis
68 Depending on your needs you can do this in two ways:
69
70 · Offset the data, then graph this
71
72 DEF:mydata=my.rrd:ds:AVERAGE
73
74 Note: this will also influence any other command that uses "data"
75
76 CDEF:data=mydata,100,+
77 LINE1:data#FF0000:"Data with offset"
78
79 · Graph the original data, with an offset
80
81 DEF:mydata=my.rrd:ds:AVERAGE
82
83 Note: no color in the first line so it is not visible
84
85 LINE1:100
86
87 Note: the second line gets stacked on top of the first one
88
89 LINE1:data#FF0000:"Data with offset":STACK
90
91 Drawing dashed lines
92 Also works for HRULE and VRULE
93
94 · default style: - - - - -
95 LINE1:data#FF0000:"dashed line":dashes
96
97 · more fancy style with offset: - - --- - --- -
98 LINE1:data#FF0000:"another dashed
99 line":dashes=15,5,5,10:dash-offset=10
100
101 Time ranges
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
108
109 Viewing the current and previous week together
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
113
114 Shift the data forward by one week (604800 seconds)
115
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
120
121 Aberrant Behaviour Detection
122 If the specialized function RRAs exist for aberrant behavior detection,
123 they can be used to generate the graph of a time series with confidence
124 bands and failures.
125
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"
140
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).
146
147 The raw data comes from an AVERAGE RRA, 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 RRA. The predicted deviations (think standard deviation) values are
151 stored in the DEVPREDICT RRA. Finally, the FAILURES RRA contains
152 indicators, with 1 denoting a potential failure.
153
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 RRA 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.
161
162 The choice of 2 deviations (a scaling factor) matches the default used
163 internally by the FAILURES RRA. If the internal value is changed (see
164 rrdtune), this graphing command should be changed to be consistent.
165
166 A note on data reduction:
167
168 The rrdtool graph 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 RRAs on a coarser temporal scale, the
174 graph command tries to do something intelligent, but the confidence
175 bands and failures no longer have the same meaning and may be
176 misleading.
177
179 rrdgraph gives an overview of how rrdtool graph works. rrdgraph_data
180 describes DEF,CDEF and VDEF in detail. rrdgraph_rpn describes the RPN
181 language used in the xDEF statements. rrdgraph_graph page describes
182 all the graph and print functions.
183
185 Program by Tobias Oetiker <tobi@oetiker.ch>
186
187 This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
188 corrections and/or additions by several people
189
190
191
1921.4.4 2009-02-21 RRDGRAPH_EXAMPLES(1)