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 --imgformat 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:mydata#FF0000:"Data with offset":STACK
90
91 Drawing dashed lines
92 Also works for HRULE and VRULE
93
94 · default style: - - - - -
95
96 LINE1:data#FF0000:"dashed line":dashes
97
98 · more fancy style with offset: - - --- - --- -
99
100 LINE1:data#FF0000:"another dashed line":dashes=15,5,5,10:dash-offset=10
101
102 Time ranges
103 Last four weeks: --start end-4w --end 00:00
104 January 2001: --start 20010101 --end start+31d
105 January 2001: --start 20010101 --end 20010201
106 Last hour: --start end-1h
107 Last 24 hours: <nothing at all>
108 Yesterday: --end 00:00
109
110 Viewing the current and previous week together
111 --end now --start end-1w
112 DEF:thisweek=router.rrd:ds0:AVERAGE
113 DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w
114
115 Shift the data forward by one week (604800 seconds)
116
117 SHIFT:lastweek:604800
118 [ more of the usual VDEF and CDEF stuff if you like ]
119 AREA:lastweek#0000FF:Last\ week
120 LINE1:thisweek#FF0000:This\ week
121
122 Aberrant Behaviour Detection
123 If the specialized function RRAs exist for aberrant behavior detection,
124 they can be used to generate the graph of a time series with confidence
125 bands and failures.
126
127 rrdtool graph example.png \
128 DEF:obs=monitor.rrd:ifOutOctets:AVERAGE \
129 DEF:pred=monitor.rrd:ifOutOctets:HWPREDICT \
130 DEF:dev=monitor.rrd:ifOutOctets:DEVPREDICT \
131 DEF:fail=monitor.rrd:ifOutOctets:FAILURES \
132 TICK:fail#ffffa0:1.0:"Failures\: Average bits out" \
133 CDEF:scaledobs=obs,8,* \
134 CDEF:upper=pred,dev,2,*,+ \
135 CDEF:lower=pred,dev,2,*,- \
136 CDEF:scaledupper=upper,8,* \
137 CDEF:scaledlower=lower,8,* \
138 LINE2:scaledobs#0000ff:"Average bits out" \
139 LINE1:scaledupper#ff0000:"Upper Confidence Bound: Average bits out" \
140 LINE1:scaledlower#ff0000:"Lower Confidence Bound: Average bits out"
141
142 This example generates a graph of the data series in blue (LINE2 with
143 the scaledobs virtual data source), confidence bounds in red
144 (scaledupper and scaledlower virtual data sources), and potential
145 failures (i.e. potential aberrant behavior) marked by vertical yellow
146 lines (the fail data source).
147
148 The raw data comes from an AVERAGE RRA, the finest resolution of the
149 observed time series (one consolidated data point per primary data
150 point). The predicted (or smoothed) values are stored in the HWPREDICT
151 RRA. The predicted deviations (think standard deviation) values are
152 stored in the DEVPREDICT RRA. Finally, the FAILURES RRA contains
153 indicators, with 1 denoting a potential failure.
154
155 All of the data is rescaled to bits (instead of Octets) by multiplying
156 by 8. The confidence bounds are computed by an offset of 2 deviations
157 both above and below the predicted values (the CDEFs upper and lower).
158 Vertical lines indicated potential failures are graphed via the TICK
159 graph element, which converts non-zero values in an RRA into tick
160 marks. Here an axis-fraction argument of 1.0 means the tick marks span
161 the entire y-axis, and hence become vertical lines on the graph.
162
163 The choice of 2 deviations (a scaling factor) matches the default used
164 internally by the FAILURES RRA. If the internal value is changed (see
165 rrdtune), this graphing command should be changed to be consistent.
166
167 A note on data reduction:
168
169 The rrdtool graph command is designed to plot data at a specified
170 temporal resolution, regardless of the actually resolution of the data
171 in the RRD file. This can present a problem for the specialized
172 consolidation functions which maintain a one-to-one mapping between
173 primary data points and consolidated data points. If a graph insists on
174 viewing the contents of these RRAs on a coarser temporal scale, the
175 graph command tries to do something intelligent, but the confidence
176 bands and failures no longer have the same meaning and may be
177 misleading.
178
180 rrdgraph gives an overview of how rrdtool graph works. rrdgraph_data
181 describes DEF,CDEF and VDEF in detail. rrdgraph_rpn describes the RPN
182 language used in the xDEF statements. rrdgraph_graph page describes
183 all the graph and print functions.
184
186 Program by Tobias Oetiker <tobi@oetiker.ch>
187
188 This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
189 corrections and/or additions by several people
190
191
192
1931.7.1 2019-02-04 RRDGRAPH_EXAMPLES(1)