RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The...

29
RRDtool RRDtool \aHr-aHr-´deE-t:ul\ n [E, fr. round robin database tool] :a system to store and display time-series data (i.e. utilized bandwidth, machine-room temperature, server load average). R. stores the data in a very compact way so that it will not expand over time, and presents it in useful graphs. Tobi Oetiker <[email protected]> Sponsors: AboveNet – www.above.net CAIDA – www.caida.org ETH Zurich – www.ethz.ch RRDtool NANOG Nr. 1

Transcript of RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The...

Page 1: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool

RRDtool \aHr-aHr-´deE-t:ul\ n[E, fr. round robin database tool]:a system to store and display time-series data (i.e. utilizedbandwidth, machine-room temperature, server load average).R. stores the data in a very compact way so that it will notexpand over time, and presents it in useful graphs.

Tobi Oetiker <[email protected]>

Sponsors:AboveNet – www.above.net

CAIDA – www.caida.orgETH Zurich – www.ethz.ch

RRDtool NANOG Nr. 1

Page 2: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Contents

• The Results

• The roots of RRDtool

• Design

• Implementation

• Programming with RRDtool

• Pre-Packaged solutions

• MRTG-3

• Future Work

RRDtool NANOG Nr. 2

Page 3: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Exhibit AVisualization of Data collected with CoralReef package, created with RRDtool.

RRDtool NANOG Nr. 3

Page 4: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Exhibit BThe same data but normalized to 100%, visualizing protocol distribution.

. . . and just in case: http://www.caida.org/Tools/CoralReef/

RRDtool NANOG Nr. 4

Page 5: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

MRTG - the roots of RRDtool

• 1995 creation of MRTG for a small site

• constant size log files

• growing popularity and thus many patches render code base difficult tomaintain

• performance problems in large installations

• lack of flexibility: only two values in graph, integer log format, 5 minuteinterval, no concept of ’the unknown’

RRDtool NANOG Nr. 5

Page 6: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool Design

Take the Logging and Graphing from MRTG and make it Faster, Sliker, Bet-ter.

• end of 1997 start of RRDtool design

• full documentation

• floating point math

• *unknown* representation as “Not a Number”

• round robin logging for better performance

• flexible and powerful graphing

RRDtool NANOG Nr. 6

Page 7: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool Implementation

The following slides will talk about the implementation of RRDtool.

• how RRDtool logging works

• how to create graphs

• general points on the RRDtool syntax

• methods for accessing RRDtool from within your applications

RRDtool NANOG Nr. 7

Page 8: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool Logging

• round robin logging results in minimal data transfer

• fixed resolution logging with random data arrival

• storage of data at different resolutions in parallel

• on-the-fly data consolidation

The next slides will explain these topics in more detail so hang on!

RRDtool NANOG Nr. 8

Page 9: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Round Robin Storage

RRD with 3 RRAs

NOW

NOW

NOW

1 day ago

2 days ago

1 hour ago

2 hours ago

3 hours ago

4 hous ago

5 minutes ago

10 minutes ago

Latest Entry Ptr Latest Entry Ptr Latest Entry Ptr

5 Minute RRA 1 hour RRA 1 day RRA

Temporary Data Storage

RRDtool NANOG Nr. 9

Page 10: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Database Setup

Definition of an RRD Date Source (DS). The definition determines how thedata-binning is performed:

DS: name: COUNTER| GAUGE| ABSOLUTE: heart-beat : min : max

Definition of a Round Robin Archive (RRA) which receives its data by ag-gregating a number of re-binned input values using a Consolitation Function(CF). If less than part of the input values are known, the result will be *UN-KNOWN*. The results are stored in a rotary buffer of length :

RRA: AVERAGE| MIN| MAX: part : number : length

RRDtool NANOG Nr. 10

Page 11: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Data Input “Data Re-Binning”

300s 300s

1

3

2280koctets

400s

Data Aquisition

700 octets/sec

300s 300s

Data Storage

RRDtool NANOG Nr. 11

Page 12: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Data Consolidation

AVERAGE RRA with 3 PDP

AVERAGE RRA with 2 PDP

RRA with 1 PDP

RRDtool NANOG Nr. 12

Page 13: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Data Consolidation Methods

RRA with 1 PDP resolution

MAX RRA with 2 PDP resolution

MIN RRA with 2 PDP resolution

RRDtool NANOG Nr. 13

Page 14: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Graphing

• use data from any number of RRDs

• line, area and stack charts

• perform powerful RPN math on data before graphing it

RRDtool NANOG Nr. 14

Page 15: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Chart Type Demo

RRDtool NANOG Nr. 15

Page 16: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RPN math

Pick a data source (octet counter):DEF:a=file.rrd:incoming:AVERAGE

Modify the data: (People want to see bits while we get Octets from the router)CDEF:b=a,8,*

