Difference between revisions of "RRDTool"

From vwiki
Jump to navigation Jump to search
m (→‎Create a Database: Corrected and annotated rrdtool create command)
m (Added some section headings)
Line 54: Line 54:
RRA:MAX:0.25:4320:366
RRA:MAX:0.25:4320:366
</pre>
</pre>
== Update Database ==
== Retrieve From Database ==

Revision as of 08:33, 21 January 2010

http://oss.oetiker.ch/rrdtool/index.en.html - RRDTool homepage

Getting Started

Create a Database

The following example creates a RRD database to hold an ESX's aggregated (average of all cores) CPU data with;

  • Raw data held for 12 hrs (realtime)
  • 5 min average (with max and min values) for 24 hrs (daily)
  • 20 min average (with max and min values) for 7 days (weekly)
  • 60 min average (with max and min values) for 31 days (monthly)
  • 1 day average (with max and min values) for 365 days (yearly)

In order to achieve the rolled-up averages, its necessary to calculate;

  • The number of raw data points required for that average (eg to be able to calculate a 5 min average)
  • The number of those averages to store (eg to be able to have a day's worth of 5 min average data)

Its also necessary to calculate how much raw data you want to store (if any)

  • Raw
    • Data is available every 20 secs
    • Therefore 3 intervals per min
    • Therefore 3 x 60 = 180 raw data points per hour
    • Therefore 12 x 180 = 2160 raw data points (to provide 12 hrs of data)
  • Daily
    • 5 min average = 5 x 60 / 20 = 15 raw data points in each average
    • 24 hr coverage = 24 x 60 = 1440 mins => 1440 / 5 = 288 averaged data points
  • Weekly
    • 20 min average = 20 x 60 / 20 = 60 raw data points in each average
    • 7 days coverage = 7 x 24 x 60 = 10,080 mins => 10,080 / 20 = 504 averaged data points
  • Monthly
    • 1 hr average = 60 x 60 / 20 = 180 raw data points in each average
    • 31 day coverage = 31 x 24 x 60 = 44,640 mins => 44,640 / 60 = 744 averaged data points
  • Yearly
    • 1 day average = 24 x 60 x 60 / 20 = 4,320 raw data points in each average
    • 366 day coverage = 366 x 24 x 60 = 527,040 mins = 527,040 / 24 x 60 = 366 averaged data points

The format of the create command is shown here http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html, for the above example this becomes

rrdtool create svr-cpu.rrd --step 20 \                    # Filename and raw data point interval
		DS:CPU-Aggregate:GAUGE:40:0:100 \         # The Datasource: name, type, max interval, min value, max value
		RRA:AVERAGE:0.5:1:2160 \                  # Raw data 'averaged' over 1 data point, ie raw data
		RRA:AVERAGE:0.25:15:288 \                 # Raw data averaged over 15 data points, 288 averages stored
		RRA:MIN:0.25:15:288 \                     # Minimum value of raw data over 15 data points, 288 mins stored
		RRA:MAX:0.25:15:288 \                     # Maximum value of raw data over 15 data points, 288 maxs stored
		RRA:AVERAGE:0.25:60:504 \
		RRA:MIN:0.25:60:504 \
		RRA:MAX:0.25:60:504 \
		RRA:AVERAGE:0.25:180:744 \
		RRA:MIN:0.25:180:744 \
		RRA:MAX:0.25:180:744 \
		RRA:AVERAGE:0.25:4320:366 \
		RRA:MIN:0.25:4320:366 \
		RRA:MAX:0.25:4320:366

Update Database

Retrieve From Database