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

Aberrant Behavior Detection with Holt-Winters Forecasting

190       In addition to the aggregate functions, there are a set of specialized
191       functions that enable RRDtool to provide data smoothing (via the Holt-
192       Winters forecasting algorithm), confidence bands, and the flagging
193       aberrant behavior in the data source time series:
194
195       ·   RRA:HWPREDICT:rows:alpha:beta:seasonal period[:rra-num]
196
197       ·   RRA:MHWPREDICT:rows:alpha:beta:seasonal period[:rra-num]
198
199       ·   RRA:SEASONAL:seasonal period:gamma:rra-
200           num[:smoothing-window=fraction]
201
202       ·   RRA:DEVSEASONAL:seasonal period:gamma:rra-
203           num[:smoothing-window=fraction]
204
205       ·   RRA:DEVPREDICT:rows:rra-num
206
207       ·   RRA:FAILURES:rows:threshold:window length:rra-num
208
209       These RRAs differ from the true consolidation functions in several
210       ways.  First, each of the RRAs is updated once for every primary data
211       point.  Second, these RRAs are interdependent. To generate real-time
212       confidence bounds, a matched set of SEASONAL, DEVSEASONAL, DEVPREDICT,
213       and either HWPREDICT or MHWPREDICT must exist. Generating smoothed
214       values of the primary data points requires a SEASONAL RRA and either an
215       HWPREDICT or MHWPREDICT RRA. Aberrant behavior detection requires
216       FAILURES, DEVSEASONAL, SEASONAL, and either HWPREDICT or MHWPREDICT.
217
218       The predicted, or smoothed, values are stored in the HWPREDICT or
219       MHWPREDICT RRA. HWPREDICT and MHWPREDICT are actually two variations on
220       the Holt-Winters method. They are interchangeable. Both attempt to
221       decompose data into three components: a baseline, a trend, and a
222       seasonal coefficient.  HWPREDICT adds its seasonal coefficient to the
223       baseline to form a prediction, whereas MHWPREDICT multiplies its
224       seasonal coefficient by the baseline to form a prediction. The
225       difference is noticeable when the baseline changes significantly in the
226       course of a season; HWPREDICT will predict the seasonality to stay
227       constant as the baseline changes, but MHWPREDICT will predict the
228       seasonality to grow or shrink in proportion to the baseline. The proper
229       choice of method depends on the thing being modeled. For simplicity,
230       the rest of this discussion will refer to HWPREDICT, but MHWPREDICT may
231       be substituted in its place.
232
233       The predicted deviations are stored in DEVPREDICT (think a standard
234       deviation which can be scaled to yield a confidence band). The FAILURES
235       RRA stores binary indicators. A 1 marks the indexed observation as
236       failure; that is, the number of confidence bounds violations in the
237       preceding window of observations met or exceeded a specified threshold.
238       An example of using these RRAs to graph confidence bounds and failures
239       appears in rrdgraph.
240
241       The SEASONAL and DEVSEASONAL RRAs store the seasonal coefficients for
242       the Holt-Winters forecasting algorithm and the seasonal deviations,
243       respectively.  There is one entry per observation time point in the
244       seasonal cycle. For example, if primary data points are generated every
245       five minutes and the seasonal cycle is 1 day, both SEASONAL and
246       DEVSEASONAL will have 288 rows.
247
248       In order to simplify the creation for the novice user, in addition to
249       supporting explicit creation of the HWPREDICT, SEASONAL, DEVPREDICT,
250       DEVSEASONAL, and FAILURES RRAs, the RRDtool create command supports
251       implicit creation of the other four when HWPREDICT is specified alone
252       and the final argument rra-num is omitted.
253
254       rows specifies the length of the RRA prior to wrap around. Remember
255       that there is a one-to-one correspondence between primary data points
256       and entries in these RRAs. For the HWPREDICT CF, rows should be larger
257       than the seasonal period. If the DEVPREDICT RRA is implicitly created,
258       the default number of rows is the same as the HWPREDICT rows argument.
259       If the FAILURES RRA is implicitly created, rows will be set to the
260       seasonal period argument of the HWPREDICT RRA. Of course, the RRDtool
261       resize command is available if these defaults are not sufficient and
262       the creator wishes to avoid explicit creations of the other specialized
263       function RRAs.
264
265       seasonal period specifies the number of primary data points in a
266       seasonal cycle. If SEASONAL and DEVSEASONAL are implicitly created,
267       this argument for those RRAs is set automatically to the value
268       specified by HWPREDICT. If they are explicitly created, the creator
269       should verify that all three seasonal period arguments agree.
270
271       alpha is the adaption parameter of the intercept (or baseline)
272       coefficient in the Holt-Winters forecasting algorithm. See rrdtool for
273       a description of this algorithm. alpha must lie between 0 and 1. A
274       value closer to 1 means that more recent observations carry greater
275       weight in predicting the baseline component of the forecast. A value
276       closer to 0 means that past history carries greater weight in
277       predicting the baseline component.
278
279       beta is the adaption parameter of the slope (or linear trend)
280       coefficient in the Holt-Winters forecasting algorithm. beta must lie
281       between 0 and 1 and plays the same role as alpha with respect to the
282       predicted linear trend.
283
284       gamma is the adaption parameter of the seasonal coefficients in the
285       Holt-Winters forecasting algorithm (HWPREDICT) or the adaption
286       parameter in the exponential smoothing update of the seasonal
287       deviations. It must lie between 0 and 1. If the SEASONAL and
288       DEVSEASONAL RRAs are created implicitly, they will both have the same
289       value for gamma: the value specified for the HWPREDICT alpha argument.
290       Note that because there is one seasonal coefficient (or deviation) for
291       each time point during the seasonal cycle, the adaptation rate is much
292       slower than the baseline. Each seasonal coefficient is only updated (or
293       adapts) when the observed value occurs at the offset in the seasonal
294       cycle corresponding to that coefficient.
295
296       If SEASONAL and DEVSEASONAL RRAs are created explicitly, gamma need not
297       be the same for both. Note that gamma can also be changed via the
298       RRDtool tune command.
299
300       smoothing-window specifies the fraction of a season that should be
301       averaged around each point. By default, the value of smoothing-window
302       is 0.05, which means each value in SEASONAL and DEVSEASONAL will be
303       occasionally replaced by averaging it with its (seasonal period*0.05)
304       nearest neighbors.  Setting smoothing-window to zero will disable the
305       running-average smoother altogether.
306
307       rra-num provides the links between related RRAs. If HWPREDICT is
308       specified alone and the other RRAs are created implicitly, then there
309       is no need to worry about this argument. If RRAs are created
310       explicitly, then carefully pay attention to this argument. For each RRA
311       which includes this argument, there is a dependency between that RRA
312       and another RRA. The rra-num argument is the 1-based index in the order
313       of RRA creation (that is, the order they appear in the create command).
314       The dependent RRA for each RRA requiring the rra-num argument is listed
315       here:
316
317       ·   HWPREDICT rra-num is the index of the SEASONAL RRA.
318
319       ·   SEASONAL rra-num is the index of the HWPREDICT RRA.
320
321       ·   DEVPREDICT rra-num is the index of the DEVSEASONAL RRA.
322
323       ·   DEVSEASONAL rra-num is the index of the HWPREDICT RRA.
324
325       ·   FAILURES rra-num is the index of the DEVSEASONAL RRA.
326
327       threshold is the minimum number of violations (observed values outside
328       the confidence bounds) within a window that constitutes a failure. If
329       the FAILURES RRA is implicitly created, the default value is 7.
330
331       window length is the number of time points in the window. Specify an
332       integer greater than or equal to the threshold and less than or equal
333       to 28.  The time interval this window represents depends on the
334       interval between primary data points. If the FAILURES RRA is implicitly
335       created, the default value is 9.
336