Plot the data: (#ff0000 is the hex-triple representation for the color red)AREA:b#ff0000:Incoming

RRDtool NANOG Nr. 16

Page 17: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool Syntax

• many simple functions

• each one does its own argument evaluation

• functions do not exit or output

• caller has to deal with return values

• full documentation is available as pod, man, txt and html

rrdtool function arguments ...

RRDtool NANOG Nr. 17

Page 18: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Using RRDtool

• stand-alone: command line or pipe

• perl-module: accessing stand-alone or using a shared module

• RRDtool can be compiled as a shared library

• bindings for python and tcl being developed by contributors

• rrdcgi for web pages

Regardless of the language you are using RRDtool from, the syntax is alwaysthe same apart from requirements of the language.

RRDtool NANOG Nr. 18

Page 19: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool functions I

Currently RRDtool has the following functions

create sets up a new Round Robin Database (RRD).

update stores new data values into an RRD.

graph creates a graph from data stored in one or several RRDs. Apart fromgenerating graphs, data can also be extracted to stdout.

dump dumps the contents of an RRD in plain ASCII. In connection with re-store you can use it to transport an RRD from one architecture to an-other.

continues on next slide . . .

RRDtool NANOG Nr. 19

Page 20: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool functions II

restore restores an RRD from XML format to a binary RRD.

fetch gets data for a certain time period from an RRD. The graph functionuses fetch to retrieve its data from an RRD

tune alters the configuration of an RRD

last finds last update time of an RRD

rrdresize changes the size of individual RRAs ... Dangerous!

RRDtool NANOG Nr. 20

Page 21: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Creating an RRDtool database

rrdtool create demo.rrd by default, RRDtool will align incoming data into 5 minute bins

--step=300 therefore this would not be necessary

DS:in:COUNTER:600:0:1.25e6 max update interval 600s

DS:out:COUNTER:600:0:1.25e6 min val 0, max val 1.25MB

RRA:AVERAGE:0.5:1:288 5 minute average for a day

RRA:AVERAGE:0.5:12:168 1 hour average for a week

RRA:MIN:0.5:12:168 1 hour minima for a week

RRA:MAX:0.5:12:168 1 hour maxima for a week

RRDtool NANOG Nr. 21

Page 22: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Updating an RRDtool database

rrdtool update demo.rrd--template in:out defines the order of values in the next argument

N:11222:1 ‘N’=now could be sec since 1970

RRDtool NANOG Nr. 22

Page 23: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Generating a Graph

rrdtool graph ouput.png--imgformat=PNG--lower-limit=0 makes the y axis start at 0

DEF:a=demo.rrd:in:AVERAGE ‘a’ gets data from the first RRA matching the resolution of thegraph and covering the required time-span

DEF:b=demo.rrd:in:MAX get data from an RRA with MAX consolidation

AREA:a#00ff00:Incoming a green AREA

LINE1:b#ff0000:"Max Incoming" a thin red line

RRDtool NANOG Nr. 23

Page 24: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Points to keep in mind

• RRDtool will make sure no garbage data goes into an RRD database.But in order to do so it must know what is sensible. Always specify MINand MAX boundaries when setting up a new RRD.

• Use version numbers in the use statement for the RRD’s perl module.This ensures you load the version of the module you expect to load.Module versions are in sync with RRDtool versions:

x.y.z = x.yyzzz1 (eg. 1.0.6 = 1.000061)

• Use --lower-limit if you want to make surethat the graph starts at 0.

RRDtool NANOG Nr. 24

Page 25: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDcgiCreating graphs is quite expensive, so why not do it on demand.

#!/usr/local/rrdtool-1.0.7/bin/rrdcgi<HTML><HEAD><TITLE>RRD CGI Demo</TITLE></HEAD><BODY><H1>Demo Graph</H1>

<P><RRD::GRAPHouput.png --imgformat=PNG --lower-limit=0 --lazyDEF:a=demo.rrd:in:AVERAGE DEF:b=demo.rrd:in:MAXAREA:a#00ff00:Incoming LINE1:b#ff0000:"Max In..."

></P>

</BODY></HTML>

RRDtool NANOG Nr. 25

Page 26: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

RRDtool Frontends

Why write your own Frontend when you can use someone else’s:

Cricket: by Jeff R. Allen of WebTV. Filesystem based hierarchicalconfiguration model. Dynamic graphing.http://www.munitions.com/˜jra/cricket/

Orca: by Blair Zajac of Yahoo!/GeoCities. Reads data from text files. Staticgraphing. http://www.geocities.com/˜bzking/

Remstats: by Thomas Erskine of CRC. Remote monitoring Agents. Alerts.http://www.crc.ca/˜terskine/remstats/

FlowScan: by Dave Plonka at University of Wisconsin. Bringing Cflowd andRRDtool together. [email protected]

MRTG-3: Sales pitch ahead . . .

RRDtool NANOG Nr. 26

Page 27: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

MRTG-3

• some code exists, but primarily in the concept stage.

• OO Perl module provides high-level functions for setting up your MRTG-3 Network monitor.

• Code instead of Configure.

• Datasources and Visualizations are defined in a tree structure. The treeknows how to handle the data. E.g. you Run the Data source treeand it gets new data from the different sources and updates the RRDsaccordingly.

• send mail to [email protected](subject: subscribe) if you are interested.

RRDtool NANOG Nr. 27

Page 28: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Future Work on RRDtool

Version numbers will follow linux concept: Even sub-versions for stable code,odd numbers for development versions.1.1.x will most likely break command line interface backward compatibility forcertain parts of RRDtool.

• even more flexibility for the graphing module (compat break)

• sub-second resolution for RRD files

• anti aliased graphs with TrueType font support

• complex data analysis functions like 95 percentile

• general conceptual review ... no prisoners

• full backward compatibility for data-format

RRDtool NANOG Nr. 28

Page 29: RRDtool - Meet us in Denver, CO for NANOG 73! · RRDtool NANOG Nr. 1. Contents The Results The roots of RRDtool Design Implementation ... RRDtool Implementation The following slides

Thanks!

Thanks to my Sponsors:

AboveNet – www.above.netCAIDA – www.caida.org

ETH Zurich – www.ethz.ch

http://www.caida.org/Tools/RRDtool

RRDtool NANOG Nr. 29