1RRDCREATE(1)                        rrdtool                       RRDCREATE(1)
2
3
4

NAME

6       rrdcreate - Set up a new Round Robin Database
7

SYNOPSIS

9       rrdtool create filename [--start|-b start time] [--step|-s step]
10       [DS:ds-name:DST:dst arguments] [RRA:CF:cf arguments]
11

DESCRIPTION

13       The create function of RRDtool lets you set up new Round Robin Database
14       (RRD) files.  The file is created at its final, full size and filled
15       with *UNKNOWN* data.
16
17       filename
18           The name of the RRD you want to create. RRD files should end with
19           the extension .rrd. However, RRDtool will accept any filename.
20
21       --start|-b start time (default: now - 10s)
22           Specifies the time in seconds since 1970-01-01 UTC when the first
23           value should be added to the RRD. RRDtool will not accept any data
24           timed before or at the time specified.
25
26           See also AT-STYLE TIME SPECIFICATION section in the rrdfetch docu‐
27           mentation for other ways to specify time.
28
29       --step|-s step (default: 300 seconds)
30           Specifies the base interval in seconds with which data will be fed
31           into the RRD.
32
33       DS:ds-name:DST:dst arguments
34           A single RRD can accept input from several data sources (DS), for
35           example incoming and outgoing traffic on a specific communication
36           line. With the DS configuration option you must define some basic
37           properties of each data source you want to store in the RRD.
38
39           ds-name is the name you will use to reference this particular data
40           source from an RRD. A ds-name must be 1 to 19 characters long in
41           the characters [a-zA-Z0-9_].
42
43           DST defines the Data Source Type. The remaining arguments of a data
44           source entry depend on the data source type. For GAUGE, COUNTER,
45           DERIVE, and ABSOLUTE the format for a data source entry is:
46
47           DS:ds-name:GAUGE | COUNTER | DERIVE | ABSOLUTE:heartbeat:min:max
48
49           For COMPUTE data sources, the format is:
50
51           DS:ds-name:COMPUTE:rpn-expression
52
53           In order to decide which data source type to use, review the defi‐
54           nitions that follow. Also consult the section on "HOW TO MEASURE"
55           for further insight.
56
57           GAUGE
58               is for things like temperatures or number of people in a room
59               or the value of a RedHat share.
60
61           COUNTER
62               is for continuous incrementing counters like the ifInOctets
63               counter in a router. The COUNTER data source assumes that the
64               counter never decreases, except when a counter overflows.  The
65               update function takes the overflow into account.  The counter
66               is stored as a per-second rate. When the counter overflows,
67               RRDtool checks if the overflow happened at the 32bit or 64bit
68               border and acts accordingly by adding an appropriate value to
69               the result.
70
71           DERIVE
72               will store the derivative of the line going from the last to
73               the current value of the data source. This can be useful for
74               gauges, for example, to measure the rate of people entering or
75               leaving a room. Internally, derive works exactly like COUNTER
76               but without overflow checks. So if your counter does not reset
77               at 32 or 64 bit you might want to use DERIVE and combine it
78               with a MIN value of 0.
79
80               NOTE on COUNTER vs DERIVE
81
82               by Don Baarda <don.baarda@baesystems.com>
83
84               If you cannot tolerate ever mistaking the occasional counter
85               reset for a legitimate counter wrap, and would prefer
86               "Unknowns" for all legitimate counter wraps and resets, always
87               use DERIVE with min=0. Otherwise, using COUNTER with a suitable
88               max will return correct values for all legitimate counter
89               wraps, mark some counter resets as "Unknown", but can mistake
90               some counter resets for a legitimate counter wrap.
91
92               For a 5 minute step and 32-bit counter, the probability of mis‐
93               taking a counter reset for a legitimate wrap is arguably about
94               0.8% per 1Mbps of maximum bandwidth. Note that this equates to
95               80% for 100Mbps interfaces, so for high bandwidth interfaces
96               and a 32bit counter, DERIVE with min=0 is probably preferable.
97               If you are using a 64bit counter, just about any max setting
98               will eliminate the possibility of mistaking a reset for a
99               counter wrap.
100
101           ABSOLUTE
102               is for counters which get reset upon reading. This is used for
103               fast counters which tend to overflow. So instead of reading
104               them normally you reset them after every read to make sure you
105               have a maximum time available before the next overflow. Another
106               usage is for things you count like number of messages since the
107               last update.
108
109           COMPUTE
110               is for storing the result of a formula applied to other data
111               sources in the RRD. This data source is not supplied a value on
112               update, but rather its Primary Data Points (PDPs) are computed
113               from the PDPs of the data sources according to the rpn-expres‐
114               sion that defines the formula. Consolidation functions are then
115               applied normally to the PDPs of the COMPUTE data source (that
116               is the rpn-expression is only applied to generate PDPs). In
117               database software, such data sets are referred to as "virtual"
118               or "computed" columns.
119
120           heartbeat defines the maximum number of seconds that may pass
121           between two updates of this data source before the value of the
122           data source is assumed to be *UNKNOWN*.
123
124           min and max define the expected range values for data supplied by a
125           data source. If min and/or max any value outside the defined range
126           will be regarded as *UNKNOWN*. If you do not know or care about min
127           and max, set them to U for unknown. Note that min and max always
128           refer to the processed values of the DS. For a traffic-COUNTER type
129           DS this would be the maximum and minimum data-rate expected from
130           the device.
131
132           If information on minimal/maximal expected values is available,
133           always set the min and/or max properties. This will help RRDtool in
134           doing a simple sanity check on the data supplied when running
135           update.
136
137           rpn-expression defines the formula used to compute the PDPs of a
138           COMPUTE data source from other data sources in the same <RRD>. It
139           is similar to defining a CDEF argument for the graph command.
140           Please refer to that manual page for a list and description of RPN
141           operations supported. For COMPUTE data sources, the following RPN
142           operations are not supported: COUNT, PREV, TIME, and LTIME. In
143           addition, in defining the RPN expression, the COMPUTE data source
144           may only refer to the names of data source listed previously in the
145           create command. This is similar to the restriction that CDEFs must
146           refer only to DEFs and CDEFs previously defined in the same graph
147           command.
148
149       RRA:CF:cf arguments
150           The purpose of an RRD is to store data in the round robin archives
151           (RRA). An archive consists of a number of data values or statistics
152           for each of the defined data-sources (DS) and is defined with an
153           RRA line.
154
155           When data is entered into an RRD, it is first fit into time slots
156           of the length defined with the -s option, thus becoming a primary
157           data point.
158
159           The data is also processed with the consolidation function (CF) of
160           the archive. There are several consolidation functions that consol‐
161           idate primary data points via an aggregate function: AVERAGE, MIN,
162           MAX, LAST. The format of RRA line for these consolidation functions
163           is:
164
165           RRA:AVERAGE | MIN | MAX | LAST:xff:steps:rows
166
167           xff The xfiles factor defines what part of a consolidation interval
168           may be made up from *UNKNOWN* data while the consolidated value is
169           still regarded as known. It is given as the ratio of allowed
170           *UNKNOWN* PDPs to the number of PDPs in the interval. Thus, it
171           ranges from 0 to 1 (exclusive).
172
173           steps defines how many of these primary data points are used to
174           build a consolidated data point which then goes into the archive.
175
176           rows defines how many generations of data values are kept in an
177           RRA.
178

