Code

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