Decoding “rrdtool info”

Working with RRDTool again. I spent some time to make sense of what the command rrdtool info spits out. The easiest thing we can do is to go back to a command that creates a simple RRD file, then run rrdtool info on it, and see how the the two things map. …In my previous post about RRDTool I created a simple file using this syntax:

rrdtool create test.rrd 
  --start 1285605479 
  --step 10 
  DS:loadavg1m:GAUGE:20:0:U 
  DS:loadavg5m:GAUGE:20:0:U 
  DS:loadavg15m:GAUGE:20:0:U 
  RRA:AVERAGE:0.5:1:1500

If I run rrdtool info on the same file, I get this output:

filename = "test.rrd"
rrd_version = "0003"
step = 10
last_update = 1285620327
ds[loadavg1m].type = "GAUGE"
ds[loadavg1m].minimal_heartbeat = 20
ds[loadavg1m].min = 0,0000000000e+00
ds[loadavg1m].max = NaN
ds[loadavg1m].last_ds = "0.07"
ds[loadavg1m].value = 5,0000000000e-01
ds[loadavg1m].unknown_sec = 0
ds[loadavg5m].type = "GAUGE"
ds[loadavg5m].minimal_heartbeat = 20
ds[loadavg5m].min = 0,0000000000e+00
ds[loadavg5m].max = NaN
ds[loadavg5m].last_ds = "0.02"
ds[loadavg5m].value = 1,4000000000e-01
ds[loadavg5m].unknown_sec = 0
ds[loadavg15m].type = "GAUGE"
ds[loadavg15m].minimal_heartbeat = 20
ds[loadavg15m].min = 0,0000000000e+00
ds[loadavg15m].max = NaN
ds[loadavg15m].last_ds = "0.00"
ds[loadavg15m].value = 1,0000000000e-02
ds[loadavg15m].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 1500
rra[0].cur_row = 1268
rra[0].pdp_per_row = 1
rra[0].xff = 5,0000000000e-01
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[0].cdp_prep[2].value = NaN
rra[0].cdp_prep[2].unknown_datapoints = 0

As you can see:

  • --step maps to "step"
  • DS:something maps to a group of ds[something]
  • the datasource type (in this case GAUGE for all the three DSs) maps to ds[something].type
  • the heartbeat field (in this case 20 for all the three DSs) maps to ds[something].minimal_heartbeat
  • the minimum field (0 for all) maps to ds[something].min
  • the maximum field (U for all) maps to ds[something].max
  • the first (and only, in this case) RRA spec maps to rra[0]; in general, the N-th RRA spec will map to rra[N-1]
  • the consolidation function (AVERAGE) maps to rra[n].cf
  • the subsequent field maps to rra[n].xff (too long to explain, go to my previous post to find out)
  • the number of primary data points per row (in this case: 1) maps to rra[n].pdp_per_row
  • the number of primary data points in this archive (in this case: 1500) maps to rra[n].rows

Now that we have the map, let's look at a snippet of output of rrdtool info on a real file, and try to make sense of it:

. . .
step = 300
. . .
rra[1].cf = "AVERAGE"
rra[1].rows = 700
rra[1].cur_row = 694
rra[1].pdp_per_row = 6
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = 1.6155225397e+03
rra[1].cdp_prep[0].unknown_datapoints = 0

So, we have a primary data point each 5 minutes (step = 300); each data point in this archive is built using an average (rra[1].cf = "AVERAGE") of six PDP (rra[1].pdp_per_row = 6). Since we have one data point each 5 minutes, we are building one data point each 30 minutes (6 × 5). We save 700 data points (rra[1].rows = 700), which means that we collect 30 minutes × 700 = 350 hours of data, that is about two weeks. An aggregated point will be marked as NaN if at least 50% of the points are unknown (rra[1].xff = 5.0000000000e-01, that is 0.5, that is 50%).

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s