Aberrant Behavior Detection with Holt-Winters Forecasting

180       In addition to the aggregate functions, there are a set of specialized
181       functions that enable RRDtool to provide data smoothing (via the Holt-
182       Winters forecasting algorithm), confidence bands, and the flagging
183       aberrant behavior in the data source time series:
184
185       ·   RRA:HWPREDICT:rows:alpha:beta:seasonal period[:rra-num]
186
187       ·   RRA:SEASONAL:seasonal period:gamma:rra-num
188
189       ·   RRA:DEVSEASONAL:seasonal period:gamma:rra-num
190
191       ·   RRA:DEVPREDICT:rows:rra-num
192
193       ·   RRA:FAILURES:rows:threshold:window length:rra-num
194
195       These RRAs differ from the true consolidation functions in several
196       ways.  First, each of the RRAs is updated once for every primary data
197       point.  Second, these RRAs are interdependent. To generate real-time
198       confidence bounds, a matched set of HWPREDICT, SEASONAL, DEVSEASONAL,
199       and DEVPREDICT must exist. Generating smoothed values of the primary
200       data points requires both a HWPREDICT RRA and SEASONAL RRA. Aberrant
201       behavior detection requires FAILURES, HWPREDICT, DEVSEASONAL, and SEA‐
202       SONAL.
203
204       The actual predicted, or smoothed, values are stored in the HWPREDICT
205       RRA. The predicted deviations are stored in DEVPREDICT (think a stan‐
206       dard deviation which can be scaled to yield a confidence band). The
207       FAILURES RRA stores binary indicators. A 1 marks the indexed observa‐
208       tion as failure; that is, the number of confidence bounds violations in
209       the preceding window of observations met or exceeded a specified
210       threshold. An example of using these RRAs to graph confidence bounds
211       and failures appears in rrdgraph.
212
213       The SEASONAL and DEVSEASONAL RRAs store the seasonal coefficients for
214       the Holt-Winters forecasting algorithm and the seasonal deviations,
215       respectively.  There is one entry per observation time point in the
216       seasonal cycle. For example, if primary data points are generated every
217       five minutes and the seasonal cycle is 1 day, both SEASONAL and DEVSEA‐
218       SONAL will have 288 rows.
219
220       In order to simplify the creation for the novice user, in addition to
221       supporting explicit creation of the HWPREDICT, SEASONAL, DEVPREDICT,
222       DEVSEASONAL, and FAILURES RRAs, the RRDtool create command supports
223       implicit creation of the other four when HWPREDICT is specified alone
224       and the final argument rra-num is omitted.
225
226       rows specifies the length of the RRA prior to wrap around. Remember
227       that there is a one-to-one correspondence between primary data points
228       and entries in these RRAs. For the HWPREDICT CF, rows should be larger
229       than the seasonal period. If the DEVPREDICT RRA is implicitly created,
230       the default number of rows is the same as the HWPREDICT rows argument.
231       If the FAILURES RRA is implicitly created, rows will be set to the sea‐
232       sonal period argument of the HWPREDICT RRA. Of course, the RRDtool
233       resize command is available if these defaults are not sufficient and
234       the creator wishes to avoid explicit creations of the other specialized
235       function RRAs.
236
237       seasonal period specifies the number of primary data points in a sea‐
238       sonal cycle. If SEASONAL and DEVSEASONAL are implicitly created, this
239       argument for those RRAs is set automatically to the value specified by
240       HWPREDICT. If they are explicitly created, the creator should verify
241       that all three seasonal period arguments agree.
242
243       alpha is the adaption parameter of the intercept (or baseline) coeffi‐
244       cient in the Holt-Winters forecasting algorithm. See rrdtool for a
245       description of this algorithm. alpha must lie between 0 and 1. A value
246       closer to 1 means that more recent observations carry greater weight in
247       predicting the baseline component of the forecast. A value closer to 0
248       means that past history carries greater weight in predicting the base‐
249       line component.
250
251       beta is the adaption parameter of the slope (or linear trend) coeffi‐
252       cient in the Holt-Winters forecasting algorithm. beta must lie between
253       0 and 1 and plays the same role as alpha with respect to the predicted
254       linear trend.
255
256       gamma is the adaption parameter of the seasonal coefficients in the
257       Holt-Winters forecasting algorithm (HWPREDICT) or the adaption parame‐
258       ter in the exponential smoothing update of the seasonal deviations. It
259       must lie between 0 and 1. If the SEASONAL and DEVSEASONAL RRAs are cre‐
260       ated implicitly, they will both have the same value for gamma: the
261       value specified for the HWPREDICT alpha argument. Note that because
262       there is one seasonal coefficient (or deviation) for each time point
263       during the seasonal cycle, the adaptation rate is much slower than the
264       baseline. Each seasonal coefficient is only updated (or adapts) when
265       the observed value occurs at the offset in the seasonal cycle corre‐
266       sponding to that coefficient.
267
268       If SEASONAL and DEVSEASONAL RRAs are created explicitly, gamma need not
269       be the same for both. Note that gamma can also be changed via the RRD‐
270       tool tune command.
271
272       rra-num provides the links between related RRAs. If HWPREDICT is speci‐
273       fied alone and the other RRAs are created implicitly, then there is no
274       need to worry about this argument. If RRAs are created explicitly, then
275       carefully pay attention to this argument. For each RRA which includes
276       this argument, there is a dependency between that RRA and another RRA.
277       The rra-num argument is the 1-based index in the order of RRA creation
278       (that is, the order they appear in the create command). The dependent
279       RRA for each RRA requiring the rra-num argument is listed here:
280
281       ·   HWPREDICT rra-num is the index of the SEASONAL RRA.
282
283       ·   SEASONAL rra-num is the index of the HWPREDICT RRA.
284
285       ·   DEVPREDICT rra-num is the index of the DEVSEASONAL RRA.
286
287       ·   DEVSEASONAL rra-num is the index of the HWPREDICT RRA.
288
289       ·   FAILURES rra-num is the index of the DEVSEASONAL RRA.
290
291       threshold is the minimum number of violations (observed values outside
292       the confidence bounds) within a window that constitutes a failure. If
293       the FAILURES RRA is implicitly created, the default value is 7.
294
295       window length is the number of time points in the window. Specify an
296       integer greater than or equal to the threshold and less than or equal
297       to 28.  The time interval this window represents depends on the inter‐
298       val between primary data points. If the FAILURES RRA is implicitly cre‐
299       ated, the default value is 9.
300

