Code

adapted for 2009
[rrdtool-all.git] / tutorial / lisa2009 / rrd-by-example / body.tex
1 \mode<presentation>
2 {
3   \usetheme{default} % no fancy navigation or anything ... 
4   \usecolortheme{tobi}
5   \usefonttheme{serif}   
6   \usepackage{lmodern}
7   \newcommand{\addgraph}[1]{\includegraphics[width=\textwidth]{ex/#1}}
8   \setbeamercovered{transparent=25}
9 }
10 \mode<article>
11 {
12   \usepackage{url}
13   \usepackage{graphicx}
14   \usepackage[colorlinks,hyperindex,plainpages=false]{hyperref}
15   \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
16   \setlength{\parindent}{0pt}  
17   \usepackage{times}
18   \newcommand{\addgraph}[1]{\begin{center}\framebox{\includegraphics[width=0.9\textwidth]{ex/#1}}\end{center}}
19   \addtolength{\voffset}{-2.5cm}
20   \addtolength{\textheight}{4cm}
21 }
22 \usepackage{alltt}
23 \usepackage{listings}
24 \usepackage{svgcolor}
25 \usepackage[english]{babel}
26 \usepackage[latin1]{inputenc}
27 % or whatever
29 \usepackage[T1]{fontenc}
30 % Or whatever. Note that the encoding and the font should match. If T1
31 % does not look nice, try deleting the line with the fontenc.
33 \title
34 {RRDtool advanced Topics}
36 \author
37 {Tobias Oetiker}
39 \institute
40 {OETIKER+PARTNER AG}
42 \date[LISA 2009] % (optional, should be abbreviation of conference name)
43 {23rd Large Installation System Administration Conference}
45 \mode<presentation>{\subject{RRDtool tutorial based on example use}}
47 \mode<presentation>{
48  \lstset{%
49    language=Perl,%
50    numbers=left,%
51    basicstyle=\ttfamily\footnotesize\color{black},%
52    keywordstyle=\color{darkgreen},%
53 %  identifyerstyle=\color{brown},%
54    commentstyle=\color{mediumpurple},%
55    stringstyle=\color{dimgray},
56    numberstyle=\ttfamily\scriptsize\color{darkgray},
57    showstringspaces=false
58  }
59 }
60 \mode<article>{
61  \lstset{%
62    language=Perl,%
63    numbers=left,%
64    basicstyle=\ttfamily\footnotesize,%
65    keywordstyle=\bfseries,%
66    numberstyle=\ttfamily\scriptsize,
67 %  identifyerstyle=\color{brown},%
68    commentstyle=\itshape,%
69    stringstyle=\color{black},
70    showstringspaces=false
71  }
72 }
74 \begin{document}
76 \mode<article>{\maketitle}
78 \begin{frame}<presentation>
79   \titlepage
80 \end{frame}
82 \mode<articel>{\tableofcontents}
84 \section{A different kind of Database}
86 \begin{frame}{creating a simple rrd}
87 \lstinputlisting[language=bash,firstline=0,lastline=11]{ex/create-first.sh}
88 One Datasource, 4 Round Robin Archives
89 \end{frame}
91 \begin{frame}{feeding data}
92 \lstinputlisting[language=bash,firstline=13,lastline=21]{ex/create-first.sh}
93 Feed in some data. One or several updates at once.
94 \end{frame}
96 \begin{frame}[allowframebreaks]{inside the database}
97 \lstinputlisting[language=xml,basicstyle=\ttfamily\scriptsize]{ex/create-first.xml}
98 \end{frame}
100 \mode<article>{
101 The xml dump of the rrd file shows an approximation of the on-disk
102 structure of the database. The rra database sections are re-ordered, so that
103 they are in chronological order with the oldest at the top. Also the
104 cdp sections are stored right after the header. The idea behind this
105 design is that data that get written on every update is as close
106 together as possible.}
108 \begin{frame}{rrd features}
109 \begin{itemize}
110 \item optimized for time-series data
111 \item fixed size rotating data store
112 \item constant on-disk size
113 \item no maintenance
114 \item on the fly consolidation
115 \end{itemize}
116 \end{frame}
118 \begin{frame}[fragile]{on-disk structure}
119 \begin{alltt}
120 +-------------------------------+
121 | Static Header                 | \textrm{RRD cookie, DB cfg}
122 |-------------------------------|\pause 
123 : Data Source (DS) Definitions  : 
124 |-------------------------------|\pause
125 : RR Archive (RRA) Definitions  : 
126 |===============================|\pause
127 | Live Head                     | \textrm{last update time}
128 |-------------------------------|\pause 
129 : PDP Prep per DS               : \textrm{last value for diff}
130 |-------------------------------|\pause
131 : CDP Prep per RRA and DS       : \textrm{intermediate storage}
132 |-------------------------------|\pause
133 : RRA Pointers                  :
134 |===============================|\pause
135 : Round Robin Archives (RRA)    :
136 +-------------------------------+
137 \end{alltt}
138 \end{frame}
140 \begin{frame}{irregular data arrival intervals}
141 \lstinputlisting[language=bash,lastline=19]{ex/update-real.sh}
142 \end{frame}
144 \mode<article>{To try things out lets assume that data arrives at
145   irregular intervals. This is counter data. By synchronizing the
146   data values with the arrival time we should get a constant rate
147   stored in the database.}
149 \begin{frame}{database after the irregular updates}
150 \lstinputlisting[language=bash,firstline=20]{ex/update-real.sh}
151 \lstinputlisting[language=bash]{ex/update-real.txt}
153 \begin{itemize}
154 \item rrdtool re-binning at work
155 \item major difference to a normal db
156 \item all bins contain 1.0
157 \item the time is the 'end-time' of the bin.
158 \end{itemize}
159 \end{frame}
161 \mode<article>{\newpage}
162 \begin{frame}{optimizing your rrds}
163 \begin{itemize}
164 \item update of multi DS RRD is cheep
165 \item single update interval per RRD
166 \item RRD modification is expensive
167 \item RRD size and update performance are independent
168 \item RRA complexity affects update performance
169 \end{itemize}
170 \end{frame}
172 \mode<article>{As long as your system is small (a few hundred RRDs)
173   you should optimize for convenience. Only keep DSes together
174   in one RRD that are tightly bound. For everything else
175   create separate RRDs.}
177 \mode<article>{\newpage}
179 \begin{frame}{fetching data}
180 fetch is for reading data from an rrd
181 \lstinputlisting[language=bash,firstline=8,lastline=9]{ex/catch-fetch.sh}
182 \begin{itemize}
183 \item one RRA with two 300s entries
184 \item one RRA with three 600s entries
185 \end{itemize}
186 \end{frame}
188 \begin{frame}[fragile]{playing catch with fetch}
189 first pull 300 seconds
190 \begin{verbatim}
191 > rrdtool fetch x.rrd -r 300 \
192   -s 1200000600 -e 1200000900 AVERAGE
194 1200000900: 4.0000000000e+01
195 1200001200: 5.0000000000e+01
196 \end{verbatim}
198 then pull 900 seconds
199 \begin{verbatim}
200 > rrdtool fetch x.rrd -r300 \
201   -s 1200000000 -e 1200000900 AVERAGE
203 1200000600: 2.5000000000e+01
204 1200001200: 4.5000000000e+01
205 \end{verbatim}
206 \end{frame}
208 \begin{frame}{fetch recap}
209 \begin{itemize}
210 \item looking for complete coverage
211 \item resolution is only a suggestion
212 \item time stamp in output marks the END of the period
213 \item end-time differences caused problems
214 \item since 1.3, only the start-time is relevant for coverage
215 \item outside the rra everything is NaN
216 \end{itemize}
217 \end{frame}
219 \begin{frame}{the size of an rrd - code}
220 \lstinputlisting{ex/rrd-size.pl}
221 \end{frame}
223 \mode<article>{\newpage}
225 \begin{frame}{the size of an rrd - result}
226 \lstinputlisting{ex/rrd-size.txt}
227 \begin{itemize}
228 \item overhead is minimal
229 \item 8 byte per double 
230 \item \ldots per datasource
231 \item \ldots per RRA
232 \item \ldots per RRA row
233 \end{itemize}
234 \end{frame}
236 \mode<article>{The rrd format is highly efficient at storing non
237   sparse data. The overhead for an extra RRA or DS is normally a few
238   bytes on top of the 8 byte per double.}
240 \mode<article>{\newpage}
242 \section{Graphing}
243 \begin{frame}[fragile]{rrdgraph syntax 101}
244 for graph command syntax, there are two basic rules:\pause
245 \begin{enumerate}
246 \item \texttt{-{}-options} start with a double dash\pause
247 \item graphing instructions start with a letter
248 \end{enumerate}
250 \pause
251 \begin{center}
252 \renewcommand{\tabcolsep}{0.4cm}
253 \renewcommand{\arraystretch}{2}
255 \begin{tabular}{|l|}\hline
256 \begin{minipage}[t]{0.7\textwidth}
257 \begin{alltt}
258 rrdtool graph \textit{output}
259    DEF:var=\textit{rrd}:\textit{DS}:\textit{AVARAGE}
260    LINE:var#\textit{hex-rgb-color}:Comment
262 \end{alltt}
263 \end{minipage}\\\hline
264 \end{tabular}
265 \end{center}
267 \texttt{DEF} and \texttt{LINE} are \emph{graphing instructions}.
268 \end{frame}
270 \mode<article>{The rrd graph command is the most versatile of all rrdtool
271   commands. It comes with its own little language, optimized for
272   drawing graphs. There are two kinds of arguments. The options
273   which start with a double-dash and the graphing instructions that
274   start with an uppercase letter.}
276 \begin{frame}{normal line}
277 \addgraph{LINE}
278 \end{frame}
280 \begin{frame}{lower limit}
281 \addgraph{LINE-lower}
282 \end{frame}
284 \mode<article>{Unless you are a banker and are you drawing stock diagrams,
285   make sure your graph displays the zero-y-value. Otherwise it is
286   pretty difficult to judge the meaning of the graph since perspective
287   is limited to the numbers on the y-axis.}
289 \begin{frame}{slope mode}
290 \addgraph{LINE-slope}
291 \end{frame}
293 \mode<article>{RRD graphs are pretty blocky. This is on purpose, since
294   the data is blocky too. The slope mode is a little concession. It
295   tilts the vertical connections between the 'blocks' by one pixel.}
297 \begin{frame}{anti-anti-aliasing: graph}
298 \addgraph{LINE-graph-mono}
299 \end{frame}
301 \begin{frame}{anti-anti-aliasing: font}
302 \addgraph{LINE-font-mono}
303 \end{frame}
305 \mode<article>{\newpage}
306 \begin{frame}{line width}
307 \addgraph{LINE-width}
308 \end{frame}
310 \begin{frame}{dashed line}
311 \addgraph{LINE-dash}
312 \end{frame}
314 \mode<article>{The numbers are an ON-OFF-ON-OFF-\ldots pattern. The
315   \texttt{dash-offset} property lets you shift the dashing of the line
316   to the right.}
318 \begin{frame}{DEF with :step}
319 \addgraph{DEF-step}
320 \end{frame}
323 \begin{frame}{DEF with :start}
324 \addgraph{DEF-start}
325 \end{frame}
326 \mode<article>{\newpage}
328 \begin{frame}{DEF with :reduce}
329 \addgraph{DEF-reduce}
330 \end{frame}
332 \begin{frame}{AREA simple}
333 \addgraph{AREA-simple}
334 \end{frame}
336 \mode<article>{\newpage}
337 \begin{frame}{two AREAs}
338 \addgraph{AREA-two}
339 \end{frame}
341 \begin{frame}{transparent AREA}
342 \addgraph{AREA-trans}
343 \end{frame}
345 \mode<article>{RRDtool creates real alpha transparency. You can set
346   the whole graph to be transparent by setting the 
347   graph CANVAS and BACKGROUND colors to transparent.}
349 \mode<article>{\newpage}
350 \begin{frame}{stacked AREA}
351 \addgraph{AREA-stack}
352 \end{frame}
354 \mode<article>{\newpage}
356 \begin{frame}{time shift}
357 \addgraph{SHIFT-simple}
358 \end{frame}
360 \begin{frame}{shifting with extra data}
361 \addgraph{SHIFT-startdef}
362 \end{frame}
364 \mode<article>{A normal \texttt{DEF} line requests exactly as much data as it
365 requires for drawing the graph. If you \texttt{SHIFT} the data, you
366 may want to adjust the data fetched accordingly.}
368 \mode<article>{\newpage}
369 \section{Revers Polish Notation (RPN) Math}
371 \mode<article>{RRDtool lets you apply math operations to the data
372   prior to showing it to the user. It uses RPN math for this. If you
373   ever owned a classic HP calculator, you may still remember how RPN
374   math works. For all the others there is a little example below,
375   that shows how to do a little addition in RPN.}
377 \begin{frame}[fragile]{RPN basics: Step 0}
378 $15+23=38$
379 \begin{alltt}
380             1: NAN
381             2: NAN
382             3: NAN
383 \end{alltt}
384 \end{frame}
385 \begin{frame}[fragile]{RPN basics: Step 1}
386 $\mathbf{15}+23=38$
387 \begin{alltt}
388 [15]        1: \textbf{15}
389             2: NAN
390             3: NAN
391 \end{alltt}
392 \end{frame}
393 \begin{frame}[fragile]{RPN basics: Step 2}
394 $15+\mathbf{23}=38$
395 \begin{alltt}
396 [23]        1: \textbf{23}
397             2: 15
398             3: NAN
399 \end{alltt}
400 \end{frame}
401 \begin{frame}[fragile]{RPN basics: Step 3}
402 $15\mathbf{+}23=38$
403 \begin{alltt}
404 [+]         1: \textbf{38}
405             2: NAN
406             3: NAN
407 \end{alltt}
408 \end{frame}
410 \newpage 
412 \begin{frame}{math in the graph (+)}
413 \addgraph{RPN-simple}
414 \end{frame}
416 \mode<article>{A simple addition. We add a fixed value to a data
417   source. Note that at least one data source must appear inside a CDEF
418   expression. The input to a CDEF expression can come from another
419   CDEF expression.}
421 \begin{frame}{simple gradient}
422 \addgraph{RPN-grad-a}
423 \end{frame}
425 \begin{frame}{the MAX function}
426 \addgraph{RPN-max}
427 \end{frame}
429 \mode<article>{The MAX function operates on two values. In this example
430   the input comes from two different data sources.}
432 \begin{frame}{the LIMIT function}
433 \addgraph{RPN-limit}
434 \end{frame}
436 \mode<article>{The \texttt{LIMIT} function will return UNKNOWN as soon
437   as the input value is outside the given range. UNKNOWN data does not
438   get drawn.}
440 \begin{frame}{the TREND function}
441 \addgraph{RPN-trend}
442 \end{frame}
444 \mode<article>{If a data source varies massively, the TREND function
445   lets you smooth away by building a moving average. By calculating
446   the average, the output gets shifted by the length of the TREND
447   calculation.}
449 \begin{frame}{the TREND with early start}
450 \addgraph{RPN-trend-start}
451 \end{frame}
453 \mode<article>{In the previous graph there was a bit of data missing
454   at the left border of the graph. This was because rrdgraph loads
455   exactly the amount of data that is required in the graph (yes same
456   story as before). By loading more data, we can provide the TREND
457   function with enough input, so that it can calculate the first few
458   pixels as well.}
460 \begin{frame}{the TREND and SHIFT}
461 \addgraph{RPN-trend-shift}
462 \end{frame}
464 \mode<article>{Another interesting option is to SHIFT the result of
465   the TREND calculation back in time, so that it matches with the
466   source data. This allows us to see more easily when there are
467   'outliners'}
469 \mode<article>{\newpage}
472 \begin{frame}{the IF function}
473 \addgraph{RPN-if}
474 \end{frame}
476 \mode<article>{The IF function requires three items on the stack. It
477   turns \texttt{a,b,c,IF} into \texttt{if a then b else c}. There is a
478   bunch  of operators that go along with the \texttt{IF}: \texttt{LT}
479   less, \texttt{LE} - less or equal, \texttt{EQ} - equal, \texttt{NE}
480   not equal, \texttt{GE} - greater or equal, \texttt{GT} - greater.}
482 \begin{frame}{horizontal gradient}
483 \addgraph{RPN-grad-b}
484 \end{frame}
487 \begin{frame}{about invisibility}
488 \addgraph{RPN-UNKN}
489 \end{frame}
491 \mode<article>{Unknown values are not drawn on the graph. Here we
492   use trick to only show the largest values.}
495 \begin{frame}{positional drawing count}
496 \addgraph{RPN-count}
497 \end{frame}
499 \mode<article>{If you are into bar charts, you might fake them with
500   this trick. COUNT, counts the values of the data set. We use this,
501   together with the modulo operator to suppress the drawing of every
502   third entry.}
504 \begin{frame}{access the previous value}
505 \addgraph{RPN-prev}
506 \end{frame}
508 \begin{frame}{positional drawing time}
509 \addgraph{RPN-time}
510 \end{frame}
512 \newpage
513 \begin{frame}{positional drawing time-shifting}
514 \addgraph{RPN-time-minus}
515 \end{frame}
517 \mode<article>{There is also a function for accessing the Unix time
518   (seconds since 1970) associated with the graph data. With it, you
519   can make your stripes a fixed number of seconds wide.}
521 \begin{frame}{time and resolution issues}
522 \addgraph{RPN-time-odd}
523 \end{frame}
525 \mode<article>{\newpage}
527 \mode<article>{Whenever RRDtool graph has to do math with data sets
528   that come in different step sizes, it first to adjust the step sizes
529   so that they match. To do this, it finds the greatest common divisor
530   and uses it as the new step size.}
532 \begin{frame}[fragile]{CDEF internals}
533 \begin{itemize}
534 \item data may come in different resolutions
535 \item all items in a CDEF must have the same resolution
536 \item resolution is expanded to greatest common devisor (gcd)
537 \item example: gcd(6,9) = 3, gcd(1,6) = 1
538 \end{itemize}
540 trick: an rrd with one a second step.
541 \begin{alltt}
542 rrdtool create one.rrd --step=1
543    DS:one:GAUGE:2:U:U
544    RRA:AVERAGE:0.5:1:1
545 \end{alltt}
546 \end{frame}
548 \begin{frame}{step=1 trick: high resolution cdef}
549 \addgraph{RPN-time-odd-hires}
550 \end{frame}
552 \mode<article>{By introducing this special rrd with a ``one second
553   step'' the greatest common divisor (gcd) becomes one.}
555 \section{Consolidation functions}
557 \begin{frame}{finding the average}
558 \addgraph{VDEF-average}
559 \end{frame}
561 \begin{frame}{calculating min and max}
562 \addgraph{VDEF-minmax}
563 \end{frame}
566 \mode<article>{\newpage}
568 \begin{frame}[fragile]{min max code example}
569 \begin{alltt}
570 LINE:a#456:a
571 VDEF:max=a,MAXIMUM
572 LINE:max#123
573 VRULE:max#123:maximum
574 GPRINT:max:%.1lf
575 GPRINT:max:%H\(\backslash\):%M\textbf{:strftime}
576 \end{alltt}
577 A VDEF result has a value and a time assigned.
578 \end{frame}
580 \begin{frame}{Least Squares Line (y=x*m+b)}
581 \addgraph{VDEF-lsl}
582 \end{frame}
585 \mode<article>{\newpage}
586 \section{Holt Winters Aberrant Behaviour Detection}
588 \begin{frame}{about alert generation}
589 \begin{itemize}
590 \item when something unexpected happens send an alert\pause
591 \item fixed thresholds are too wide a net\pause
592 \item moving averages weigh all data equal\pause
593 \item holt winters can predict the future\pause
594 \item and no one considers himself clever enough to use it
595 \end{itemize}
596 \end{frame}
598 \begin{frame}{rrd - holt winters assumptions}
599 \begin{itemize}
600 \item data is periodic in nature
601 \item data has continuity 
602 \item data continuity is periodic
603 \item recent data is more important
604 \end{itemize}
605 \end{frame}
607 \begin{frame}{holt winters aberrant behavior}
608 \begin{itemize}
609 \item prediction of future value and confidence band
610 \item confidence band is like a standard deviation
611 \item real value compared to predicted value +/- confidence band
612 \end{itemize}
613 \end{frame}
615 \mode<article>{With holt winters RRDtool will calculate a prediction
616   and a confidence band (think of it as a standard deviation) for the
617   current value. It will then compare the prediction with the
618   actual value. If the actual value falls outside the confidence band
619   of the predicted value (or some multiple of it), then a confidence
620   band violation is registered. If multiple violations are registered
621   within a configurable interval, RRDtool logs a failure.}
623 \begin{frame}<presentation>{holt winters configuration}
624 \begin{itemize}
625 \item HWPREDICT for starters
626 \item tweaking required
627 \item know the knobs to turn
628 \item use real data to test
629 \item FAILURES very short
630 \item \texttt{rrdtool tune} and \texttt{resize}
631 \end{itemize}
632 \end{frame}
634 \mode<article>{
635 \begin{itemize}
636 \item Keep it simple, go for HWPREDICT only when you start using
637   holt winters in RRDtool.
638 \item Every data set is different, tweaking is required. 
639 \item Know which knobs to turn.
640 \item Use real data when experimenting.
641 \item Use \texttt{rrdtool tune} and \texttt{rrdtool resize} to tweak settings.
642 \item The FAILURES RRA is short!
643 \end{itemize}
646 \begin{frame}{holt winters parameters}
647 \texttt{RRA:HWPREDICT:}\emph{rows}\texttt{:}\emph{alpha}\texttt{:}\emph{beta}\texttt{:}\emph{period}
649 \begin{description}
650 \item[\emph{alpha}:] adaption rate of the baseline (1 fast, 0 slow)
651 \item[\emph{beta}:] adaption rate of the slope (1 fast, 0 slow)
652 \item[\emph{period}:] how many steps in a period (use 1 to  disable)
653 \item[\emph{gamma}:] seasonal adaption rate of the baseline\\(alpha by
654   default)
655 \item[\emph{dev\_gamma}:] seasonal adaption rate of the confidence
656   band\\
657  (gamma by default)
658 \end{description}
660 the gamma and confidence band are tunable with \texttt{rrdtool tune}
661 \end{frame}
663 \mode<article>{
664 Reading \href{http://cricket.sourceforge.net/aberrant/lisa2000_paper.pdf}{Brutlag's original paper}
665 I wrote down the formulas he uses for calculating holt winters. This
666 helped me quite a lot in understanding the relationships between
667 alpha, beta, gamma and delta.}
669 \begin{frame}[fragile]{the rrdtool holt winters formula}
670 \begin{small}
671 \begin{alltt}
672 a - baseline (RRA CDP Parameter)
673 b - slope (RRA CDP Parameter)
674 c - seasonal (SEASONAL RRA)
675 d - deviation (DEVSEASONAL RRA)
676 pred - predicted value
677 real - real value\pause
679 pred\{next\} = a\{now\} + b\{now\} + c\{next_prev_period\}\pause
681 a\{now\} = alpha * (real\{now\} - c\{now_prev_period\}) 
682          + (1-alpha) * ( a\{prev\} + b\{prev\})\pause
683 b\{now\} = beta  * (a\{now\} - a\{prev\}) 
684          + (1-beta) * b_prev\pause
685 c\{now\} = gamma * (real\{now\} - a\{now\}) 
686          + (1-gamma) * c\{now_prev_period\}\pause
687 d\{now\} = dev_gamma * abs(real\{now\} - pred\{now\}) 
688          + (1-dev_gamma) * d\{now_prev_period\}\pause
690 \end{alltt}
691 \end{small}
692 \end{frame}
694 % must be formatted like that
695 % to break gobbling mode!
696 %\mode
697 %<all>
699 \begin{frame}{hw demo: the test data}
700 \addgraph{HW-input}
702 traffic at a peering point
703 \end{frame}
705 \begin{frame}[fragile]{drawing a hw graph}
706 \begin{lstlisting}[language=xml]
707 DEF:in=hw.rrd:in:AVERAGE
708 DEF:pred=hw.rrd:in:HWPREDICT
709 DEF:conf=hw.rrd:in:DEVPREDICT
710 DEF:fail=hw.rrd:in:FAILURES
711 TICK:fail#ff8:1:Failures
712 CDEF:lowconf=pred,conf,2,*,-
713 LINE1:lowconf
714 CDEF:confwidth=conf,4,*
715 AREA:confwidth#cfc:Band:STACK
716 LINE0.1:0#3a1::STACK
717 LINE0.1:lowconf#3a1
718 LINE1:in#c00:InOctets
719 LINE1:pred#0a0:Prediction
720 \end{lstlisting}
721 \end{frame}  
723 \mode<article>{For starters we set the period to 1. This disables HW's
724   ability to adjust to periodic behavior in the data but it lets us
725   better observe the effects of the different parameter settings since
726   the adjustment period is much shorter.}
728 \begin{frame}{hw demo: alpha}
729 \addgraph{HW-p1-a0_5-b0_001}\\
730 \addgraph{HW-p1-a0_1-b0_001}
731 \end{frame}
733 \mode<article>{The smaller the alpha the slower the adaption. As the
734   prediction is now generally off by quite a bit, this causes the
735   confidence band to grow as well.}
737 \mode<article>{\newpage}
739 \begin{frame}{hw demo: beta}
740 \addgraph{HW-p1-a0_1-b0_001}\\
741 \addgraph{HW-p1-a0_1-b0_1}
742 \end{frame}
744 \mode<article>{The larger the beta the `heavier' the prediction
745   becomes.}
747 \begin{frame}{hw demo: period}
748 \addgraph{HW-p1-a0_5-b0_001}\\
749 \addgraph{HW-p48-a0_5-b0_001}
750 \end{frame}
752 \begin{frame}{hw demo: tuning}
753 \addgraph{HW-p48-a0_5-b0_001}\\
754 \addgraph{HW-p48-a0_2-b0_001}
755 \end{frame}
757 \begin{frame}{hw demo: tuning II}
758 \addgraph{HW-p48-a0_2-b0_001}\\
759 \addgraph{HW-p48-a0_03-b0_001}
760 \end{frame}
762 \begin{frame}{hw demo: tuning III}
763 \addgraph{HW-p48-a0_03-b0_001}\\
764 \addgraph{HW-p48-a0_03-b0_1}
765 \end{frame}
767 \newpage
769 \section{The *v Interfaces}
771 \begin{frame}{graphv script}
772 \lstinputlisting{ex/v-interfaces.pl}
773 \end{frame}
775 \begin{frame}{graphv output}
776 \lstinputlisting{ex/v-interfaces.txt}
777 \end{frame}
779 \mode<article>{The image key only shows up when the graph file name is '-'.}
781 \begin{frame}{v-interfaces}
782 \begin{itemize}
783 \item rrdtool info
784 \item rrdtool update\textbf{v}
785 \item rrdtool graph\textbf{v}
786 \end{itemize}
787 \end{frame}
789 \mode<article>{Using the output of updatev is much more efficient than
790 re-reading the rrd file after running normal update against them.}
792 \newpage  
793 \section{Real Live Example}
795 \mode<article>{The following example shows how to create a simple
796   traffic grapher with a shell script for data acquisition, and an
797   rrdcgi script to draw the graphs.}
799 \begin{frame}
800 \includegraphics[width=\textwidth]{traffic/codewalk}
801 \end{frame}
803 \begin{frame}[allowframebreaks]{data acquisition}
804 \lstinputlisting[language=bash]{traffic/ifbyteget.sh}
805 \end{frame}
807 \mode<article>{This little bash script polls the network traffic
808   counter from the linux proc tree and reformats it so that it can be
809   fed to rrdtool.}
811 \begin{frame}[allowframebreaks]{rrdcgi: scripting for the poor}
812 \lstinputlisting[language=xml]{traffic/index.cgi}
813 \end{frame}
815 \begin{frame}[allowframebreaks]{rrdcgi: include file function}
816 \lstinputlisting[language=xml]{traffic/graph.inc}
817 \end{frame}
819 \mode<article>{RRDtool's rrdcgi is a very simple scripting engine, that can pick
820   up pseudo xml elements from an html file and execute the
821   coresponding rrdtool commands. In this example we use environment
822   variables and an include file to save us from typing in the same
823   graph definition over and over again.}
825 \mode<presentation>{
826 \begin{frame}
827 \begin{center}
828 \Huge ?
829 \end{center}
830 \end{frame}
831 \begin{frame}
832 \begin{center}
833 Tobi Oetiker <tobi@oetiker.ch>
834 \end{center}
835 \end{frame}
838 \mode<article>{
839 \vspace{\stretch{1}}
840 Tobias Oetiker <tobi@oetiker.ch>
842 \end{document}
843 %%% Local Variables:
844 %%% TeX-master: "presentation.tex"
845 %%% mode: flyspell
846 %%% TeX-PDF-mode: t
847 %%% End: