Vous êtes ici :  » Jacquelin Charbonnel » ...

RRDTool ::Creator tutorial

You are at LAREMA server, the home site of the RRDTool ::Creator.

RRDTool ::Creator is a set of Perl modules to friendly create different kind of common Round Robin Databases. These common RRD are studied to get a graph of primary data point (PDP) for a hour, a day, a week, a month and a year (a graph of primary data point is a graph where each point is exactly a measured data value, without interpolation or aggregation). For these 5 cases, RRDTool ::Creator computes reasonable values for parameters definition, to simplify the life and to preserve the brain of the sysadmins.

So, shortly, with RRDTool ::Creator, it is simple to create these 5 common RRD.

The last release of this module and its documentation can be found at CPAN

Step 1

First, create an object. This object allows you to specify the definition of the RRD, and in final, creates for you an empty RRD on your disk.


$creator = new RRDTool::Creator::DayPDP(-step => "30mn") ;

- choose the type of the creator :

  • RRDTool ::Creator ::HourPDP, to create RRD with a default archive of primary points for an hour
  • RRDTool ::Creator ::DayPDP, to create RRD with a default archive of primary points for a day
  • RRDTool ::Creator ::WeekPDP, to create RRD with a default archive of primary points for a week
  • RRDTool ::Creator ::MonthPDP, to create RRD with a default archive of primary points for a month
  • RRDTool ::Creator ::QuarterPDP, to create RRD with a default archive of primary points for a quater
  • RRDTool ::Creator ::YearPDP, to create RRD with a default archive of primary points for a year

- choose the step, i.e. the period of acquisition (30mn for 30 minutes, for exemple)

Step 2

Then add one or more data sources in this object :


$creator->add_DS(
           -ds_name => "cpu"
           , -DST => "GAUGE"
           , -min => 0
           , -max => 100
           ) ;

specifying :

  • the name of this data source (for example "cpu")
  • the type of this data source (COUNTER, GAUGE, etc)
  • the interval of the possible values (min and max)

Step 3

A default archive is created on the RRD. The number of data kept in this archive depends of the step specified, according to the real type used. For example, if you used a step of 1 hour for a DayPDP, the default archive stores 24 data. If you want to graph the data on a longer period, you must add other archives (RRA). You do this with the add_RRA function :


$creator->add_RRA(-duration => "week") ;
$creator->add_RRA(-duration => "month") ;

With that, the RRD keeps also 24 data for a weekly representation, and 24 data for a monthly representation. So, the data must be consolidated, and you must specify how.

Step 4

The add function can add one or more consolidation functions in the RRD definition :


$creator->add(-CF => "AVERAGE") ;

With that, the data will be aggregate in the RRA, and only the average will be kept.

You can specify MAX, MIN or LAST to keep the max, min or last value of the set used for aggregation.


$creator->add(-CF => "MAX") ;

Last step

And now, you can create the database on the disk :


$creator->create(-filename => "/var/rrdtool/vmstat.rrd") ;

And now ?

- For complete examples, see examples.

- To learn more, consult the complete documentation

- To try, download and install the module