The HEARTBEAT and the STEP

302       Here is an explanation by Don Baarda on the inner workings of RRDtool.
303       It may help you to sort out why all this *UNKNOWN* data is popping up
304       in your databases:
305
306       RRDtool gets fed samples at arbitrary times. From these it builds Pri‐
307       mary Data Points (PDPs) at exact times on every "step" interval. The
308       PDPs are then accumulated into RRAs.
309
310       The "heartbeat" defines the maximum acceptable interval between sam‐
311       ples. If the interval between samples is less than "heartbeat", then an
312       average rate is calculated and applied for that interval. If the inter‐
313       val between samples is longer than "heartbeat", then that entire inter‐
314       val is considered "unknown". Note that there are other things that can
315       make a sample interval "unknown", such as the rate exceeding limits, or
316       even an "unknown" input sample.
317
318       The known rates during a PDP's "step" interval are used to calculate an
319       average rate for that PDP. Also, if the total "unknown" time during the
320       "step" interval exceeds the "heartbeat", the entire PDP is marked as
321       "unknown". This means that a mixture of known and "unknown" sample
322       times in a single PDP "step" may or may not add up to enough "unknown"
323       time to exceed "heartbeat" and hence mark the whole PDP "unknown". So
324       "heartbeat" is not only the maximum acceptable interval between sam‐
325       ples, but also the maximum acceptable amount of "unknown" time per PDP
326       (obviously this is only significant if you have "heartbeat" less than
327       "step").
328
329       The "heartbeat" can be short (unusual) or long (typical) relative to
330       the "step" interval between PDPs. A short "heartbeat" means you require
331       multiple samples per PDP, and if you don't get them mark the PDP
332       unknown. A long heartbeat can span multiple "steps", which means it is
333       acceptable to have multiple PDPs calculated from a single sample. An
334       extreme example of this might be a "step" of 5 minutes and a "heart‐
335       beat" of one day, in which case a single sample every day will result
336       in all the PDPs for that entire day period being set to the same aver‐
337       age rate. -- Don Baarda <don.baarda@baesystems.com>
338
339              time|
340              axis|
341        begin__|00|
342               |01|
343              u|02|----* sample1, restart "hb"-timer
344              u|03|   /
345              u|04|  /
346              u|05| /
347              u|06|/     "hbt" expired
348              u|07|
349               |08|----* sample2, restart "hb"
350               |09|   /
351               |10|  /
352              u|11|----* sample3, restart "hb"
353              u|12|   /
354              u|13|  /
355        step1_u|14| /
356              u|15|/     "swt" expired
357              u|16|
358               |17|----* sample4, restart "hb", create "pdp" for step1 =
359               |18|   /  = unknown due to 10 "u" labled secs > "hb"
360               |19|  /
361               |20| /
362               |21|----* sample5, restart "hb"
363               |22|   /
364               |23|  /
365               |24|----* sample6, restart "hb"
366               |25|   /
367               |26|  /
368               |27|----* sample7, restart "hb"
369        step2__|28|   /
370               |22|  /
371               |23|----* sample8, restart "hb", create "pdp" for step1, create "cdp"
372               |24|   /
373               |25|  /
374
375       graphics by vladimir.lavrov@desy.de.
376

