GenerationIP

Just for you

  • Increase font size
  • Default font size
  • Decrease font size
Home Documentation Howto rrdtool Round Robin Database Howto Version 1

rrdtool Round Robin Database Howto Version 1

E-mail Print PDF
User Rating: / 12
PoorBest 

Web Site : http://oss.oetiker.ch/rrdtool/
Type : Graph Generator
Operating System : LINUX,FREEBSD,UNIX,WINDOWS

 

If you know MRTG, you can think RRDtool is a clone of MRTGs graphing and logging features but RRDTOOL is more faster and more flexible than MRTG.

RRD is the Acronym for Round Robin Database. RRD is a system to store and display time-series data (network bandwidth, machine-room temperature, mysql queries,dns queries). You use it directly via a command line or in MRTG system.

This howto is base on the RRDTOOL documentation for RRDTOOL 1.0

 

Summary

 


How to install RRDTOOL

The rrd file is very small and in a binary format.

Show the pics to see exactly the operation of a Round Robin DATABASE.

 

	create : 	Create a new Round Robin DATABASE.
update : Update new data in Round Robin Database. cmd : rrdupdate = rrdtool update.
graph : Create a new graph from Round Robin Database.
dump : Export Round Robin database un plain text XML format.
restore : Create and restore Round Robin Database from a XML dump
fetch : Show the database by consolidation function
tune : Tunning the RRD after creation
last : Get last update in RRD
info : Display definition of the RRD
rrdresize : Alterate the size of each RRA.
xport : Generate XML dump from one or several RRD
rrdcgi : Can be use to create web pages containing RRD graphs based on templates

How to install RRDTOOL

Dependancy PERL,LIBTOOL

You must download the archive of the installation
File : http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/download.html
The last stable version is : RRDTOOL v1.0.50.


Download the file :
wget http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/rrdtool-1.0.49.tar.gz
You must extract all files in a directory.

tar -zxvf rrdtool-1.0.49.tar.gz
cd rrdtool-1.0.49
Installation of RRDTOOL

sh configure
make
make install

If you prefer to install RRDtool in some other place, use:

sh configure --prefix=/some/other/RRDtool-dir

