RRD

> Perfcounter (Performance Metrics) - (Operational|Machine) data

1 - About

RRDtool is a data logging and graphing system for performance data.

RRDtool refers to Round Robin Database tool. RRDtool works with Round Robin Databases (RRDs). It stores and retrieves data from them.

RRDtool originated from MRTG (Multi Router Traffic Grapher). MRTG started as a tiny little script for graphing the use of a university's connection to the Internet.

3 - Library and third party tool

Advertising

4 - Management

RRDtool lets you:

  • create a database,
  • store data in it,
  • retrieve that data
  • create graphs in PNG format

4.1 - Installation

4.2 - Create an RRD database

rrdtool create test.rrd             \
            --start 920804400      \
            DS:speed:COUNTER:600:U:U   \
            --step=300                 \
            RRA:AVERAGE:0.5:1:24       \
            RRA:AVERAGE:0.5:6:10

where:

  • test.rrd is the round robin database
  • –start define the start date with the epoch format. 920804400 means 920804400 seconds since 1 January 1970 which is 7th of March, 1999 at noon. The time stamp value is translated into local time and it will therefore look different for different time zones.
  • DS define one data source (DS) named “speed” that represents a counter.
  • –steps define a read every five minutes (300s). This is the default.
  • RRA define a round robin archives (s):
    • one averages the data every time it is read (e.g., there's nothing to average) and keeps 24 samples (24 times 5 minutes is 2 hours).
    • the other averages 6 values (half hour) and contains 10 such averages (e.g. 5 hours).
Advertising

4.3 - Update / Insert

Data to insert:

Time Data
12:05 12345
12:10 12357
12:15 12363

Syntax:

rrdtool update test.rrd 920804700:12345
rrdtool update test.rrd 920805000:12357
rrdtool update test.rrd 920805300:12363
# or with the batch mode
rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363

where:

4.4 - Get

rrdtool fetch test.rrd AVERAGE --start 920804700 --end 920805300
 920805000: 4.0000000000e-02
 920805300: 2.0000000000e-02
 920805600: nan  # Not A Number It can be also NAN, U or UNKN

4.5 - Graph

rrdtool graph speed.png                                 \
         --start 920804400 --end 920808000               \
         DEF:myspeed=test.rrd:speed:AVERAGE              \
         LINE2:myspeed#FF0000

where:

  • speed.png is the output file
  • –start and -end are the time range
  • DEF is a variable definition statement named myspeed that is equals to the RRA speed out of database test.rrd.
  • LINE define a line drawn with 2 pixels high, represents the variable myspeed, colored in #FF0000 red (hexadecimal rgb-representation)
Advertising

5 - Third Party Tool

Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database.

6 - Documentation / Reference

counter/rrd.txt · Last modified: 2018/09/22 11:16 by gerardnico