RRDtool
  1. RRDtool stores data; that makes it a back-end tool. The RRDtool command set allows the creation of graphs; that makes it a front-end tool as well.
  2. The size of an RRDtool database is determined at creation time. Imagine an RRDtool database as the perimeter of a circle. Data is added along the perimeter. When new data reaches the starting points, it overwrites existing data. This way, the size of an RRDtool database always remains constant.
  3. RRDtool can be configured to calculate the rate of change from the previous to the current value and store this information instead.
  4. RRDtool database is structured in such a way that it needs data at predefined time intervals. If it does not get a new value during the interval, it stores an UNKNOWN value for that interval. So, when using RRDtool database, it is imperative to use scripts that run at regular intervals to ensure a constant data flow to update the RRDtool database.

RRDtool is designed to store time series data. With every data update, an associated time stamp is stored. Time is always expressed in seconds passed since epoch.

The definition of an RRDtool database also includes a provision to specify specific actions to take in the absence of update values. Data Source (DS), heartbeat, Date Source Type (DST), Round Robin Archive (RRA), and Consolidation Function (CF) are some terminologies related to RRDtool database.

rrdtool create target.rrd --start 1023654125 --step 300     DS:mem:GAUGE:600:0:671744     RRA:AVERAGE:0.5:12:24    RRA:AVERAGE:0.5:288:31

This example creates a database named target.rrd. Start time is specified in number of seconds since epoch. While updating the database, the update time is also specified. This update time must be larger (later) than start time and must be in seconds since epoch.

The step of 300 seconds indicates that the database expects new values every 300 seconds. The script must be scheduled to run every step seconds so that it updates the database every step seconds.

Data Source (DS) is the actual variable which relates to the parameter on the device that is being monitored. Its syntax is:

DS:variable_name:DST:heartbeat:min:max

DS is a keyword. There can be as many DSs in the database as needed (you can have multiple columns). After every step interval, a new value of DS is supplied to update the database. This value is also called Primary Data Point (PDP).

Note: if you do not supply new datapoints exactly every 300 seconds, this is not a problem. RRDtool will interpolate the data accordingly.

Data Source Type (DST) defines the type of DS. It can be COUNTER, DERIVE, ABSOLUTE, GAUGE. A DS declared as COUNTER will save the rate of change of the value over a step period. This assumes that the value is always increasing (the difference between the current and previous value is greater than 0). Traffic counters on a router are an ideal candidate for using COUNTER as DST. DERIVE is the same as COUNTER, but it allows negative values as well. If you want to see the rate of change in free diskspace on your server, then you might want to use DERIVE data type. ABSOLUTE also saves the rate of change, but it assumes that the previous value is set to 0. The difference between the current and the previous value is always equal to the current value. Thus it just stores the current value divided by the step interval. GAUGE does not save the rate of change. It saves the actual value itself. Memory consumption in a server is a typical example of gauge.

The next parameter is heartbeat. In our example, heartbeat is 600 seconds. If the database does not get a new PDP within 300 seconds, it will wait another 300 seconds (total 600 seconds). If it does not receive any PDP within 600 seconds, it will save UNKNOWN value to the database.

The next parameters are the minimum and maximum value. If the variable to be stored has predictable maximum and minimum values, this should be specified here. Any update value that is out of this range will be stored as UNKNOWN.

Syntax for declaring RRA

RRA:CF:xff:step:rows

RRA is the keyword to declare RRAs. The consolidation function (CF) can be AVERAGE, MINIMUM, MAXIMUM, and LAST. The concept of the consolidated data point (CDP) comes into the picture here. A CDP is CFed (average, maximum / minimum value or last value) from step number of PDPs. This RRA will hold rows CDPs.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License