HOW TO MEASURE

378       Here are a few hints on how to measure:
379
380       Temperature
381           Usually you have some type of meter you can read to get the temper‐
382           ature.  The temperature is not really connected with a time. The
383           only connection is that the temperature reading happened at a cer‐
384           tain time. You can use the GAUGE data source type for this. RRDtool
385           will then record your reading together with the time.
386
387       Mail Messages
388           Assume you have a method to count the number of messages trans‐
389           ported by your mailserver in a certain amount of time, giving you
390           data like '5 messages in the last 65 seconds'. If you look at the
391           count of 5 like an ABSOLUTE data type you can simply update the RRD
392           with the number 5 and the end time of your monitoring period. RRD‐
393           tool will then record the number of messages per second. If at some
394           later stage you want to know the number of messages transported in
395           a day, you can get the average messages per second from RRDtool for
396           the day in question and multiply this number with the number of
397           seconds in a day. Because all math is run with Doubles, the preci‐
398           sion should be acceptable.
399
400       It's always a Rate
401           RRDtool stores rates in amount/second for COUNTER, DERIVE and ABSO‐
402           LUTE data.  When you plot the data, you will get on the y axis
403           amount/second which you might be tempted to convert to an absolute
404           amount by multiplying by the delta-time between the points. RRDtool
405           plots continuous data, and as such is not appropriate for plotting
406           absolute amounts as for example "total bytes" sent and received in
407           a router. What you probably want is plot rates that you can scale
408           to bytes/hour, for example, or plot absolute amounts with another
409           tool that draws bar-plots, where the delta-time is clear on the
410           plot for each point (such that when you read the graph you see for
411           example GB on the y axis, days on the x axis and one bar for each
412           day).
413