Explication of installation options:

  • Configuration:
  •     
    -h, --help display this help and exit
    --help=short display options specific to this package
    --help=recursive display the short help of all the included packages
    -V, --version display version information and exit
    -q, --quiet, --silent do not print `checking...' messages
    --cache-file=FILE cache test results in FILE [disabled]
    -C, --config-cache alias for `--cache-file=config.cache'
    -n, --no-create do not create output files
    --srcdir=DIR find the sources in DIR [configure dir or `..']

    Installation directories:

    --prefix=PREFIX install architecture-independent files in PREFIX
    --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX]


    By default, `make install' will install all the files
    in `/usr/local/rrdtool-1.0.49/bin', `/usr/local/rrdtool-1.0.49/lib' etc.
    You can specify an installation prefix other than `/usr/local/rrdtool-1.0.49'
    using `--prefix', for instance `--prefix=$HOME'.
    For better control, use the options below.
    Fine tuning of the installation directories:

    --bindir=DIR user executables [EPREFIX/bin]
    --sbindir=DIR system admin executables [EPREFIX/sbin]
    --libexecdir=DIR program executables [EPREFIX/libexec]
    --datadir=DIR read-only architecture-independent data [PREFIX/share]
    --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
    --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
    --localstatedir=DIR modifiable single-machine data [PREFIX/var]
    --libdir=DIR object code libraries [EPREFIX/lib]
    --includedir=DIR C header files [PREFIX/include]
    -oldincludedir=DIR C header files for non-gcc [/usr/include]
    --infodir=DIR info documentation [PREFIX/info]
    --mandir=DIR man documentation [PREFIX/man]

    Program names:
    --program-prefix=PREFIX prepend PREFIX to installed program names
    --program-suffix=SUFFIX append SUFFIX to installed program names
    --program-transform-name=PROGRAM run sed PROGRAM on installed program names

    System types:
    --build=BUILD configure for building on BUILD [guessed]
    --host=HOST cross-compile to build programs to run on HOST [BUILD]
    --target=TARGET configure for building compilers for TARGET [HOST]

    Optional Features:

    --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
    --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
    --enable-shared[=PKGS] build shared libraries [default=no]
    --enable-static[=PKGS] build static libraries [default=yes]
    --enable-fast-install[=PKGS] optimize for fast installation [default=yes]
    --disable-dependency-tracking Speeds up one-time builds
    --enable-dependency-tracking Do not reject slow dependency extractors
    --disable-libtool-lock avoid locking (might break parallel builds)
    --enable-local-libpng Use OS's libpng instead of v1.0.9 with rrdtool
    -enable-local-zlib Use OS's zlib instead of v1.1.4 with rrdtool
    --enable-latin2 use ISO-8859-2 fonts

    Optional Packages:

    --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
    --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
    --with-gnu-ld assume the C compiler uses GNU ld [default=no]
    --with-pic try to use only PIC/non-PIC objects [default=use both]
    --with-tags[=TAGS] include additional configurations [automatic]
    --with-tcllib=DIR location of the tclConfig.sh
    --with-perl-options=OPTIONS options to pass on command-line when generating Makefile
    from Makefile.PL


    Some influential environment variables:

    CC C compiler command
    CFLAGS C compiler flags
    LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
    nonstandard directory <lib dir>
    CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
    headers in a nonstandard directory <include dir>
    CPP C preprocessor
    CXX C++ compiler command
    CXXFLAGS C++ compiler flags
    CXXCPP C++ preprocessor
    F77 Fortran 77 compiler command
    FFLAGS Fortran 77 compiler flags



    Use these variables to override the choices made
    by `configure' or to help it to find libraries and programs with nonstandard
    names/locations.


    How to use RRDTOOL
    rrdtool create :

    Filename

    The filename of your Round ROBIN DATABASE.

    --start | -b start time (default: now - 10s)

    Specified the time in timestamp format. But when the file is createyou can
    update rrdtool file with a timestamp before the creation start time.

    --step|-s step (default: 300 seconds)

    Specifies the base interval time in seconds.

    DS:ds-name:DST:heartbeat:min:max

    ds-name is the name you will use to define the data source value from an RRD.
    A ds-name must be 1 to 19 characters long in the characters [a-zA-Z0-9_].

    Your have 4 formats of value for the RRD FILE : Counter, Gauge, Derive, ABSOLUTE

    Counter : Use this format with value of snmp MIB like traffic counter or
    packet number for a interface. This counter is running with 32bit
    and 64bit border.
    Gauge : Use this format for value like temperature, indicator of pressure.
    Derive : Use this format if you variation or delta between a moment and
    an another moment like the rate of of people entering or leaving a
    room and derive works exactly like COUNTER but without overflow checks.
    Absolute : Use this format when you count the number of mail after an alert.

    HEARTBEAT

    Is define the frequency between each update of value in the database but some time
    it is possible to have UNKNOWN value.

    MIN AND MAX are optional parameters witch define the range of your data source (DS).
    If your value is out of the range the value will be defined as UNKNOWN.
    If you don’t know exactly the range of you value you can set the MIN and MAX value with
    U for unknown.

    RRA:CF:xff:steps:rows

    RRA : Round Robin Archives
    In an RRD you can have one or more RRA and for each RRA you must specifies
    the consolidation function, the xfiles factor, the steps and the rows.

    The consolidation function are defined by : AVERAGE, MIN, MAX, LAST.
    When you specifed a RRA all data are treated with the consolidation function (CF).

    Xff : xfiles factor
    xff The xfiles factor defines what part of a consolidation interval may be made
    up from *UNKNOWN* data while the consolidated value is still regarded as known.

    steps defines how many of these primary data points are used to build a consolidated
    data point which then goes into the archive.

    rows defines how many generations of data values are kept in an RRA.

    Example :

    With this command line you can create a rrd file for a temperature sensor

    rrdtool create temperature.rrd --step 300 \
    DS:temp:GAUGE:600:-273:5000 \
    RRA:AVERAGE:0.5:1:1200 \
    RRA:MIN:0.5:12:2400 \
    RRA:MAX:0.5:12:2400 \
    RRA:AVERAGE:0.5:12:2400


    AVERAGE : 300 secondes * 1 * 1200 = 180000 secondes = 50 hours = 2 days
    MIN : 300 secondes * 12 * 2400 = 8640000 secondes = 2400 hours = 100 days
    MAX : 300 secondes * 12 * 2400 = 8640000 secondes = 2400 hours = 100 days
    AVERAGE : 300 secondes * 12 * 2400 = 8640000 secondes = 2400 hours = 100 days

    If you have to monitor an interface you can use this line it is the same configuration
    format of MRTG.

    rrdtool create traffic.rrd --step 300 \
    DS:input:ABSOLUTE:600:0:100000000 \
    DS:output:ABSOLUTE:600:0:100000000 \
    RRA:AVERAGE:0.5:1:600 \
    RRA:AVERAGE:0.5:6:700 \
    RRA:AVERAGE:0.5:24:775 \
    RRA:AVERAGE:0.5:288:797 \
    RRA:MIN:0.5:1:600 \
    RRA:MIN:0.5:6:700 \
    RRA:MIN:0.5:24:775 \
    RRA:MIN:0.5:288:797 \
    RRA:MAX:0.5:1:600 \
    RRA:MAX:0.5:6:700 \
    RRA:MAX:0.5:24:775 \
    RRA:MAX:0.5:288:797

    AVERAGE : 300 secondes * 1 * 600 = 360000 secondes = 50 hours = 2.1 days
    AVERAGE : 300 secondes * 6 * 700 = 1260000 secondes = 350 hours = 14.6 days
    AVERAGE : 300 secondes * 24 * 775 = 5580000 secondes = 1550 hours = 64.2 days
    AVERAGE : 300 secondes * 288 * 797 = 68860800 secondes = 19128 hours = 797 days
    rrdtool update :
    	filename

    The name of the RRD you want to update.

    --template|-t ds-name[:ds-name]...

    by default, the data was update in order of the DATA SOURCES (DS).
    ds-name is the name you will use to define the data source value from an RRD.
    A ds-name must be 1 to 19 characters long in the characters [a-zA-Z0-9_].

    N|timestamp:value[:value...]

    Temporal indicator : N = Now or timestamp
    Value : Data value ou U if you don't know the value

    Example :


    With this command line you can update a rrd file for a temperature sensor

    rrdtool update temperature.rrd N:25

    If you have to monitor an interface you can use this line to update database

    rrdtool update traffic.rrd N:valuein:valueout
    OR
    rrdtool update traffic.rrd --template output:input N:valueout :valuein

    rrdtool graph :
    	filename

    The name of the image to generate. You can choose in GIf or PNG format but i recommand PNG
    (best size and generate TIME).
    If you don't specified filename the image is not create.

    -s|--start seconds (default end-1day)

    Timestamp of the beginning of the graph.

    -e|--end seconds (default now)

    Timestamp of the end of the graph.


    -x|--x-grid x-axis grid and label (default autoconfigure)

    The x-axis label is quite complex to configure. So if you don't have very
    special needs, you can rely on the autoconfiguration to get this right.
    If you want no x-grid at all, use the magic setting none.
    The x-axis label and grid can be configured, using the following format:

    GTM:GST:MTM:MST:LTM:LST:LPR:LFM

    You have to configure three elements making up the x-axis labels and grid.
    The base grid (G??), the major grid (M??) and the labels (L??). The configuration
    is based on the idea that you first specify a well known amount of time (?TM) and
    then say how many times it has to pass between each grid line or label (?ST).
    For the label you have to define two additional items: The precision of the label
    in seconds (LPR) and the strftime format used to generate the text of the label (LFM).
    The ?TM elements must be one of the following keywords:

    SECOND, MINUTE, HOUR, DAY, WEEK, MONTH or YEAR.

    If you wanted a graph with a base grid every 10 minutes and a major one every hour,
    with labels every hour you would use the following x-axis definition.

    MINUTE:10:HOUR:1:HOUR:1:0:%X

    The precision in this example is 0 because the %X format is exact. If the
    label was the name of the day, we would have had a precision of 24 hours,
    because when you say something like 'Monday' you mean the whole day and not
    Monday morning 00:00. Thus the label should be positioned at noon. By defining a
    precision of 24 hours or rather 86400 seconds, you make sure that this happens.

    If you want to alter the generated text to another language, use the LC_TIME
    environment variable to set the locale you prefer prior to calling the graph
    function.

    -y|--y-grid grid step:label factor (default autoconfigure)

    Makes vertical grid lines appear at grid step interval. Every label factor *
    gridstep, a major grid line is printed, along with label showing the value of
    the grid line.

    If you want no y-grid at all set specify the magic word none.

    -Y|--alt-y-grid

    Place Y grid dynamically based on graph Y range. Algorithm ensures that you always
    have grid, that there are enough but not too many grid lines and the grid is metric.
    That is grid lines are placed every 1, 2, 5 or 10 units. (contributed by Sasha Mikheev)

    --no-minor

    Turn off the minor grid lines.

    -R|--alt-y-mrtg

    With this option, you use the same design of MRTG GRAPH

    -A|--alt-autoscale

    Adjust the range of the graph to have the best graph with the max and min value.

    -M|--alt-autoscale-max

    Adjust the range of the graph to have the best.

    -X|--units-exponent value (default autoconfigure)

    Use this option if you want a y axis with exponent grid.

    -L|--units-length value (default 9 characters)

    Width of caracters on the left side of the graph for y-axis values

    -v|--vertical-label text

    Specified the label on the left of graph.

    -w|--width pixels (default 400 pixel)

    Size of the width of the drawing graph in pixels and not the width size of the image.

    -h|--height pixels (default 100 pixel)

    Size of the height of the drawing graph in pixels and not the heigth size of the image

    -i|--interlaced (default: false)

    Use interlaced mode for gif picture.

    -f|--imginfo formatstring

    After the generation of the pics, you have all info about it.

    --imginfo '<IMG src="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="GRAPH">'

    -a|--imgformat GIF|PNG|GD (default: GIF)

    Specifed the format PNG or GD

    -B|--background value

    You could use image in (currently only) GD format for background.

    -O|--overlay value

    You could use image in (currently only) GD format as overlay.

    -U|--unit value

    You could use unit to be displayed on y axis.

    -z|--lazy (default: false)

    Only generate the graph, if the current gif is out of date or not existent.

    -u|--upper-limit value (default autoconfigure)

    Define the upper value of the graph but the upper value change if the max value is
    higher to the upper limit value.

    -l|--lower-limit value (default autoconfigure)

    Define the lower value of the graph but the upper value change if the max of
    absolute min value is higher to the lower limit value.

    -r|--rigid

    rigid boundaries mode. This option block the upper an lower limit

    -b|--base value

    If you want 1024bits = 1kbits and not 1000bits =1kbits

    -o|--logarithmic

    logarithmic y-axis scaling

    -c|--color COLORTAG#rrggbb (default colors)

    override the colors for the standard elements of the graph. The COLORTAG must
    be one of the following symbolic names:BACK ground, CANVAS, SHADEA left/top border,
    SHADEB right/bottom border, GRID, MGRID major grid, FONT, FRAME and axis of the
    graph or ARROW. This option can be called multiple times to set several colors.

    -g|--no-legend

    Generate the grph with no legend

    -j|--only-graph

    Generate only the graph

    -F|--force-rules-legend

    Force the generation of HRULE and VRULE legend even if those HRULE or VRULE will
    not be drawn because out of graph boundaries (mimics behaviour of pre 1.0.42 versions).

    -t|--title text (default no title)

    Ste the title of the graph

    -S|--step value (default automatic)

    By default rrdgraph calculates the width of one pixel in the time domain and tries to get
    data at that resolution from the RRD. With this switch you can override this behavior.
    If you want rrdgraph to get data at 1 hour resolution from the RRD, then you can set the
    step to 3600 seconds. Note, that a step smaller than 1 pixel will be silently ignored.


    DEF:vname=rrd:ds-name:CF
    Define virtual name for a data source. This name can then be used in the functions explained
    below. The DEF call automatically chooses an RRA which contains CF consolidated data in a
    resolution appropriate for the size of the graph to be drawn. Ideally this means that one
    data point from the RRA should be represented by one pixel in the graph. If the resolution
    of the RRA is higher than the resolution of the graph, the data in the RRA will be further
    consolidated according to the consolidation function (CF) chosen.

    CDEF:vname=rpn-expression
    Create a new virtual data source by evaluating a mathematical expression, specified in Reverse
    Polish Notation (RPN). If you have ever used a traditional HP calculator you already know RPN.
    The idea behind RPN notation is, that you have a stack and push your data onto this stack.
    When ever you execute an operation, it takes as many data values from the stack as needed.
    The pushing of data is implicit, so when ever you specify a number or a variable, it gets pushed
    automatically.

    If this is all a big load of incomprehensible words for you, maybe an example helps (a more
    complete explanation is given in [1]): The expression vname+3/2 becomes vname,3,2,/,+ in RPN.
    First the three values get pushed onto the stack (which now contains (the current value of)
    vname, a 3 and a 2). Then the / operator pops two values from the stack (3 and 2), divides
    the first argument by the second (3/2) and pushes the result (1.5) back onto the stack.
    Then the + operator pops two values (vname and 1.5) from the stack; both values are added up
    and the result gets pushes back onto the stack. In the end there is only one value left on
    the stack: The result of the expression.

    The rpn-expression in the CDEF function takes both, constant values as well as vname variables.
    The following operators can be used on these values:

    +, -, *, /, %
    pops two values from the stack applies the selected operator and pushes the result back onto
    the stack. The % operator stands for the modulo operation.

    SIN, COS, LOG, EXP, FLOOR, CEIL
    pops one value from the stack, applies the selected function and pushes the result back onto
    the stack.

    LT, LE, GT, GE, EQ
    pops two values from the stack, compares them according to the selected condition and pushes
    either 1 back onto the stack if the condition is true and 0 if the condition was not true.

    IF
    pops three values from the stack. If the last value is not 0, the second value will be pushed
    back onto the stack, otherwise the first value is pushed back.
    If the stack contains the values A, B, C, D, E are presently on the stack, the IF operator will
    pop the values E D and C of the stack. It will look at C and if it is not 0 it will push D back
    onto the stack, otherwise E will be sent back to the stack.


    MIN, MAX
    selects the min or max of the two top rrd values.

    LIMIT
    replaces the value with *UNKNOWN* if it is outside the limits specified by the two values above it
    on the rrd.

    CDEF:a=alpha,0,100,LIMIT

    DUP, EXC, POP
    These manipulate the value directly.
    DUP will duplicate the top of the stack, pushing the result back onto the stack.
    EXC will exchange the top two elements of the stack, and POP will pop off the top element of the
    stack.
    Having insufficient elements on the stack for these operations is an error.

    UN
    Pops one value off the stack, if it is *UNKNOWN*, 1 will be pushed back otherwise 0.

    UNKN
    Push an *UNKNOWN* value onto the stack.

    PREV
    Push *UNKNOWN* if its at the first value of a data set or otherwise the value of this CDEF at
    the previous time step. This allows you to perform calculations across the data.

    PREV(vname)
    Push *UNKNOWN* if its at the first value of the data set named vname or otherwise the value of
    the CDEF named vname at the previous time step. This allows you to perform complex calculations
    across the data.

    INF, NEGINF
    Push a positive or negative infinite (oo) value onto the stack. When drawing an infinite number
    it appears right at the top or bottom edge of the graph, depending whether you have a positive
    or negative infinite number.

    NOW
    Push the current (real world) time onto the stack.

    TIME
    Push the time the current sample was taken onto the stack. This is the number of non-skip seconds
    since 0:00:00 January 1, 1970.
    COMMENT:text
    Like GPRINT but the text is simply printed into the graph.

    HRULE:value#rrggbb[:legend]
    Draw a horizontal rule into the graph and optionally add a legend

    VRULE:time#rrggbb[:legend]
    Draw a vertical rule into the graph and optionally add a legend

    LINE{1|2|3}:vname[#rrggbb[:legend]]
    Plot for the requested data, using the color specified. Write a legend into the graph.
    The 3 possible keywords LINE1, LINE2, and LINE3 generate increasingly wide lines.
    If no color is defined, the drawing is done 'blind' this is useful in connection with
    the STACK function when you want to ADD the values of two data-sources without showing
    it in the graph.

    AREA:vname[#rrggbb[:legend]]
    Does the same as LINE?, but the area between 0 and the graph will be filled with the
    color specified.

    STACK:vname[#rrggbb[:legend]]
    Does the same as LINE?, but the graph gets stacked on top of the previous LINE?, AREA
    or STACK graph. Depending on the type of the previous graph, the STACK will be either
    a LINE? or an AREA. This obviously implies that the first STACK must be preceded by an
    AREA or LINE? -- you need something to stack something onto in the first place ;)

    Note, that when you STACK onto *UNKNOWN* data, RRDTool will not draw any graphics ...
    *UNKNOWN* is not zero ... if you want it to zero then you might want to use a CDEF argument
    with IF and UN functions to turn *UNKNOWN* into zero ...

    Example :

    Temperature:

    rrdtool graph temp.gif -s now-32h \
    --title="Temperature" \
    -w 600 -h 200 \
    --alt-autoscale-max \
    --lower-limit 0 \
    --vertical-label "Degrees" \
    DEF:temp=temperature.rrd:input:AVERAGE \
    VRULE:1120687200#EE00EE: \
    COMMENT:"Temperature : ""Maximum Minimum Moyenne Dernier\l" \
    GPRINT:temp:MAX:"IN %6.2lf %s\:" \
    GPRINT:temp:MIN:"%6.2lf %s\:" \
    GPRINT:temp:AVERAGE:"%6.2lf %s\:" \
    GPRINT:temp:LAST:"%6.2lf %s\:" \
    AREA:temp#00EE00:"Temp \l"


    TRAFFIC

    rrdtool graph traffic.gif -s now-32h \
    --title="Interface" \
    -w 600 -h 200 \
    --alt-autoscale-max \
    --lower-limit 0 \
    --vertical-label "BITS PER SECOND" \
    DEF:in=traffic.rrd:input:AVERAGE \
    DEF:out=traffic.rrd:output:AVERAGE \
    CDEF:inp=in,8,* \
    CDEF:outp=out,8,* \
    VRULE:1120687200#EE00EE: \
    COMMENT:"Debit seconde: ""Maximum Minimum Moyenne Dernier\l" \
    GPRINT:inp:MAX:"IN %6.2lf %s\:" \
    GPRINT:inp:MIN:"%6.2lf %s\:" \
    GPRINT:inp:AVERAGE:"%6.2lf %s\:" \
    GPRINT:inp:LAST:"%6.2lf %s\:" \
    AREA:inp#00EE00:"IN bps \l" \
    GPRINT:outp:MAX:"OUT %6.2lf %s\:" \
    GPRINT:outp:MIN:"%6.2lf %s\:" \
    GPRINT:outp:AVERAGE:"%6.2lf %s\:" \
    GPRINT:outp:LAST:"%6.2lf %s\:" \
    LINE1:outp#0000FF:"OUT bps " \
    HRULE:256000#FF0000:"Bandwidth \l"

    rrdtool fetch :
      	filename

    the name of the RRD you want to fetch the data from.

    CF

    Choose the consolidation (AVERAGE,MIN,MAX,LAST)

    --start|-s start (default end-1day)

    Start Timestamp

    --end|-e end (default now)

    End Timestamp


    Example :

    Temperature :

    rrdtool fetch temperature.rrd AVERAGE


    Traffic :

    rrdtool fetch traffic.rrd LAST
    OR
    rrdtool fetch traffic.rrd MAX

    rrdtool restore :
    	filename.xml

    The name of the XML you want to restore.

    filename.rrd

    The name of the RRD to restore.

    --range-check|-r

    Check if the exceed limites of datasource is correct.


    Example :

    Temprature :

    rrdtool restore temperature.xml temperature.rrd

    Traffic :

    rrdtool restore traffic.xml traffic.rrd -r

    rrdtool dump :
      filename.rrd

    The name of the RRD you want to dump.


    Example :

    Temprature :

    rrdtool dump temperature.rrd > temperature.xml

    Traffic :

    rrdtool dump traffic.rrd > traffic.xml

     


    Examples

    Temperature example :

    rrdtool create temperature.rrd --step 300 --start 1114098000 \
    DS:temp:GAUGE:600:-273:5000 \
    RRA:AVERAGE:0.5:1:1200 \
    RRA:MIN:0.5:12:2400 \
    RRA:MAX:0.5:12:2400 \
    RRA:AVERAGE:0.5:12:2400


    rrdtool update temperature.rrd 1114098300:0 1114098600:24 1114098900:19 \
    1114099200:-6 1114099500:-9 1114099800:6 \
    1114100100:17 1114100400:-3 1114100700:4 \
    1114101000:25 1114101300:4 1114101600:10 \
    1114101900:1 1114102200:3 1114102500:15 \
    1114102800:-3 1114103100:15 1114103400:9 \
    1114103700:1 1114104000:-6

    rrdtool fetch --start 1114098300 --end 1114104300 temperature.rrd AVERAGE

    Result :

    1114098300: 0.0000000000e+00
    1114098600: 2.4000000000e+01
    1114098900: 1.9000000000e+01
    1114099200: -6.0000000000e+00
    1114099500: -9.0000000000e+00
    1114099800: 6.0000000000e+00
    1114100100: 1.7000000000e+01
    1114100400: -3.0000000000e+00
    1114100700: 4.0000000000e+00
    1114101000: 2.5000000000e+01
    1114101300: 4.0000000000e+00
    1114101600: 1.0000000000e+01
    1114101900: 1.0000000000e+00
    1114102200: 3.0000000000e+00
    1114102500: 1.5000000000e+01
    1114102800: -3.0000000000e+00
    1114103100: 1.5000000000e+01
    1114103400: 9.0000000000e+00
    1114103700: 1.0000000000e+00
    1114104000: -6.0000000000e+00
    1114104300: nan


    rrdtool info temperature.rrd


    filename = "temperature.rrd"
    rrd_version = "0001"
    step = 300
    last_update = 1114104000
    ds[temp].type = "GAUGE"
    ds[temp].minimal_heartbeat = 600
    ds[temp].min = -2.7300000000e+02
    ds[temp].max = 5.0000000000e+03
    ds[temp].last_ds = "UNKN"
    ds[temp].value = -0.0000000000e+00
    ds[temp].unknown_sec = 0
    rra[0].cf = "AVERAGE"
    rra[0].rows = 1200
    rra[0].pdp_per_row = 1
    rra[0].xff = 5.0000000000e-01
    rra[0].cdp_prep[0].value = NaN
    rra[0].cdp_prep[0].unknown_datapoints = 0
    rra[1].cf = "MIN"
    rra[1].rows = 2400
    rra[1].pdp_per_row = 12
    rra[1].xff = 5.0000000000e-01
    rra[1].cdp_prep[0].value = -6.0000000000e+00
    rra[1].cdp_prep[0].unknown_datapoints = 0
    rra[2].cf = "MAX"
    rra[2].rows = 2400
    rra[2].pdp_per_row = 12
    rra[2].xff = 5.0000000000e-01
    rra[2].cdp_prep[0].value = 1.5000000000e+01
    rra[2].cdp_prep[0].unknown_datapoints = 0
    rra[3].cf = "AVERAGE"
    rra[3].rows = 2400
    rra[3].pdp_per_row = 12
    rra[3].xff = 5.0000000000e-01
    rra[3].cdp_prep[0].value = 1.9000000000e+01
    rra[3].cdp_prep[0].unknown_datapoints = 0


    rrdtool graph temperature.gif --start 1114098300 --end 1114104300
    --title="Temperature"
    -w 600 -h 200
    --alt-autoscale-max
    --lower-limit 0
    --vertical-label "Temperature"
    DEF:in=temperature.rrd:ds:AVERAGE
    COMMENT:"Temperature en °C: "
    "Maximum Minimum Moyenne \l"
    GPRINT:in:MAX:"IN %6.2lf %s\:"
    GPRINT:in:MIN:"%6.2lf %s\:"
    GPRINT:in:AVERAGE:"%6.2lf %s\:"
    AREA:in#00EE00:"Temp °C \l"

    Result:






    Traffic example :
    rrdtool create traffic.rrd --step 300 \
    DS:input:ABSOLUTE:600:0:100000000 \
    DS:output:ABSOLUTE:600:0:100000000 \
    RRA:AVERAGE:0.5:1:600 \
    RRA:AVERAGE:0.5:6:700 \
    RRA:AVERAGE:0.5:24:775 \
    RRA:AVERAGE:0.5:288:797 \
    RRA:MIN:0.5:1:600 \
    RRA:MIN:0.5:6:700 \
    RRA:MIN:0.5:24:775 \
    RRA:MIN:0.5:288:797 \
    RRA:MAX:0.5:1:600 \
    RRA:MAX:0.5:6:700 \
    RRA:MAX:0.5:24:775 \
    RRA:MAX:0.5:288:797


    System script
    	apache.pl :	Print Apache Status
    mem.sh : Print use and free memory
    stat.pl : Print Process, Load, ... of the system
    checkdisk.sh : Print the space of disk
    monitor.php : Script with creation and update rrd file for all above script

    Convert script
    	mrtg2rrd.pl :	Convert Mrtg log to a rrd file.
    Last Updated on Saturday, 30 January 2010 22:29