Code

Imported upstream version 1.4.8
[pkg-rrdtool.git] / doc / rrdgraph_examples.1
1 .\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "RRDGRAPH_EXAMPLES 1"
127 .TH RRDGRAPH_EXAMPLES 1 "2013-05-23" "1.4.8" "rrdtool"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 rrdgraph_examples \- Examples for rrdtool graph
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fBrrdtool graph /home/httpd/html/test.png \-\-img\-format \s-1PNG\s0\fR
137 .PP
138 followed by any of the examples below
139 .SH "DESCRIPTION"
140 .IX Header "DESCRIPTION"
141 For your convenience some of the commands are explained here
142 by using detailed examples. They are not always cut-and-paste
143 ready because comments are intermixed with the examples.
144 .SH "EXAMPLES"
145 .IX Header "EXAMPLES"
146 .SS "Data with multiple resolutions"
147 .IX Subsection "Data with multiple resolutions"
148 .Vb 7
149 \&    \-\-end now \-\-start end\-120000s \-\-width 400
150 \&    DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
151 \&    DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
152 \&    DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
153 \&    LINE1:ds0a#0000FF:"default resolution\el"
154 \&    LINE1:ds0b#00CCFF:"resolution 1800 seconds per interval\el"
155 \&    LINE1:ds0c#FF00FF:"resolution 7200 seconds per interval\el"
156 .Ve
157 .SS "Nicely formatted legend section"
158 .IX Subsection "Nicely formatted legend section"
159 .Vb 10
160 \&    DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
161 \&    DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
162 \&    VDEF:ds0max=ds0,MAXIMUM
163 \&    VDEF:ds0avg=ds0,AVERAGE
164 \&    VDEF:ds0min=ds0,MINIMUM
165 \&    VDEF:ds0pct=ds0,95,PERCENT
166 \&    VDEF:ds1max=ds1,MAXIMUM
167 \&    VDEF:ds1avg=ds1,AVERAGE
168 \&    VDEF:ds1min=ds1,MINIMUM
169 \&    VDEF:ds1pct=ds1,95,PERCENT
170 .Ve
171 .PP
172 Note: consolidation occurs here.
173 .PP
174 .Vb 2
175 \&    CDEF:ds0bits=ds0,8,*
176 \&    CDEF:ds1bits=ds1,8,*
177 .Ve
178 .PP
179 Note: 10 spaces to move text to the right
180 .PP
181 .Vb 1
182 \&    COMMENT:"          "
183 .Ve
184 .PP
185 Note: the column titles have to be as wide as the columns
186 .PP
187 .Vb 3
188 \&    COMMENT:"Maximum    "
189 \&    COMMENT:"Average    "
190 \&    COMMENT:"Minimum    "
191 \&
192 \&    COMMENT:"95th percentile\el"
193 \&    AREA:ds0bits#00C000:"Inbound "
194 \&    GPRINT:ds0max:"%6.2lf %Sbps"
195 \&    GPRINT:ds0avg:"%6.2lf %Sbps"
196 \&    GPRINT:ds0min:"%6.2lf %Sbps"
197 \&    GPRINT:ds0pct:"%6.2lf %Sbps\el"
198 \&    LINE1:ds1bits#0000FF:"Outbound"
199 \&    GPRINT:ds1max:"%6.2lf %Sbps"
200 \&    GPRINT:ds1avg:"%6.2lf %Sbps"
201 \&    GPRINT:ds1min:"%6.2lf %Sbps"
202 \&    GPRINT:ds1pct:"%6.2lf %Sbps\el"
203 .Ve
204 .SS "Offsetting a line on the y\-axis"
205 .IX Subsection "Offsetting a line on the y-axis"
206 Depending on your needs you can do this in two ways:
207 .IP "\(bu" 4
208 Offset the data, then graph this
209 .Sp
210 .Vb 1
211 \&    DEF:mydata=my.rrd:ds:AVERAGE
212 .Ve
213 .Sp
214 Note: this will also influence any other command that uses \*(L"data\*(R"
215 .Sp
216 .Vb 2
217 \&    CDEF:data=mydata,100,+
218 \&    LINE1:data#FF0000:"Data with offset"
219 .Ve
220 .IP "\(bu" 4
221 Graph the original data, with an offset
222 .Sp
223 .Vb 1
224 \&    DEF:mydata=my.rrd:ds:AVERAGE
225 .Ve
226 .Sp
227 Note: no color in the first line so it is not visible
228 .Sp
229 .Vb 1
230 \&    LINE1:100
231 .Ve
232 .Sp
233 Note: the second line gets stacked on top of the first one
234 .Sp
235 .Vb 1
236 \&    LINE1:data#FF0000:"Data with offset":STACK
237 .Ve
238 .SS "Drawing dashed lines"
239 .IX Subsection "Drawing dashed lines"
240 Also works for \s-1HRULE\s0 and \s-1VRULE\s0
241 .IP "\(bu" 4
242 default style: \- \- \- \- \-
243     LINE1:data#FF0000:\*(L"dashed line\*(R":dashes
244 .IP "\(bu" 4
245 more fancy style with offset: \- \-  \-\-\- \-  \-\-\- \-
246     LINE1:data#FF0000:\*(L"another dashed line\*(R":dashes=15,5,5,10:dash\-offset=10
247 .SS "Time ranges"
248 .IX Subsection "Time ranges"
249 .Vb 6
250 \&    Last four weeks: \-\-start end\-4w \-\-end 00:00
251 \&    January 2001:    \-\-start 20010101 \-\-end start+31d
252 \&    January 2001:    \-\-start 20010101 \-\-end 20010201
253 \&    Last hour:       \-\-start end\-1h
254 \&    Last 24 hours:   <nothing at all>
255 \&    Yesterday:       \-\-end 00:00
256 .Ve
257 .SS "Viewing the current and previous week together"
258 .IX Subsection "Viewing the current and previous week together"
259 .Vb 3
260 \&    \-\-end now \-\-start end\-1w
261 \&    DEF:thisweek=router.rrd:ds0:AVERAGE
262 \&    DEF:lastweek=router.rrd:ds0:AVERAGE:end=now\-1w:start=end\-1w
263 .Ve
264 .PP
265 Shift the data forward by one week (604800 seconds)
266 .PP
267 .Vb 4
268 \&    SHIFT:lastweek:604800
269 \&    [ more of the usual VDEF and CDEF stuff if you like ]
270 \&    AREA:lastweek#0000FF:Last\e week
271 \&    LINE1:thisweek#FF0000:This\e week
272 .Ve
273 .SS "Aberrant Behaviour Detection"
274 .IX Subsection "Aberrant Behaviour Detection"
275 If the specialized function \fBRRAs\fR exist for aberrant behavior detection, they
276 can be used to generate the graph of a time series with confidence bands and
277 failures.
278 .PP
279 .Vb 10
280 \&   rrdtool graph example.png \e
281 \&          DEF:obs=monitor.rrd:ifOutOctets:AVERAGE \e
282 \&          DEF:pred=monitor.rrd:ifOutOctets:HWPREDICT \e
283 \&          DEF:dev=monitor.rrd:ifOutOctets:DEVPREDICT \e
284 \&          DEF:fail=monitor.rrd:ifOutOctets:FAILURES \e
285 \&          TICK:fail#ffffa0:1.0:"Failures\e: Average bits out" \e
286 \&          CDEF:scaledobs=obs,8,* \e
287 \&          CDEF:upper=pred,dev,2,*,+ \e
288 \&          CDEF:lower=pred,dev,2,*,\- \e
289 \&          CDEF:scaledupper=upper,8,* \e
290 \&          CDEF:scaledlower=lower,8,* \e
291 \&          LINE2:scaledobs#0000ff:"Average bits out" \e
292 \&          LINE1:scaledupper#ff0000:"Upper Confidence Bound: Average bits out" \e
293 \&          LINE1:scaledlower#ff0000:"Lower Confidence Bound: Average bits out"
294 .Ve
295 .PP
296 This example generates a graph of the data series in blue (\s-1LINE2\s0 with the scaledobs
297 virtual data source), confidence bounds in red (scaledupper and scaledlower virtual
298 data sources), and potential failures (i.e. potential aberrant aberrant behavior)
299 marked by vertical yellow lines (the fail data source).
300 .PP
301 The raw data comes from an \s-1AVERAGE\s0 \fB\s-1RRA\s0\fR, the finest resolution of the observed
302 time series (one consolidated data point per primary data point). The predicted
303 (or smoothed) values are stored in the \s-1HWPREDICT\s0 \fB\s-1RRA\s0\fR. The predicted deviations
304 (think standard deviation) values are stored in the \s-1DEVPREDICT\s0 \fB\s-1RRA\s0\fR. Finally,
305 the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR contains indicators, with 1 denoting a potential failure.
306 .PP
307 All of the data is rescaled to bits (instead of Octets) by multiplying by 8.
308 The confidence bounds are computed by an offset of 2 deviations both above
309 and below the predicted values (the CDEFs upper and lower). Vertical lines
310 indicated potential failures are graphed via the \s-1TICK\s0 graph element, which
311 converts non-zero values in an \fB\s-1RRA\s0\fR into tick marks. Here an axis-fraction
312 argument of 1.0 means the tick marks span the entire y\-axis, and hence become
313 vertical lines on the graph.
314 .PP
315 The choice of 2 deviations (a scaling factor) matches the default used internally
316 by the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR. If the internal value is changed (see rrdtune), this
317 graphing command should be changed to be consistent.
318 .PP
319 \fIA note on data reduction:\fR
320 .IX Subsection "A note on data reduction:"
321 .PP
322 The \fBrrdtool\fR \fIgraph\fR command is designed to plot data at a specified temporal
323 resolution, regardless of the actually resolution of the data in the \s-1RRD\s0 file.
324 This can present a problem for the specialized consolidation functions which
325 maintain a one-to-one mapping between primary data points and consolidated
326 data points. If a graph insists on viewing the contents of these \fBRRAs\fR on a
327 coarser temporal scale, the \fIgraph\fR command tries to do something intelligent,
328 but the confidence bands and failures no longer have the same meaning and may
329 be misleading.
330 .SH "SEE ALSO"
331 .IX Header "SEE ALSO"
332 rrdgraph gives an overview of how \fBrrdtool graph\fR works.
333 rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
334 rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fBxDEF\fR statements.
335 rrdgraph_graph page describes all the graph and print functions.
336 .SH "AUTHOR"
337 .IX Header "AUTHOR"
338 Program by Tobias Oetiker <tobi@oetiker.ch>
339 .PP
340 This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl>
341 with corrections and/or additions by several people