MRTG Implementation Manual
Table of Contents

 

6. Installing and configuring the RRD database support

6.1 Installing RRD database support

The installation steps are: 

1. Download the RRDTOOL package and unzip it to the chosen RRD folder. 
A free copy of RRDTOOL can be downloaded form http://www.rrdtool.com/download.html

2. The package contains the binary files and also the source files for development reference. The src\ folder contains four subfolders where some RRD tools are available in .exe format and they are usable as they are. Copy these files in the rrdtool\bin\ folder for an easier access. Include the rrdtool\bin in the system path. 

3. Register RRDTOOL package with the currently installed Perl distribution (at least Perl 5.6). Go to the “perl-shared” folder and run the following command: 

> ppm install rrds.ppd

RRDTOOL is now ready for use. Next step is to configure the MRTG instances to write SNMP data into the RRD databases. 

6.2 Configuring MRTG instances with RRD database support
 

The MRTG configuration steps are: 

1. Build the MRTG .cfg file for the monitored target using the CFGMAKER command as described in paragraph 3.1 

2. Update the .cfg file with the following configuration 
 
  


  

### Global Config Options 

Workdir: [rrdtool repository folder] 

PathAdd: [path to the rrdtool  “bin” folder]
LibAdd: [path to the rrdtool “perl-shared” folder] 
logformat: rrdtool 

RunAsDaemon: Yes 
Interval: 5 //SNMP read interval

6.3 Running MRTG instances with RRD database support

The MRTG instances with RRD database support can be ran in the same manner as the classic collect-and-graph instances. 

Run from the command prompt the following command: 

> perl mrtg [.cfg file]

Example: 

> perl d:\mrtg\bin\mrtg d:\mrtg\ubr-0302-rrdformat.cfg
 

MRTG will read the SNMP data at the specified interval and will add the values to the database instead of just updating the image-graphs. 

It is recommended to run these instances as NT/W2K Services (Windows version). 
Follow the instructions from paragraph 4.2 to register the instance as a service and run it in background. 
 

6.4 RRD Database structure
 

A RRD database consists of one or multiple Round Robin Archives (RRA), which stores the data for a specific frequency. 

The values stored in these RRAs are calculated based on one or multiple Data Sources (DS). A DS describes the monitored entity where the SNMP information is collected. 

The values stored in the RRAs are calculated using a consolidation function (CF). There are 3 CFs available: Average/Min/Max. 
MRTG automatically creates two DSs when stores the bandwidth information for a network interface: DS0 is the input traffic and DS1 is the output traffic. For other type of representations the DSs can be defined as needed. 

The below picture displays the RRD database generic structure: 


 
 

The following function displays the structure of a database: 

> rrdtool info [RRD database]

Database structure example, as shown by the above command: 
 
  


  

>rrdtool info 10.0.0.51_to3_0.rrd

filename = "10.0.0.51_to3_0.rrd" 
rrd_version = "0001" 
step = 300 
last_update = 1034865890 
ds[ds0].type = "COUNTER" 
ds[ds0].minimal_heartbeat = 600
ds[ds0].min = 0.0000000000e+000 
ds[ds0].max = 2.0000000000e+006 
ds[ds0].last_ds = "1160456235" 
ds[ds0].value = 9.5316330000e+005 
ds[ds0].unknown_sec = 0 
ds[ds1].type = "COUNTER" 
ds[ds1].minimal_heartbeat = 600 
ds[ds1].min = 0.0000000000e+000 
ds[ds1].max = 2.0000000000e+006 
ds[ds1].last_ds = "493517813" 
ds[ds1].value = 1.5046843333e+005 
ds[ds1].unknown_sec = 0 
rra[0].cf = "AVERAGE" 
rra[0].rows = 122944 
rra[0].pdp_per_row = 1 
rra[0].xff = 5.0000000000e-001 
rra[0].cdp_prep[0].value = NaN 
rra[0].cdp_prep[0].unknown_datapoints = 0 
rra[0].cdp_prep[1].value = NaN 
rra[0].cdp_prep[1].unknown_datapoints = 0 
rra[1].cf = "AVERAGE" 
rra[1].rows = 800 
rra[1].pdp_per_row = 6 
rra[1].xff = 5.0000000000e-001 
rra[1].cdp_prep[0].value = 7.2080766667e+003 
rra[1].cdp_prep[0].unknown_datapoints = 0 
rra[1].cdp_prep[1].value = 1.0866125556e+003 
rra[1].cdp_prep[1].unknown_datapoints = 0 
rra[2].cf = "AVERAGE" 
rra[2].rows = 800 
rra[2].pdp_per_row = 24 
rra[2].xff = 5.0000000000e-001 
rra[2].cdp_prep[0].value = 2.6916064814e+004 
rra[2].cdp_prep[0].unknown_datapoints = 0 
rra[2].cdp_prep[1].value = 4.1579679107e+003 
rra[2].cdp_prep[1].unknown_datapoints = 0

Note:
When you configure MRTG to run with the RRD database support, the MRTG instance creates 8 RRAs for a database. The first RRA[0] keeps the values corresponding to the configured read frequency (ex: 5min) and the next ones RRA[1] – RRA[7] store values that are automatically calculated for larger intervals (30min, 1hour, etc).
 

6.5 Resizing the database and extend it over a specific period of time
 

The MRTG instances first create the RRD databases with a standard size, which covers a short period of continuous data storage. 

To extend this period to a couple of months or years you need to resize the database to a number of records which corresponds to the desired period and read frequency. 

To resize a database use the following command: 

rrdtool resize [RRD database] [RRAx] GROW [# of records to increase]

Example: 

The following command expands a database for a period of 1 year with a 5min read frequency. 
There are 12 readings per hour x 24 hours x 31 days x 12 months = 107136 entries for a year. 

> rrdtool resize 10.0.0.1_fa0_0.rrd RRA[0] GROW 107136
 


<Next Chapter>