EXAMPLE

415        rrdtool create temperature.rrd --step 300 \
416         DS:temp:GAUGE:600:-273:5000 \
417         RRA:AVERAGE:0.5:1:1200 \
418         RRA:MIN:0.5:12:2400 \
419         RRA:MAX:0.5:12:2400 \
420         RRA:AVERAGE:0.5:12:2400
421
422       This sets up an RRD called temperature.rrd which accepts one tempera‐
423       ture value every 300 seconds. If no new data is supplied for more than
424       600 seconds, the temperature becomes *UNKNOWN*.  The minimum acceptable
425       value is -273 and the maximum is 5'000.
426
427       A few archive areas are also defined. The first stores the temperatures
428       supplied for 100 hours (1'200 * 300 seconds = 100 hours). The second
429       RRA stores the minimum temperature recorded over every hour (12 * 300
430       seconds = 1 hour), for 100 days (2'400 hours). The third and the fourth
431       RRA's do the same for the maximum and average temperature, respec‐
432       tively.
433

EXAMPLE 2

435        rrdtool create monitor.rrd --step 300        \
436          DS:ifOutOctets:COUNTER:1800:0:4294967295   \
437          RRA:AVERAGE:0.5:1:2016                     \
438          RRA:HWPREDICT:1440:0.1:0.0035:288
439
440       This example is a monitor of a router interface. The first RRA tracks
441       the traffic flow in octets; the second RRA generates the specialized
442       functions RRAs for aberrant behavior detection. Note that the rra-num
443       argument of HWPREDICT is missing, so the other RRAs will implicitly be
444       created with default parameter values. In this example, the forecasting
445       algorithm baseline adapts quickly; in fact the most recent one hour of
446       observations (each at 5 minute intervals) accounts for 75% of the base‐
447       line prediction. The linear trend forecast adapts much more slowly.
448       Observations made during the last day (at 288 observations per day)
449       account for only 65% of the predicted linear trend. Note: these compu‐
450       tations rely on an exponential smoothing formula described in the LISA
451       2000 paper.
452
453       The seasonal cycle is one day (288 data points at 300 second inter‐
454       vals), and the seasonal adaption parameter will be set to 0.1. The RRD
455       file will store 5 days (1'440 data points) of forecasts and deviation
456       predictions before wrap around. The file will store 1 day (a seasonal
457       cycle) of 0-1 indicators in the FAILURES RRA.
458
459       The same RRD file and RRAs are created with the following command,
460       which explicitly creates all specialized function RRAs.
461
462        rrdtool create monitor.rrd --step 300 \
463          DS:ifOutOctets:COUNTER:1800:0:4294967295 \
464          RRA:AVERAGE:0.5:1:2016 \
465          RRA:HWPREDICT:1440:0.1:0.0035:288:3 \
466          RRA:SEASONAL:288:0.1:2 \
467          RRA:DEVPREDICT:1440:5 \
468          RRA:DEVSEASONAL:288:0.1:2 \
469          RRA:FAILURES:288:7:9:5
470
471       Of course, explicit creation need not replicate implicit create, a num‐
472       ber of arguments could be changed.
473

EXAMPLE 3

475        rrdtool create proxy.rrd --step 300 \
476          DS:Total:DERIVE:1800:0:U  \
477          DS:Duration:DERIVE:1800:0:U  \
478          DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \
479          RRA:AVERAGE:0.5:1:2016
480
481       This example is monitoring the average request duration during each 300
482       sec interval for requests processed by a web proxy during the interval.
483       In this case, the proxy exposes two counters, the number of requests
484       processed since boot and the total cumulative duration of all processed
485       requests. Clearly these counters both have some rollover point, but
486       using the DERIVE data source also handles the reset that occurs when
487       the web proxy is stopped and restarted.
488
489       In the RRD, the first data source stores the requests per second rate
490       during the interval. The second data source stores the total duration
491       of all requests processed during the interval divided by 300. The COM‐
492       PUTE data source divides each PDP of the AccumDuration by the corre‐
493       sponding PDP of TotalRequests and stores the average request duration.
494       The remainder of the RPN expression handles the divide by zero case.
495

AUTHOR

497       Tobias Oetiker <tobi@oetiker.ch>
498
499
500
5011.2.27                            2008-02-17                      RRDCREATE(1)
Impressum