Difference between revisions of "RRD"
Jump to navigation
Jump to search
(Created page with "Round Robin Databases by Toby Oetker [https://oss.oetiker.ch/rrdtool/] In the example below: ;start :First date in the database in epoch (seconds since January 1, 1970). date...") |
|||
Line 3: | Line 3: | ||
In the example below: | In the example below: | ||
;start | ;start | ||
− | :First date in the database in epoch (seconds since January 1, 1970). date +%s gives current epoch. | + | :First date in the database in [https://www.epochconverter.com/ epoch] (seconds since January 1, 1970). date +%s gives current epoch. |
;step | ;step | ||
:Expected rate data comes in in seconds | :Expected rate data comes in in seconds |
Latest revision as of 18:37, 17 January 2021
Round Robin Databases by Toby Oetker [1]
In the example below:
- start
- First date in the database in epoch (seconds since January 1, 1970). date +%s gives current epoch.
- step
- Expected rate data comes in in seconds
- DS:name:type:heartbeat:min:max
- Datasource, the raw data to store
- type; Most used are GAUGE (set of data) or COUNTER (always increasing data like from a smartmeter)
- heartbeat; Maximum time between two enty's. After this time a record with *UNKNOWN* values will be put in.
- min, max; Values outside this range will be recorded as *UNKNOWN*
- RRA:consolidatefunction:missing:steps:rows
- Round Robin Archive, how the raw data will be consolidated
- consolidatefunction; [AVERAGE,MIN,MAX,LAST] what to take from the raw data to store
- missing; The amount of allowed *UNKNOWN* records that still give a valid result (0,5 means half the data may be missing)
- steps; The number of raw data rows to consolidate
- rows; The amount of records to keep in the RRA
- What timespan is saved depends on the stepsize, the number of steps and the number of rows.
Example:
rrdtool create database.rrd \
--start 1 \
--step 10 \
DS:count1:COUNTER:60:0:999999999 \
DS:count2:COUNTER:60:0:999999999 \
DS:gauge1:GAUGE:60:0:1 \
DS:gauge2:GAUGE:60:0:99999 \
DS:count3:COUNTER:60:0:99999999 \
RRA:AVERAGE:0.5:1:60480 \ # One week of 10 seconds data
RRA:AVERAGE:0.5:6:44640 \ # 31 days of 1 minute data (consolidate 6 10sec records)
RRA:AVERAGE:0.5:8640:365 # 365 days of 1 day data (consolidate 8640 10sec records)
RRD's are used to generate graphs.
- start
- At what time the X-axis starts
- DEF:graphname=database.rrd:counter:consolidate
- What DS to display
- graphname; Name to refer to in other graph commands (like AREA)
- database.rrd:counter; DS to display
- consolidate; How to handle data if it needs to be consolidated before displaying it.
- type:graphname#008000:legend:STACK
- How to display the graph
- type; Common are LINE, AREA
- graphname#000000; Counter and color to display it in
- STACK; For subsequent AREA's, stack them instead of displaying over eachother.
Example:
rrdtool graph imagename.png --title "This is a nice graph" \
--width 800 \
--vertical-label aLabel \
--x-grid HOUR:1:HOUR:4:HOUR:1:0:%H \
--start now-1d \
--upper-limit 1 -r\
DEF:graphname1=database.rrd:counter1:AVERAGE \
DEF:graphname2=database.rrd:counter2:AVERAGE \
AREA:graphname1#FF0000:legend1 \
AREA:graphname2#008000:legend2:STACK