Code

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