Code

Imported upstream version 1.4.3.
[pkg-rrdtool.git] / doc / rrdcached.1
1 .\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "RRDCACHED 1"
127 .TH RRDCACHED 1 "2010-03-22" "1.4.3" "rrdtool"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 rrdcached \- Data caching daemon for rrdtool
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fBrrdcached\fR
137 [\fB\-P\fR\ \fIpermissions\fR]
138 [\fB\-l\fR\ \fIaddress\fR]
139 [\fB\-s\fR\ \fIgroup\fR]
140 [\fB\-w\fR\ \fItimeout\fR]
141 [\fB\-z\fR\ \fIdelay\fR]
142 [\fB\-f\fR\ \fItimeout\fR]
143 [\fB\-p\fR\ \fIpid_file\fR]
144 [\fB\-t\fR\ \fIwrite_threads\fR]
145 [\fB\-j\fR\ \fIjournal_dir\fR]
146 [\-F]
147 [\-g]
148 [\fB\-b\fR\ \fIbase_dir\fR\ [\fB\-B\fR]]
149 .SH "DESCRIPTION"
150 .IX Header "DESCRIPTION"
151 \&\fBrrdcached\fR is a daemon that receives updates to existing \s-1RRD\s0 files,
152 accumulates them and, if enough have been received or a defined time has
153 passed, writes the updates to the \s-1RRD\s0 file. A \fIflush\fR command may be used to
154 force writing of values to disk, so that graphing facilities and similar can
155 work with up-to-date data.
156 .PP
157 The daemon was written with big setups in mind. Those setups usually run into
158 \&\s-1IO\s0\ related problems sooner or later for reasons that are beyond the scope
159 of this document. Check the wiki at the RRDtool homepage for details. Also
160 check \*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" below before using this daemon! A detailed
161 description of how the daemon operates can be found in the \*(L"\s-1HOW\s0 \s-1IT\s0 \s-1WORKS\s0\*(R"
162 section below.
163 .SH "OPTIONS"
164 .IX Header "OPTIONS"
165 .IP "\fB\-l\fR \fIaddress\fR" 4
166 .IX Item "-l address"
167 Tells the daemon to bind to \fIaddress\fR and accept incoming connections on that
168 socket. If \fIaddress\fR begins with \f(CW\*(C`unix:\*(C'\fR, everything following that prefix is
169 interpreted as the path to a \s-1UNIX\s0 domain socket. Otherwise the address or node
170 name are resolved using \f(CW\*(C`getaddrinfo()\*(C'\fR.
171 .Sp
172 For network sockets, a port may be specified by using the form
173 \&\f(CW\*(C`\f(CB[\f(CW\f(CIaddress\f(CW\f(CB]:\f(CW\f(CIport\f(CW\*(C'\fR. If the address is an IPv4 address or a fully
174 qualified domain name (i.\ e. the address contains at least one dot
175 (\f(CW\*(C`.\*(C'\fR)), the square brackets can be omitted, resulting in the (simpler)
176 \&\f(CW\*(C`\f(CIaddress\f(CW\f(CB:\f(CW\f(CIport\f(CW\*(C'\fR pattern. The default port is \fB42217/udp\fR. If you
177 specify a network socket, it is mandatory to read the
178 \&\*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" section.
179 .Sp
180 The following formats are accepted. Please note that the address of the \s-1UNIX\s0
181 domain socket \fBmust\fR start with a slash in the second case!
182 .Sp
183 .Vb 5
184 \&   unix:</path/to/unix.sock>
185 \&   /<path/to/unix.sock>
186 \&   <hostname\-or\-ip>
187 \&   [<hostname\-or\-ip>]:<port>
188 \&   <hostname\-or\-ipv4>:<port>
189 .Ve
190 .Sp
191 If the \fB\-l\fR option is not specified the default address,
192 \&\f(CW\*(C`unix:/tmp/rrdcached.sock\*(C'\fR, will be used.
193 .IP "\fB\-s\fR \fIgroup_name\fR|\fIgid\fR" 4
194 .IX Item "-s group_name|gid"
195 Set the group permissions of a \s-1UNIX\s0 domain socket. The option accepts either
196 a numeric group id or group name. That group will then have both read and write
197 permissions (the socket will have file permissions 0750) for the socket and,
198 therefore, is able to send commands to the daemon. This
199 may be useful in cases where you cannot easily run all \s-1RRD\s0 processes with the same
200 user privileges (e.g. graph generating \s-1CGI\s0 scripts that typically run in the
201 permission context of the web server).
202 .Sp
203 This option affects the \fIfollowing\fR \s-1UNIX\s0 socket addresses (the following
204 \&\fB\-l\fR options), i.e., you may specify different settings for different
205 sockets.
206 .Sp
207 The default is not to change ownership or permissions of the socket and, thus,
208 use the system default.
209 .IP "\fB\-m\fR \fImode\fR" 4
210 .IX Item "-m mode"
211 Set the file permissions of a \s-1UNIX\s0 domain socket. The option accepts an octal
212 number representing the bit pattern for the mode (see \fIchmod\fR\|(1) for
213 details).
214 .Sp
215 Please note that not all systems honor this setting. On Linux, read/write
216 permissions are required to connect to a \s-1UNIX\s0 socket. However, many
217 BSD-derived systems ignore permissions for \s-1UNIX\s0 sockets. See \fIunix\fR\|(7) for
218 details.
219 .Sp
220 This option affects the \fIfollowing\fR \s-1UNIX\s0 socket addresses (the following
221 \&\fB\-l\fR options), i.e., you may specify different settings for different
222 sockets.
223 .Sp
224 The default is not to change ownership or permissions of the socket and, thus,
225 use the system default.
226 .IP "\fB\-P\fR \fIcommand\fR[,\fIcommand\fR[,...]]" 4
227 .IX Item "-P command[,command[,...]]"
228 Specifies the commands accepted via a network socket. This allows
229 administrators of \fIRRDCacheD\fR to control the actions accepted from various
230 sources.
231 .Sp
232 The arguments given to the \fB\-P\fR option is a comma separated list of commands.
233 For example, to allow the \f(CW\*(C`FLUSH\*(C'\fR and \f(CW\*(C`PENDING\*(C'\fR commands one could specify:
234 .Sp
235 .Vb 1
236 \&  rrdcached \-P FLUSH,PENDING $MORE_ARGUMENTS
237 .Ve
238 .Sp
239 The \fB\-P\fR option affects the \fIfollowing\fR socket addresses (the following \fB\-l\fR
240 options). In the following example, only the IPv4 network socket (address
241 \&\f(CW10.0.0.1\fR) will be restricted to the \f(CW\*(C`FLUSH\*(C'\fR and \f(CW\*(C`PENDING\*(C'\fR commands:
242 .Sp
243 .Vb 1
244 \&  rrdcached \-l unix:/some/path \-P FLUSH,PENDING \-l 10.0.0.1
245 .Ve
246 .Sp
247 A complete list of available commands can be found in the section
248 \&\*(L"Valid Commands\*(R" below. There are two minor special exceptions:
249 .RS 4
250 .IP "\(bu" 4
251 The \f(CW\*(C`HELP\*(C'\fR and \f(CW\*(C`QUIT\*(C'\fR commands are always allowed.
252 .IP "\(bu" 4
253 If the \f(CW\*(C`BATCH\*(C'\fR command is accepted, the \fB.\fR\ command will automatically
254 be accepted, too.
255 .RE
256 .RS 4
257 .Sp
258 Please also read \*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" below.
259 .RE
260 .IP "\fB\-w\fR \fItimeout\fR" 4
261 .IX Item "-w timeout"
262 Data is written to disk every \fItimeout\fR seconds. If this option is not
263 specified the default interval of 300\ seconds will be used.
264 .IP "\fB\-z\fR \fIdelay\fR" 4
265 .IX Item "-z delay"
266 If specified, rrdcached will delay writing of each \s-1RRD\s0 for a random number
267 of seconds in the range\ [0,\fIdelay\fR).  This will avoid too many
268 writes being queued simultaneously.  This value should be no greater than
269 the value specified in \fB\-w\fR.  By default, there is no delay.
270 .IP "\fB\-f\fR \fItimeout\fR" 4
271 .IX Item "-f timeout"
272 Every \fItimeout\fR seconds the entire cache is searched for old values which are
273 written to disk. This only concerns files to which updates have stopped, so
274 setting this to a high value, such as 3600\ seconds, is acceptable in most
275 cases. This timeout defaults to 3600\ seconds.
276 .IP "\fB\-p\fR \fIfile\fR" 4
277 .IX Item "-p file"
278 Sets the name and location of the PID-file. If not specified, the default,
279 \&\f(CW\*(C`\f(CI$localststedir\f(CW/run/rrdcached.pid\*(C'\fR will be used.
280 .IP "\fB\-t\fR \fIwrite_threads\fR" 4
281 .IX Item "-t write_threads"
282 Specifies the number of threads used for writing \s-1RRD\s0 files.  The default
283 is\ 4.  Increasing this number will allow rrdcached to have more
284 simultaneous I/O requests into the kernel.  This may allow the kernel to
285 re-order disk writes, resulting in better disk throughput.
286 .IP "\fB\-j\fR \fIdir\fR" 4
287 .IX Item "-j dir"
288 Write updates to a journal in \fIdir\fR.  In the event of a program or system
289 crash, this will allow the daemon to write any updates that were pending
290 at the time of the crash.
291 .Sp
292 On startup, the daemon will check for journal files in this directory.  If
293 found, all updates therein will be read into memory before the daemon
294 starts accepting new connections.
295 .Sp
296 The journal will be rotated with the same frequency as the flush timer
297 given by \fB\-f\fR.
298 .Sp
299 When journaling is enabled, the daemon will use a fast shutdown procedure.
300 Rather than flushing all files to disk, it will make sure the journal is
301 properly written and exit immediately.  Although the \s-1RRD\s0 data files are
302 not fully up-to-date, no information is lost; all pending updates will be
303 replayed from the journal next time the daemon starts up.
304 .Sp
305 To disable fast shutdown, use the \fB\-F\fR option.
306 .IP "\fB\-F\fR" 4
307 .IX Item "-F"
308 \&\s-1ALWAYS\s0 flush all updates to the \s-1RRD\s0 data files when the daemon is shut
309 down, regardless of journal setting.
310 .IP "\fB\-g\fR" 4
311 .IX Item "-g"
312 Run in the foreground.  The daemon will not \fIfork()\fR.
313 .IP "\fB\-b\fR \fIdir\fR" 4
314 .IX Item "-b dir"
315 The daemon will change into a specific directory at startup. All files passed
316 to the daemon, that are specified by a \fBrelative\fR path, will be interpreted
317 to be relative to this directory. If not given the default, \f(CW\*(C`/tmp\*(C'\fR, will be
318 used.
319 .Sp
320 .Vb 10
321 \&  +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
322 \&  ! Command line           ! File updated           !
323 \&  +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
324 \&  ! foo.rrd                ! /tmp/foo.rrd           !
325 \&  ! foo/bar.rrd            ! /tmp/foo/bar.rrd       !
326 \&  ! /var/lib/rrd/foo.rrd   ! /var/lib/rrd/foo.rrd   !
327 \&  +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
328 \&  Paths given on the command  line and paths actually
329 \&  updated by the daemon,  assuming the base directory
330 \&  "/tmp".
331 .Ve
332 .Sp
333 \&\fB\s-1WARNING:\s0\fR The paths up to and including the base directory \fB\s-1MUST\s0 \s-1NOT\s0 \s-1BE\s0\fR
334 symbolic links.  In other words, if the base directory is
335 specified as:
336 .Sp
337 .Vb 1
338 \&    \-b /base/dir/somewhere
339 .Ve
340 .Sp
341 \&... then \fB\s-1NONE\s0\fR of the following should be symbolic links:
342 .Sp
343 .Vb 3
344 \&    /base
345 \&    /base/dir
346 \&    /base/dir/somewhere
347 .Ve
348 .IP "\fB\-B\fR" 4
349 .IX Item "-B"
350 Only permit writes into the base directory specified in \fB\-b\fR (and any
351 sub-directories).  This does \fB\s-1NOT\s0\fR detect symbolic links.  Paths
352 containing \f(CW\*(C`../\*(C'\fR will also be blocked.
353 .SH "AFFECTED RRDTOOL COMMANDS"
354 .IX Header "AFFECTED RRDTOOL COMMANDS"
355 The following commands may be made aware of the \fBrrdcached\fR using the command
356 line argument \fB\-\-daemon\fR or the environment variable \fB\s-1RRDCACHED_ADDRESS\s0\fR:
357 .IP "\(bu" 4
358 dump
359 .IP "\(bu" 4
360 fetch
361 .IP "\(bu" 4
362 flush
363 .IP "\(bu" 4
364 graph
365 .IP "\(bu" 4
366 graphv
367 .IP "\(bu" 4
368 info
369 .IP "\(bu" 4
370 last
371 .IP "\(bu" 4
372 lastupdate
373 .IP "\(bu" 4
374 update
375 .IP "\(bu" 4
376 xport
377 .PP
378 The \fBupdate\fR command can send values to the daemon instead of writing them to
379 the disk itself. All other commands can send a \fB\s-1FLUSH\s0\fR command (see below) to
380 the daemon before accessing the files, so they work with up-to-date data even
381 if the cache timeout is large.
382 .SH "ERROR REPORTING"
383 .IX Header "ERROR REPORTING"
384 The daemon reports errors in one of two ways: During startup, error messages
385 are printed to \f(CW\*(C`STDERR\*(C'\fR. One of the steps when starting up is to fork to the
386 background and closing \f(CW\*(C`STDERR\*(C'\fR \- after this writing directly to the user is
387 no longer possible. Once this has happened, the daemon will send log messages
388 to the system logging daemon using \fIsyslog\fR\|(3). The facility used is
389 \&\f(CW\*(C`LOG_DAEMON\*(C'\fR.
390 .SH "HOW IT WORKS"
391 .IX Header "HOW IT WORKS"
392 When receiving an update, \fBrrdcached\fR does not write to disk but looks for an
393 entry for that file in its internal tree. If not found, an entry is created
394 including the current time (called \*(L"First\*(R" in the diagram below). This time is
395 \&\fBnot\fR the time specified on the command line but the time the operating system
396 considers to be \*(L"now\*(R". The value and time of the value (called \*(L"Time\*(R" in the
397 diagram below) are appended to the tree node.
398 .PP
399 When appending a value to a tree node, it is checked whether it's time to write
400 the values to disk. Values are written to disk if
401 \&\f(CW\*(C`now()\ \-\ First\ >=\ timeout\*(C'\fR, where \f(CW\*(C`timeout\*(C'\fR is the timeout specified
402 using the \fB\-w\fR option, see \*(L"\s-1OPTIONS\s0\*(R". If the values are \*(L"old enough\*(R" they
403 will be enqueued in the \*(L"update queue\*(R", i.\ e. they will be appended to
404 the linked list shown below.  Because the tree nodes and the elements of the
405 linked list are the same data structures in memory, any update to a file that
406 has already been enqueued will be written with the next write to the \s-1RRD\s0 file,
407 too.
408 .PP
409 A separate \*(L"update thread\*(R" constantly dequeues the first element in the update
410 queue and writes all its values to the appropriate file. So as long as the
411 update queue is not empty files are written at the highest possible rate.
412 .PP
413 Since the timeout of files is checked only when new values are added to the
414 file, \*(L"dead\*(R" files, i.\ e. files that are not updated anymore, would never
415 be written to disk. Therefore, every now and then, controlled by the \fB\-f\fR
416 option, the entire tree is walked and all \*(L"old\*(R" values are enqueued. Since this
417 only affects \*(L"dead\*(R" files and walking the tree is relatively expensive, you
418 should set the \*(L"flush interval\*(R" to a reasonably high value. The default is
419 3600\ seconds (one hour).
420 .PP
421 The downside of caching values is that they won't show up in graphs generated
422 from the \s-1RRD\s0\ files. To get around this, the daemon provides the \*(L"flush
423 command\*(R" to flush specific files. This means that the file is inserted at the
424 \&\fBhead\fR of the update queue or moved there if it is already enqueued. The flush
425 command will return only after the file's pending updates have been written
426 to disk.
427 .PP
428 .Vb 10
429 \& +\-\-\-\-\-\-+   +\-\-\-\-\-\-+                               +\-\-\-\-\-\-+
430 \& ! head !   ! root !                               ! tail !
431 \& +\-\-\-+\-\-+   +\-\-\-+\-\-+                               +\-\-\-+\-\-+
432 \&     !         /\e                                      !
433 \&     !        /  \e                                     !
434 \&     !       /\e  /\e                                    !
435 \&     !      /\e/\e \e \`\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- ... \-\-\-\-\-\-\-\-,    !
436 \&     V     /      \`\-\-\-\-\-\-\-,                       !    V
437 \& +\-\-\-+\-\-\-\-+\-\-\-+    +\-\-\-\-\-\-+\-\-\-\-\-+             +\-\-\-+\-\-\-\-+\-\-\-+
438 \& ! File:  foo !    ! File:  bar !             ! File:  qux !
439 \& ! First: 101 !    ! First: 119 !             ! First: 180 !
440 \& ! Next:&bar \-+\-\-\->! Next:&... \-+\-\-\-> ... \-\-\->! Next:NULL  !
441 \& | Prev:NULL  !<\-\-\-+\-Prev:&foo  !<\-\-\- ... \-\-\-\-+\-Prev: &... !
442 \& +============+    +============+             +============+
443 \& ! Time:  100 !    ! Time:  120 !             ! Time:  180 !
444 \& ! Value:  10 !    ! Value: 0.1 !             ! Value: 2,2 !
445 \& +\-\-\-\-\-\-\-\-\-\-\-\-+    +\-\-\-\-\-\-\-\-\-\-\-\-+             +\-\-\-\-\-\-\-\-\-\-\-\-+
446 \& ! Time:  110 !    ! Time:  130 !             ! Time:  190 !
447 \& ! Value:  26 !    ! Value: 0.1 !             ! Value: 7,3 !
448 \& +\-\-\-\-\-\-\-\-\-\-\-\-+    +\-\-\-\-\-\-\-\-\-\-\-\-+             +\-\-\-\-\-\-\-\-\-\-\-\-+
449 \& :            :    :            :             :            :
450 \& +\-\-\-\-\-\-\-\-\-\-\-\-+    +\-\-\-\-\-\-\-\-\-\-\-\-+             +\-\-\-\-\-\-\-\-\-\-\-\-+
451 \& ! Time:  230 !    ! Time:  250 !             ! Time:  310 !
452 \& ! Value:  42 !    ! Value: 0.2 !             ! Value: 1,2 !
453 \& +\-\-\-\-\-\-\-\-\-\-\-\-+    +\-\-\-\-\-\-\-\-\-\-\-\-+             +\-\-\-\-\-\-\-\-\-\-\-\-+
454 .Ve
455 .PP
456 The above diagram demonstrates:
457 .IP "\(bu" 4
458 Files/values are stored in a (balanced) tree.
459 .IP "\(bu" 4
460 Tree nodes and entries in the update queue are the same data structure.
461 .IP "\(bu" 4
462 The local time (\*(L"First\*(R") and the time specified in updates (\*(L"Time\*(R") may differ.
463 .IP "\(bu" 4
464 Timed out values are inserted at the \*(L"tail\*(R".
465 .IP "\(bu" 4
466 Explicitly flushed values are inserted at the \*(L"head\*(R".
467 .IP "\(bu" 4
468 \&\s-1ASCII\s0 art rocks.
469 .SH "SECURITY CONSIDERATIONS"
470 .IX Header "SECURITY CONSIDERATIONS"
471 .SS "Authentication"
472 .IX Subsection "Authentication"
473 There is no authentication.
474 .PP
475 The client/server protocol does not yet have any authentication mechanism. It
476 is likely that authentication and encryption will be added in a future version,
477 but for the time being it is the administrator's responsibility to secure the
478 traffic from/to the daemon!
479 .PP
480 It is highly recommended to install a packet filter or similar mechanism to
481 prevent unauthorized connections. Unless you have a dedicated \s-1VLAN\s0 or \s-1VPN\s0 for
482 this, using network sockets is probably a bad idea!
483 .SS "Authorization"
484 .IX Subsection "Authorization"
485 There is minimal per-socket authorization.
486 .PP
487 Authorization is currently done on a per-socket basis. That means each socket
488 has a list of commands it will accept and it will accept. It will accept only
489 those commands explicitly listed but it will (currently) accept these commands
490 from anyone reaching the socket.
491 .PP
492 If the networking sockets are to be used, it is necessary to restrict the
493 accepted commands to those needed by external clients. If, for example,
494 external clients want to draw graphs of the cached data, they should only be
495 allowed to use the \f(CW\*(C`FLUSH\*(C'\fR command.
496 .SS "Encryption"
497 .IX Subsection "Encryption"
498 There is no encryption.
499 .PP
500 Again, this may be added in the future, but for the time being it is your job
501 to keep your private data private. Install a \s-1VPN\s0 or an encrypted tunnel if you
502 statistics are confidential!
503 .SS "Sanity checking"
504 .IX Subsection "Sanity checking"
505 There is no sanity checking.
506 .PP
507 The daemon will blindly write to any file it gets told, so you really should
508 create a separate user just for this daemon. Also it does not do any sanity
509 checks, so if it gets told to write values for a time far in the future, your
510 files will be messed up good!
511 .SS "Conclusion"
512 .IX Subsection "Conclusion"
513 .IP "\(bu" 4
514 Security is the job of the administrator.
515 .IP "\(bu" 4
516 We recommend to allow write access via \s-1UNIX\s0 domain sockets only.
517 .IP "\(bu" 4
518 You have been warned.
519 .SH "PROTOCOL"
520 .IX Header "PROTOCOL"
521 The daemon communicates with clients using a line based \s-1ASCII\s0 protocol which is
522 easy to read and easy to type. This makes it easy for scripts to implement the
523 protocol and possible for users to use telnet to connect to the daemon
524 and test stuff \*(L"by hand\*(R".
525 .PP
526 The protocol is line based, this means that each record consists of one or more
527 lines. A line is terminated by the line feed character \f(CW0x0A\fR, commonly
528 written as \f(CW\*(C`\en\*(C'\fR. In the examples below, this character will be written as
529 \&\f(CW\*(C`<LF>\*(C'\fR (\*(L"line feed\*(R").
530 .PP
531 After the connection has been established, the client is expected to send a
532 \&\*(L"command\*(R". A command consists of the command keyword, possibly some arguments,
533 and a terminating newline character. For a list of commands, see
534 \&\*(L"Valid Commands\*(R" below.
535 .PP
536 Example:
537 .PP
538 .Vb 1
539 \&  FLUSH /tmp/foo.rrd<LF>
540 .Ve
541 .PP
542 The daemon answers with a line consisting of a status code and a short status
543 message, separated by one or more space characters. A negative status code
544 signals an error, a positive status code or zero signal success. If the status
545 code is greater than zero, it indicates the number of lines that follow the
546 status line.
547 .PP
548 Examples:
549 .PP
550 .Vb 1
551 \& 0 Success<LF>
552 \&
553 \& 2 Two lines follow<LF>
554 \& This is the first line<LF>
555 \& And this is the second line<LF>
556 .Ve
557 .SS "Valid Commands"
558 .IX Subsection "Valid Commands"
559 The following commands are understood by the daemon:
560 .IP "\fB\s-1FLUSH\s0\fR \fIfilename\fR" 4
561 .IX Item "FLUSH filename"
562 Causes the daemon to put \fIfilename\fR to the \fBhead\fR of the update queue
563 (possibly moving it there if the node is already enqueued). The answer will be
564 sent \fBafter\fR the node has been dequeued.
565 .IP "\fB\s-1FLUSHALL\s0\fR" 4
566 .IX Item "FLUSHALL"
567 Causes the daemon to start flushing \s-1ALL\s0 pending values to disk.  This
568 returns immediately, even though the writes may take a long time.
569 .IP "\fB\s-1PENDING\s0\fR \fIfilename\fR" 4
570 .IX Item "PENDING filename"
571 Shows any \*(L"pending\*(R" updates for a file, in order.  The updates shown have
572 not yet been written to the underlying \s-1RRD\s0 file.
573 .IP "\fB\s-1FORGET\s0\fR \fIfilename\fR" 4
574 .IX Item "FORGET filename"
575 Removes \fIfilename\fR from the cache.  Any pending updates \fB\s-1WILL\s0 \s-1BE\s0 \s-1LOST\s0\fR.
576 .IP "\fB\s-1QUEUE\s0\fR" 4
577 .IX Item "QUEUE"
578 Shows the files that are on the output queue.  Returns zero or more lines
579 in the following format, where <num_vals> is the number of values
580 to be written for the <file>:
581 .Sp
582 .Vb 1
583 \&    <num_vals> <file>
584 .Ve
585 .IP "\fB\s-1HELP\s0\fR [\fIcommand\fR]" 4
586 .IX Item "HELP [command]"
587 Returns a short usage message. If no command is given, or \fIcommand\fR is
588 \&\fB\s-1HELP\s0\fR, a list of commands supported by the daemon is returned. Otherwise a
589 short description, possibly containing a pointer to a manual page, is returned.
590 Obviously, this is meant for interactive usage and the format in which the
591 commands and usage summaries are returned is not well defined.
592 .IP "\fB\s-1STATS\s0\fR" 4
593 .IX Item "STATS"
594 Returns a list of metrics which can be used to measure the daemons performance
595 and check its status. For a description of the values returned, see
596 \&\*(L"Performance Values\*(R" below.
597 .Sp
598 The format in which the values are returned is similar to many other line based
599 protocols: Each value is printed on a separate line, each consisting of the
600 name of the value, a colon, one or more spaces and the actual value.
601 .Sp
602 Example:
603 .Sp
604 .Vb 10
605 \& 9 Statistics follow
606 \& QueueLength: 0
607 \& UpdatesReceived: 30
608 \& FlushesReceived: 2
609 \& UpdatesWritten: 13
610 \& DataSetsWritten: 390
611 \& TreeNodesNumber: 13
612 \& TreeDepth: 4
613 \& JournalBytes: 190
614 \& JournalRotate: 0
615 .Ve
616 .IP "\fB\s-1UPDATE\s0\fR \fIfilename\fR \fIvalues\fR [\fIvalues\fR ...]" 4
617 .IX Item "UPDATE filename values [values ...]"
618 Adds more data to a filename. This is \fBthe\fR operation the daemon was designed
619 for, so describing the mechanism again is unnecessary. Read \*(L"\s-1HOW\s0 \s-1IT\s0 \s-1WORKS\s0\*(R"
620 above for a detailed explanation.
621 .Sp
622 Note that rrdcached only accepts absolute timestamps in the update values.
623 Updates strings like \*(L"N:1:2:3\*(R" are automatically converted to absolute
624 time by the \s-1RRD\s0 client library before sending to rrdcached.
625 .IP "\fB\s-1WROTE\s0\fR \fIfilename\fR" 4
626 .IX Item "WROTE filename"
627 This command is written to the journal after a file is successfully
628 written out to disk.  It is used during journal replay to determine which
629 updates have already been applied.  It is \fIonly\fR valid in the journal; it
630 is not accepted from the other command channels.
631 .IP "\fB\s-1BATCH\s0\fR" 4
632 .IX Item "BATCH"
633 This command initiates the bulk load of multiple commands.  This is
634 designed for installations with extremely high update rates, since it
635 permits more than one command to be issued per \fIread()\fR and \fIwrite()\fR.
636 .Sp
637 All commands are executed just as they would be if given individually,
638 except for output to the user.  Messages indicating success are
639 suppressed, and error messages are delayed until the client is finished.
640 .Sp
641 Command processing is finished when the client sends a dot (\*(L".\*(R") on its
642 own line.  After the client has finished, the server responds with an
643 error count and the list of error messages (if any).  Each error messages
644 indicates the number of the command to which it corresponds, and the error
645 message itself.  The first user command after \fB\s-1BATCH\s0\fR is command number one.
646 .Sp
647 .Vb 9
648 \&    client:  BATCH
649 \&    server:  0 Go ahead.  End with dot \*(Aq.\*(Aq on its own line.
650 \&    client:  UPDATE x.rrd 1223661439:1:2:3            <\-\-\- command #1
651 \&    client:  UPDATE y.rrd 1223661440:3:4:5            <\-\-\- command #2
652 \&    client:  and so on...
653 \&    client:  .
654 \&    server:  2 Errors
655 \&    server:  1 message for command 1
656 \&    server:  12 message for command 12
657 .Ve
658 .IP "\fB\s-1QUIT\s0\fR" 4
659 .IX Item "QUIT"
660 Disconnect from rrdcached.
661 .SS "Performance Values"
662 .IX Subsection "Performance Values"
663 The following counters are returned by the \fB\s-1STATS\s0\fR command:
664 .IP "\fBQueueLength\fR \fI(unsigned 64bit integer)\fR" 4
665 .IX Item "QueueLength (unsigned 64bit integer)"
666 Number of nodes currently enqueued in the update queue.
667 .IP "\fBUpdatesReceived\fR \fI(unsigned 64bit integer)\fR" 4
668 .IX Item "UpdatesReceived (unsigned 64bit integer)"
669 Number of \s-1UPDATE\s0 commands received.
670 .IP "\fBFlushesReceived\fR \fI(unsigned 64bit integer)\fR" 4
671 .IX Item "FlushesReceived (unsigned 64bit integer)"
672 Number of \s-1FLUSH\s0 commands received.
673 .IP "\fBUpdatesWritten\fR \fI(unsigned 64bit integer)\fR" 4
674 .IX Item "UpdatesWritten (unsigned 64bit integer)"
675 Total number of updates, i.\ e. calls to \f(CW\*(C`rrd_update_r\*(C'\fR, since the
676 daemon was started.
677 .IP "\fBDataSetsWritten\fR \fI(unsigned 64bit integer)\fR" 4
678 .IX Item "DataSetsWritten (unsigned 64bit integer)"
679 Total number of \*(L"data sets\*(R" written to disk since the daemon was
680 started. A data set is one or more values passed to the \fB\s-1UPDATE\s0\fR
681 command. For example: \f(CW\*(C`1223661439:123:456\*(C'\fR is one data set with two
682 values. The term \*(L"data set\*(R" is used to prevent confusion whether
683 individual values or groups of values are counted.
684 .IP "\fBTreeNodesNumber\fR \fI(unsigned 64bit integer)\fR" 4
685 .IX Item "TreeNodesNumber (unsigned 64bit integer)"
686 Number of nodes in the cache.
687 .IP "\fBTreeDepth\fR \fI(unsigned 64bit integer)\fR" 4
688 .IX Item "TreeDepth (unsigned 64bit integer)"
689 Depth of the tree used for fast key lookup.
690 .IP "\fBJournalBytes\fR \fI(unsigned 64bit integer)\fR" 4
691 .IX Item "JournalBytes (unsigned 64bit integer)"
692 Total number of bytes written to the journal since startup.
693 .IP "\fBJournalRotate\fR \fI(unsigned 64bit integer)\fR" 4
694 .IX Item "JournalRotate (unsigned 64bit integer)"
695 Number of times the journal has been rotated since startup.
696 .SH "SIGNALS"
697 .IX Header "SIGNALS"
698 .IP "\s-1SIGINT\s0 and \s-1SIGTERM\s0" 4
699 .IX Item "SIGINT and SIGTERM"
700 The daemon exits normally on receipt of either of these signals.  Pending
701 updates are handled in accordance with the \fB\-j\fR and \fB\-F\fR options.
702 .IP "\s-1SIGUSR1\s0" 4
703 .IX Item "SIGUSR1"
704 The daemon exits \s-1AFTER\s0 flushing all updates out to disk.  This may take a
705 while.
706 .IP "\s-1SIGUSR2\s0" 4
707 .IX Item "SIGUSR2"
708 The daemon exits immediately, without flushing updates out to disk.
709 Pending updates will be replayed from the journal when the daemon starts
710 up again.  \fB\s-1WARNING:\s0 if journaling (\-j) is \s-1NOT\s0 enabled, any pending
711 updates \s-1WILL\s0 \s-1BE\s0 \s-1LOST\s0\fR.
712 .SH "BUGS"
713 .IX Header "BUGS"
714 No known bugs at the moment.
715 .SH "SEE ALSO"
716 .IX Header "SEE ALSO"
717 rrdtool, rrdgraph
718 .SH "AUTHOR"
719 .IX Header "AUTHOR"
720 Florian Forster <octo\ at\ verplant.org>
721 .PP
722 Both \fBrrdcached\fR and this manual page have been written by Florian.
723 .SH "CONTRIBUTORS"
724 .IX Header "CONTRIBUTORS"
725 kevin brintnall <kbrint@rufus.net>