The HEARTBEAT and the STEP

338       Here is an explanation by Don Baarda on the inner workings of RRDtool.
339       It may help you to sort out why all this *UNKNOWN* data is popping up
340       in your databases:
341
342       RRDtool gets fed samples/updates at arbitrary times. From these it
343       builds Primary Data Points (PDPs) on every "step" interval. The PDPs
344       are then accumulated into the RRAs.
345
346       The "heartbeat" defines the maximum acceptable interval between
347       samples/updates. If the interval between samples is less than
348       "heartbeat", then an average rate is calculated and applied for that
349       interval. If the interval between samples is longer than "heartbeat",
350       then that entire interval is considered "unknown". Note that there are
351       other things that can make a sample interval "unknown", such as the
352       rate exceeding limits, or a sample that was explicitly marked as
353       unknown.
354
355       The known rates during a PDP's "step" interval are used to calculate an
356       average rate for that PDP. If the total "unknown" time accounts for
357       more than half the "step", the entire PDP is marked as "unknown". This
358       means that a mixture of known and "unknown" sample times in a single
359       PDP "step" may or may not add up to enough "known" time to warrant a
360       known PDP.
361
362       The "heartbeat" can be short (unusual) or long (typical) relative to
363       the "step" interval between PDPs. A short "heartbeat" means you require
364       multiple samples per PDP, and if you don't get them mark the PDP
365       unknown. A long heartbeat can span multiple "steps", which means it is
366       acceptable to have multiple PDPs calculated from a single sample. An
367       extreme example of this might be a "step" of 5 minutes and a
368       "heartbeat" of one day, in which case a single sample every day will
369       result in all the PDPs for that entire day period being set to the same
370       average rate. -- Don Baarda <don.baarda@baesystems.com>
371
372              time|
373              axis|
374        begin__|00|
375               |01|
376              u|02|----* sample1, restart "hb"-timer
377              u|03|   /
378              u|04|  /
379              u|05| /
380              u|06|/     "hbt" expired
381              u|07|
382               |08|----* sample2, restart "hb"
383               |09|   /
384               |10|  /
385              u|11|----* sample3, restart "hb"
386              u|12|   /
387              u|13|  /
388        step1_u|14| /
389              u|15|/     "swt" expired
390              u|16|
391               |17|----* sample4, restart "hb", create "pdp" for step1 =
392               |18|   /  = unknown due to 10 "u" labled secs > 0.5 * step
393               |19|  /
394               |20| /
395               |21|----* sample5, restart "hb"
396               |22|   /
397               |23|  /
398               |24|----* sample6, restart "hb"
399               |25|   /
400               |26|  /
401               |27|----* sample7, restart "hb"
402        step2__|28|   /
403               |22|  /
404               |23|----* sample8, restart "hb", create "pdp" for step1, create "cdp"
405               |24|   /
406               |25|  /
407
408       graphics by vladimir.lavrov@desy.de.
409

