Code

initial
[rrdtool-all.git] / tutorial / ouce2013 / 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=100}
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[OUCE 2013] % (optional, should be abbreviation of conference name)
53 {OpenNMS User Conference 2013}
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 \begin{frame}{optimizing your rrds}
172 \begin{itemize}[<+-| alert@+>]
173 \item update of multi DS RRD is cheep
174 \item single update interval per RRD
175 \item RRD modification is expensive
176 \item RRD size and update performance are independent
177 \item RRA complexity affects update performance
178 \end{itemize}
179 \end{frame}
181 \mode<article>{As long as your system is small (a few hundred RRDs)
182   you should optimize for convenience. Only keep DSes together
183   in one RRD that are tightly bound. For everything else
184   create separate RRDs.}
186 \begin{frame}{fetching data}
187 fetch is for reading data from an rrd
188 \lstinputlisting[language=bash,firstline=8,lastline=9]{ex/catch-fetch.sh}
189 \begin{itemize}[<+-| alert@+>]
190 \item one RRA with two 300s entries
191 \item one RRA with three 600s entries
192 \end{itemize}
193 \end{frame}
195 \begin{frame}[fragile]{playing catch with fetch}
196 first pull 300 seconds
197 \begin{verbatim}
198 > rrdtool fetch x.rrd -r 300 \
199   -s 1200000600 -e 1200000900 AVERAGE
201 1200000900: 4.0000000000e+01
202 1200001200: 5.0000000000e+01
203 \end{verbatim}
205 then pull 900 seconds
206 \begin{verbatim}
207 > rrdtool fetch x.rrd -r300 \
208   -s 1200000000 -e 1200000900 AVERAGE
210 1200000600: 2.5000000000e+01
211 1200001200: 4.5000000000e+01
212 \end{verbatim}
213 \end{frame}
215 \begin{frame}{fetch recap}
216 \begin{itemize}[<+-| alert@+>]
217 \item looking for complete coverage
218 \item resolution is only a suggestion
219 \item time stamp in output marks the END of the period
220 \item end-time differences caused problems
221 \item since 1.3, only the start-time is relevant for coverage
222 \item outside the rra everything is NaN
223 \end{itemize}
224 \end{frame}
226 \mode<article>{\newpage}
228 \section{Graphing}
229 \begin{frame}[fragile]{rrdgraph syntax 101}
230 for graph command syntax, there are two basic rules:\pause
231 \begin{enumerate}
232 \item \texttt{-{}-options} start with a double dash\pause
233 \item graphing instructions start with a letter
234 \end{enumerate}
236 \pause
237 \begin{center}
238 \renewcommand{\tabcolsep}{0.4cm}
239 \renewcommand{\arraystretch}{2}
241 \begin{tabular}{|l|}\hline
242 \begin{minipage}[t]{0.7\textwidth}
243 \begin{alltt}
244 rrdtool graph \textit{output}
245    DEF:var=\textit{rrd}:\textit{DS}:\textit{AVARAGE}
246    LINE:var#\textit{hex-rgb-color}:Comment
248 \end{alltt}
249 \end{minipage}\\\hline
250 \end{tabular}
251 \end{center}
253 \texttt{DEF} and \texttt{LINE} are \emph{graphing instructions}.
254 \end{frame}
256 \mode<article>{The rrd graph command is the most versatile of all rrdtool
257   commands. It comes with its own little language, optimized for
258   drawing graphs. There are two kinds of arguments. The options
259   which start with a double-dash and the graphing instructions that
260   start with an uppercase letter.}
262 \begin{frame}{normal line}
263 \addgraph{LINE}
264 \end{frame}
266 \begin{frame}{lower limit}
267 \addgraph{LINE-lower}
268 \end{frame}
270 \mode<article>{Unless you are a banker and are you drawing stock diagrams,
271   make sure your graph displays the zero-y-value. Otherwise it is
272   pretty difficult to judge the meaning of the graph since perspective
273   is limited to the numbers on the y-axis.}
275 \begin{frame}{slope mode}
276 \addgraph{LINE-slope}
277 \end{frame}
279 \mode<article>{RRD graphs are pretty blocky. This is on purpose, since
280   the data is blocky too. The slope mode is a little concession. It
281   tilts the vertical connections between the 'blocks' by one pixel.}
283 \begin{frame}{anti-anti-aliasing: graph}
284 \addgraph{LINE-graph-mono}
285 \end{frame}
287 \begin{frame}{anti-anti-aliasing: font}
288 \addgraph{LINE-font-mono}
289 \end{frame}
291 \mode<article>{\newpage}
292 \begin{frame}{line width}
293 \addgraph{LINE-width}
294 \end{frame}
296 \begin{frame}{dashed line}
297 \addgraph{LINE-dash}
298 \end{frame}
300 \mode<article>{The numbers are an ON-OFF-ON-OFF-\ldots pattern. The
301   \texttt{dash-offset} property lets you shift the dashing of the line
302   to the right.}
304 \mode<article>{\newpage}
306 \begin{frame}{DEF with :step}
307 \addgraph{DEF-step}
308 \end{frame}
311 \begin{frame}{DEF with :start}
312 \addgraph{DEF-start}
313 \end{frame}
314 \mode<article>{\newpage}
316 \begin{frame}{DEF with :reduce}
317 \addgraph{DEF-reduce}
318 \end{frame}
320 \begin{frame}{AREA simple}
321 \addgraph{AREA-simple}
322 \end{frame}
324 \mode<article>{\newpage}
325 \begin{frame}{two AREAs}
326 \addgraph{AREA-two}
327 \end{frame}
329 \begin{frame}{transparent AREA}
330 \addgraph{AREA-trans}
331 \end{frame}
333 \mode<article>{RRDtool creates real alpha transparency. You can set
334   the whole graph to be transparent by setting the 
335   graph CANVAS and BACKGROUND colors to transparent.}
337 \mode<article>{\newpage}
338 \begin{frame}{stacked AREA}
339 \addgraph{AREA-stack}
340 \end{frame}
342 \mode<article>{\newpage}
344 \begin{frame}{time shift}
345 \addgraph{SHIFT-simple}
346 \end{frame}
348 \begin{frame}{shifting with extra data}
349 \addgraph{SHIFT-startdef}
350 \end{frame}
352 \mode<article>{A normal \texttt{DEF} line requests exactly as much data as it
353 requires for drawing the graph. If you \texttt{SHIFT} the data, you
354 may want to adjust the data fetched accordingly.}
356 \mode<article>{\newpage}
357 \section{Revers Polish Notation (RPN) Math}
359 \mode<article>{RRDtool lets you apply math operations to the data
360   prior to showing it to the user. It uses RPN math for this. If you
361   ever owned a classic HP calculator, you may still remember how RPN
362   math works. For all the others there is a little example below,
363   that shows how to do a little addition in RPN.}
365 \begin{frame}[fragile]{RPN basics: Step 0}
366 $15+23=38$
367 \begin{alltt}
368             1: NAN
369             2: NAN
370             3: NAN
371 \end{alltt}
372 \end{frame}
373 \begin{frame}[fragile]{RPN basics: Step 1}
374 $\mathbf{15}+23=38$
375 \begin{alltt}
376 [15]        1: \textbf{15}
377             2: NAN
378             3: NAN
379 \end{alltt}
380 \end{frame}
381 \begin{frame}[fragile]{RPN basics: Step 2}
382 $15+\mathbf{23}=38$
383 \begin{alltt}
384 [23]        1: \textbf{23}
385             2: 15
386             3: NAN
387 \end{alltt}
388 \end{frame}
389 \begin{frame}[fragile]{RPN basics: Step 3}
390 $15\mathbf{+}23=38$
391 \begin{alltt}
392 [+]         1: \textbf{38}
393             2: NAN
394             3: NAN
395 \end{alltt}
396 \end{frame}
398 \newpage 
400 \begin{frame}{math in the graph (+)}
401 \addgraph{RPN-simple}
402 \end{frame}
404 \mode<article>{A simple addition. We add a fixed value to a data
405   source. Note that at least one data source must appear inside a CDEF
406   expression. The input to a CDEF expression can come from another
407   CDEF expression.}
409 \begin{frame}{simple gradient}
410 \addgraph{RPN-grad-a}
411 \end{frame}
413 \begin{frame}{the MAX function}
414 \addgraph{RPN-max}
415 \end{frame}
417 \mode<article>{The MAX function operates on two values. In this example
418   the input comes from two different data sources.}
420 \begin{frame}{the LIMIT function}
421 \addgraph{RPN-limit}
422 \end{frame}
424 \mode<article>{The \texttt{LIMIT} function will return UNKNOWN as soon
425   as the input value is outside the given range. UNKNOWN data does not
426   get drawn.}
428 \begin{frame}{the TREND function}
429 \addgraph{RPN-trend}
430 \end{frame}
432 \mode<article>{If a data source varies massively, the TREND function
433   lets you smooth away by building a moving average. By calculating
434   the average, the output gets shifted by the length of the TREND
435   calculation.}
437 \begin{frame}{the TREND with early start}
438 \addgraph{RPN-trend-start}
439 \end{frame}
441 \mode<article>{In the previous graph there was a bit of data missing
442   at the left border of the graph. This was because rrdgraph loads
443   exactly the amount of data that is required in the graph (yes same
444   story as before). By loading more data, we can provide the TREND
445   function with enough input, so that it can calculate the first few
446   pixels as well.}
448 \begin{frame}{the TREND and SHIFT}
449 \addgraph{RPN-trend-shift}
450 \end{frame}
452 \mode<article>{Another interesting option is to SHIFT the result of
453   the TREND calculation back in time, so that it matches with the
454   source data. This allows us to see more easily when there are
455   'outliners'}
457 \mode<article>{\newpage}
460 \begin{frame}{the IF function}
461 \addgraph{RPN-if}
462 \end{frame}
464 \mode<article>{The IF function requires three items on the stack. It
465   turns \texttt{a,b,c,IF} into \texttt{if a then b else c}. There is a
466   bunch  of operators that go along with the \texttt{IF}: \texttt{LT}
467   less, \texttt{LE} - less or equal, \texttt{EQ} - equal, \texttt{NE}
468   not equal, \texttt{GE} - greater or equal, \texttt{GT} - greater.}
470 \begin{frame}{horizontal gradient}
471 \addgraph{RPN-grad-b}
472 \end{frame}
475 \begin{frame}{about invisibility}
476 \addgraph{RPN-UNKN}
477 \end{frame}
479 \mode<article>{Unknown values are not drawn on the graph. Here we
480   use trick to only show the largest values.}
483 \begin{frame}{positional drawing count}
484 \addgraph{RPN-count}
485 \end{frame}
487 \mode<article>{If you are into bar charts, you might fake them with
488   this trick. COUNT, counts the values of the data set. We use this,
489   together with the modulo operator to suppress the drawing of every
490   third entry.}
492 \begin{frame}{access the previous value}
493 \addgraph{RPN-prev}
494 \end{frame}
496 \begin{frame}{positional drawing time}
497 \addgraph{RPN-time}
498 \end{frame}
500 \newpage
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}[<+-| alert@+>]
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}
572 \mode<article>{\newpage}
573 \section{Holt Winters Aberrant Behaviour Detection}
575 \begin{frame}{about alert generation}
576 \begin{itemize}[<+-| alert@+>]
577 \item when something unexpected happens send an alert
578 \item fixed thresholds are too wide a net
579 \item moving averages weigh all data equal
580 \item holt winters can predict the future
581 \item and no one considers himself clever enough to use it
582 \end{itemize}
583 \end{frame}
585 \begin{frame}{rrd - holt winters assumptions}
586 \begin{itemize}[<+-| alert@+>]
587 \item data is periodic in nature
588 \item data has continuity 
589 \item data continuity is periodic
590 \item recent data is more important
591 \end{itemize}
592 \end{frame}
594 \begin{frame}{holt winters aberrant behavior}
595 \begin{itemize}[<+-| alert@+>]
596 \item prediction of future value and confidence band
597 \item confidence band is like a standard deviation
598 \item real value compared to predicted value +/- confidence band
599 \end{itemize}
600 \end{frame}
602 \mode<article>{With holt winters RRDtool will calculate a prediction
603   and a confidence band (think of it as a standard deviation) for the
604   current value. It will then compare the prediction with the
605   actual value. If the actual value falls outside the confidence band
606   of the predicted value (or some multiple of it), then a confidence
607   band violation is registered. If multiple violations are registered
608   within a configurable interval, RRDtool logs a failure.}
610 \begin{frame}<presentation>{holt winters configuration}
611 \begin{itemize}[<+-| alert@+>]
612 \item HWPREDICT for starters
613 \item tweaking required
614 \item know the knobs to turn
615 \item use real data to test
616 \item FAILURES very short
617 \item \texttt{rrdtool tune} and \texttt{resize}
618 \end{itemize}
619 \end{frame}
621 \mode<article>{
622 \begin{itemize}[<+-| alert@+>]
623 \item Keep it simple, go for HWPREDICT only when you start using
624   holt winters in RRDtool.
625 \item Every data set is different, tweaking is required. 
626 \item Know which knobs to turn.
627 \item Use real data when experimenting.
628 \item Use \texttt{rrdtool tune} and \texttt{rrdtool resize} to tweak settings.
629 \item The FAILURES RRA is short!
630 \end{itemize}
633 \begin{frame}{holt winters parameters}
634 \texttt{RRA:HWPREDICT:}\emph{rows}\texttt{:}\emph{alpha}\texttt{:}\emph{beta}\texttt{:}\emph{period}
636 \begin{description}
637 \item[\emph{alpha}:] adaption rate of the baseline (1 fast, 0 slow)
638 \item[\emph{beta}:] adaption rate of the slope (1 fast, 0 slow)
639 \item[\emph{period}:] how many steps in a period (use 1 to  disable)
640 \item[\emph{gamma}:] seasonal adaption rate of the baseline\\(alpha by
641   default)
642 \item[\emph{dev\_gamma}:] seasonal adaption rate of the confidence
643   band\\
644  (gamma by default)
645 \end{description}
647 the gamma and confidence band are tunable with \texttt{rrdtool tune}
648 \end{frame}
650 \mode<article>{
651 Reading \href{http://cricket.sourceforge.net/aberrant/lisa2000_paper.pdf}{Brutlag's original paper}
652 I wrote down the formulas he uses for calculating holt winters. This
653 helped me quite a lot in understanding the relationships between
654 alpha, beta, gamma and delta.}
656 \begin{frame}[fragile]{the rrdtool holt winters formula}
657 \begin{small}
658 \begin{alltt}
659 a - baseline (RRA CDP Parameter)
660 b - slope (RRA CDP Parameter)
661 c - seasonal (SEASONAL RRA)
662 d - deviation (DEVSEASONAL RRA)
663 pred - predicted value
664 real - real value\pause
666 pred\{next\} = a\{now\} + b\{now\} + c\{next_prev_period\}\pause
668 a\{now\} = alpha * (real\{now\} - c\{now_prev_period\}) 
669          + (1-alpha) * ( a\{prev\} + b\{prev\})\pause
670 b\{now\} = beta  * (a\{now\} - a\{prev\}) 
671          + (1-beta) * b_prev\pause
672 c\{now\} = gamma * (real\{now\} - a\{now\}) 
673          + (1-gamma) * c\{now_prev_period\}\pause
674 d\{now\} = dev_gamma * abs(real\{now\} - pred\{now\}) 
675          + (1-dev_gamma) * d\{now_prev_period\}\pause
677 \end{alltt}
678 \end{small}
679 \end{frame}
681 % must be formatted like that
682 % to break gobbling mode!
683 %\mode
684 %<all>
686 \begin{frame}{hw demo: the test data}
687 \addgraph{HW-input}
689 traffic at a peering point
690 \end{frame}
692 \begin{frame}[fragile]{drawing a hw graph}
693 \begin{lstlisting}[language=xml]
694 DEF:in=hw.rrd:in:AVERAGE
695 DEF:pred=hw.rrd:in:HWPREDICT
696 DEF:conf=hw.rrd:in:DEVPREDICT
697 DEF:fail=hw.rrd:in:FAILURES
698 TICK:fail#ff8:1:Failures
699 CDEF:lowconf=pred,conf,2,*,-
700 LINE1:lowconf
701 CDEF:confwidth=conf,4,*
702 AREA:confwidth#cfc:Band:STACK
703 LINE0.1:0#3a1::STACK
704 LINE0.1:lowconf#3a1
705 LINE1:in#c00:InOctets
706 LINE1:pred#0a0:Prediction
707 \end{lstlisting}
708 \end{frame}  
710 \mode<article>{For starters we set the period to 1. This disables HW's
711   ability to adjust to periodic behavior in the data but it lets us
712   better observe the effects of the different parameter settings since
713   the adjustment period is much shorter.}
715 \begin{frame}{hw demo: alpha}
716 \addgraph{HW-p1-a0_5-b0_001}\\
717 \addgraph{HW-p1-a0_1-b0_001}
718 \end{frame}
720 \mode<article>{The smaller the alpha the slower the adaption. As the
721   prediction is now generally off by quite a bit, this causes the
722   confidence band to grow as well.}
724 \mode<article>{\newpage}
726 \begin{frame}{hw demo: beta}
727 \addgraph{HW-p1-a0_1-b0_001}\\
728 \addgraph{HW-p1-a0_1-b0_1}
729 \end{frame}
731 \mode<article>{The larger the beta the `heavier' the prediction
732   becomes.}
734 \begin{frame}{hw demo: period}
735 \addgraph{HW-p1-a0_5-b0_001}\\
736 \addgraph{HW-p48-a0_5-b0_001}
737 \end{frame}
739 \begin{frame}{hw demo: tuning}
740 \addgraph{HW-p48-a0_5-b0_001}\\
741 \addgraph{HW-p48-a0_2-b0_001}
742 \end{frame}
744 \begin{frame}{hw demo: tuning II}
745 \addgraph{HW-p48-a0_2-b0_001}\\
746 \addgraph{HW-p48-a0_03-b0_001}
747 \end{frame}
749 \begin{frame}{hw demo: tuning III}
750 \addgraph{HW-p48-a0_03-b0_001}\\
751 \addgraph{HW-p48-a0_03-b0_1}
752 \end{frame}
754 \newpage
756 \section{The *v Interfaces}
758 \begin{frame}{graphv script}
759 \lstinputlisting{ex/v-interfaces.pl}
760 \end{frame}
762 \begin{frame}{graphv output}
763 \lstinputlisting{ex/v-interfaces.txt}
764 \end{frame}
766 \mode<article>{The image key only shows up when the graph file name is '-'.}
768 \begin{frame}{v-interfaces}
769 \begin{itemize}[<+-| alert@+>]
770 \item rrdtool info
771 \item rrdtool update\textbf{v}
772 \item rrdtool graph\textbf{v}
773 \end{itemize}
774 \end{frame}
776 \mode<article>{Using the output of updatev is much more efficient than
777 re-reading the rrd file after running normal update against them.}
779 \section{RRD Caching Daemon}
781 \begin{frame}{rrdcached --- pushing rrd performance}
782 \begin{itemize}[<+-| alert@+>]
783 \item i/o comes in 4k chunks
784 \item normal update is $\sim{}100$ bytes
785 \item grouping updates = performance for free
786 \item data in memory
787 \item journaling disaster recovery
788 \item simple integration using enviroment variables
789 \item communication via unix socket or ip
790 \item limited security for remote operation
791 \item no updatev support yet
792 \item available with 1.4
793 \end{itemize}
794 created by Florian Forster and Kevin Brintnall
795 \end{frame}
797 \section{Future}
799 \begin{frame}{Future RRDtool Features}
800 \begin{itemize}[<+-| alert@+>]
801 \item full remote support for rrdtool operations
802 \item getopt to popt migration for thread-safety
803 \item portable data format
804 \item in-memory updates for cached to support updatev
805 \item rrd internal journal for i/o optimization
806 \item separation of database and charting features
807 \item json interface and javascript charting frontend
808 \end{itemize}
810 \pause
811 Or anything else someone is willing\\
812 to provide time or money for.
813 \end{frame}
816 \section{Examples}
818 \begin{frame}{The size of an rrd - code}
819 \lstinputlisting{ex/rrd-size.pl}
820 \end{frame}
822 \begin{frame}{the size of an rrd - result}
823 \lstinputlisting{ex/rrd-size.txt}
824 \begin{itemize}[<+-| alert@+>]
825 \item overhead is minimal
826 \item 8 byte per double 
827 \item \ldots per datasource
828 \item \ldots per RRA
829 \item \ldots per RRA row
830 \end{itemize}
831 \end{frame}
833 \mode<article>{The rrd format is highly efficient at storing non
834   sparse data. The overhead for an extra RRA or DS is normally a few
835   bytes on top of the 8 byte per double.}
838 \newpage  
839 \section{Real Live Example}
841 \mode<article>{The following example shows how to create a simple
842   traffic grapher with a shell script for data acquisition, and an
843   rrdcgi script to draw the graphs.}
845 \begin{frame}
846 \includegraphics[width=\textwidth]{traffic/codewalk}
847 \end{frame}
849 \begin{frame}[allowframebreaks]{data acquisition}
850 \lstinputlisting[language=bash]{traffic/ifbyteget.sh}
851 \end{frame}
853 \mode<article>{This little bash script polls the network traffic
854   counter from the linux proc tree and reformats it so that it can be
855   fed to rrdtool.}
857 \begin{frame}[allowframebreaks]{rrdcgi: scripting for the poor}
858 \lstinputlisting[language=xml]{traffic/index.cgi}
859 \end{frame}
861 \begin{frame}[allowframebreaks]{rrdcgi: include file function}
862 \lstinputlisting[language=xml]{traffic/graph.inc}
863 \end{frame}
865 \mode<article>{RRDtool's rrdcgi is a very simple scripting engine, that can pick
866   up pseudo xml elements from an html file and execute the
867   coresponding rrdtool commands. In this example we use environment
868   variables and an include file to save us from typing in the same
869   graph definition over and over again.}
871 \mode<presentation>{
872 \begin{frame}
873 \begin{center}
874 \Huge ?
875 \end{center}
876 \end{frame}
877 \begin{frame}
878 \begin{center}
879 Tobi Oetiker <tobi@oetiker.ch>
880 \end{center}
881 \end{frame}
884 \mode<article>{
885 \vspace{\stretch{1}}
886 Tobias Oetiker <tobi@oetiker.ch>
888 \end{document}
889 %%% Local Variables:
890 %%% TeX-master: "presentation.tex"
891 %%% mode: flyspell
892 %%% TeX-PDF-mode: t
893 %%% End: