rrd

 

 


rrd 結構

 

The data is stored in a circular buffer based database,
thus the system storage footprint remains constant over time.

RRDtool assumes time-variable data in intervals of a certain length.
This interval, usually named step, is specified upon creation of a RRD file and cannot be changed afterwards.

The value for a specific step, that has been interpolated, is named a primary data point (PDP). Multiple PDPs may be consolidated according to a consolidation function (CF) to form a consolidated data point (CDP). Typical consolidation functions are average, minimum, maximum.

After the data has been consolidated, the resulting CDP is stored in a round-robin archive (RRA). A round-robin archive stores a fixed number of CDPs and specifies how many PDPs should be consolidated into one CDP and which CF to use. The total time covered by a RRA can be calculated as follows:

time covered = (#CDPs stored) x (#PDPs per CDP) x (step time length)

 


rrdtool

 

info

# localhost-load-load-g.rrd 是 munin 的 rrd 檔

rrdtool info localhost-swap-swap_out-d.rrd

filename = "localhost-load-load-g.rrd"
rrd_version = "0003"
step = 300
last_update = 1542081304
ds[42].type = "GAUGE"
ds[42].minimal_heartbeat = 600
ds[42].min = NaN
ds[42].max = NaN
ds[42].last_ds = "0.03"
ds[42].value = 1.2000000000e-01
ds[42].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 576
rra[0].cur_row = 429
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[1].cf = "MIN"
rra[1].rows = 576
rra[1].cur_row = 326
rra[1].pdp_per_row = 1
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = NaN
rra[1].cdp_prep[0].unknown_datapoints = 0
....

last_ds is the last received value of the DS, prior to calculation of Rate, at last_update time.

last_ds is different from value as it is before rate calculations and normalisation.

new_value = ( new_ds - last_ds ) / ( current_time - last_update )

dump

rrdtool dump localhost-load-load-g.rrd