HOW TO MEASURE

411       Here are a few hints on how to measure:
412
413       Temperature
414           Usually you have some type of meter you can read to get the
415           temperature.  The temperature is not really connected with a time.
416           The only connection is that the temperature reading happened at a
417           certain time. You can use the GAUGE data source type for this.
418           RRDtool will then record your reading together with the time.
419
420       Mail Messages
421           Assume you have a method to count the number of messages
422           transported by your mail server in a certain amount of time, giving
423           you data like '5 messages in the last 65 seconds'. If you look at
424           the count of 5 like an ABSOLUTE data type you can simply update the
425           RRD with the number 5 and the end time of your monitoring period.
426           RRDtool will then record the number of messages per second. If at
427           some later stage you want to know the number of messages
428           transported in a day, you can get the average messages per second
429           from RRDtool for the day in question and multiply this number with
430           the number of seconds in a day. Because all math is run with
431           Doubles, the precision should be acceptable.
432
433       It's always a Rate
434           RRDtool stores rates in amount/second for COUNTER, DERIVE and
435           ABSOLUTE data.  When you plot the data, you will get on the y axis
436           amount/second which you might be tempted to convert to an absolute
437           amount by multiplying by the delta-time between the points. RRDtool
438           plots continuous data, and as such is not appropriate for plotting
439           absolute amounts as for example "total bytes" sent and received in
440           a router. What you probably want is plot rates that you can scale
441           to bytes/hour, for example, or plot absolute amounts with another
442           tool that draws bar-plots, where the delta-time is clear on the
443           plot for each point (such that when you read the graph you see for
444           example GB on the y axis, days on the x axis and one bar for each
445           day).
446

EXAMPLE

448        rrdtool create temperature.rrd --step 300 \
449         DS:temp:GAUGE:600:-273:5000 \
450         RRA:AVERAGE:0.5:1:1200 \
451         RRA:MIN:0.5:12:2400 \
452         RRA:MAX:0.5:12:2400 \
453         RRA:AVERAGE:0.5:12:2400
454
455       This sets up an RRD called temperature.rrd which accepts one
456       temperature value every 300 seconds. If no new data is supplied for
457       more than 600 seconds, the temperature becomes *UNKNOWN*.  The minimum
458       acceptable value is -273 and the maximum is 5'000.
459
460       A few archive areas are also defined. The first stores the temperatures
461       supplied for 100 hours (1'200 * 300 seconds = 100 hours). The second
462       RRA stores the minimum temperature recorded over every hour (12 * 300
463       seconds = 1 hour), for 100 days (2'400 hours). The third and the fourth
464       RRA's do the same for the maximum and average temperature,
465       respectively.
466

EXAMPLE 2

468        rrdtool create monitor.rrd --step 300        \
469          DS:ifOutOctets:COUNTER:1800:0:4294967295   \
470          RRA:AVERAGE:0.5:1:2016                     \
471          RRA:HWPREDICT:1440:0.1:0.0035:288
472
473       This example is a monitor of a router interface. The first RRA tracks
474       the traffic flow in octets; the second RRA generates the specialized
475       functions RRAs for aberrant behavior detection. Note that the rra-num
476       argument of HWPREDICT is missing, so the other RRAs will implicitly be
477       created with default parameter values. In this example, the forecasting
478       algorithm baseline adapts quickly; in fact the most recent one hour of
479       observations (each at 5 minute intervals) accounts for 75% of the
480       baseline prediction. The linear trend forecast adapts much more slowly.
481       Observations made during the last day (at 288 observations per day)
482       account for only 65% of the predicted linear trend. Note: these
483       computations rely on an exponential smoothing formula described in the
484       LISA 2000 paper.
485
486       The seasonal cycle is one day (288 data points at 300 second
487       intervals), and the seasonal adaption parameter will be set to 0.1. The
488       RRD file will store 5 days (1'440 data points) of forecasts and
489       deviation predictions before wrap around. The file will store 1 day (a
490       seasonal cycle) of 0-1 indicators in the FAILURES RRA.
491
492       The same RRD file and RRAs are created with the following command,
493       which explicitly creates all specialized function RRAs.
494
495        rrdtool create monitor.rrd --step 300 \
496          DS:ifOutOctets:COUNTER:1800:0:4294967295 \
497          RRA:AVERAGE:0.5:1:2016 \
498          RRA:HWPREDICT:1440:0.1:0.0035:288:3 \
499          RRA:SEASONAL:288:0.1:2 \
500          RRA:DEVPREDICT:1440:5 \
501          RRA:DEVSEASONAL:288:0.1:2 \
502          RRA:FAILURES:288:7:9:5
503
504       Of course, explicit creation need not replicate implicit create, a
505       number of arguments could be changed.
506

EXAMPLE 3

508        rrdtool create proxy.rrd --step 300 \
509          DS:Total:DERIVE:1800:0:U  \
510          DS:Duration:DERIVE:1800:0:U  \
511          DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \
512          RRA:AVERAGE:0.5:1:2016
513
514       This example is monitoring the average request duration during each 300
515       sec interval for requests processed by a web proxy during the interval.
516       In this case, the proxy exposes two counters, the number of requests
517       processed since boot and the total cumulative duration of all processed
518       requests. Clearly these counters both have some rollover point, but
519       using the DERIVE data source also handles the reset that occurs when
520       the web proxy is stopped and restarted.
521
522       In the RRD, the first data source stores the requests per second rate
523       during the interval. The second data source stores the total duration
524       of all requests processed during the interval divided by 300. The
525       COMPUTE data source divides each PDP of the AccumDuration by the
526       corresponding PDP of TotalRequests and stores the average request
527       duration. The remainder of the RPN expression handles the divide by
528       zero case.
529

AUTHOR

531       Tobias Oetiker <tobi@oetiker.ch>
532
533
534
5351.4.8                             2013-05-23                      RRDCREATE(1)
Impressum