1 .\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.08)
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 "2009-09-24" "1.3.999" "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\-w\fR\ \fItimeout\fR]
140 [\fB\-z\fR\ \fIdelay\fR]
141 [\fB\-f\fR\ \fItimeout\fR]
142 [\fB\-p\fR\ \fIpid_file\fR]
143 [\fB\-t\fR\ \fIwrite_threads\fR]
144 [\fB\-j\fR\ \fIjournal_dir\fR]
145 [\-F]
146 [\-g]
147 [\fB\-b\fR\ \fIbase_dir\fR\ [\fB\-B\fR]]
148 .SH "DESCRIPTION"
149 .IX Header "DESCRIPTION"
150 \&\fBrrdcached\fR is a daemon that receives updates to existing \s-1RRD\s0 files,
151 accumulates them and, if enough have been received or a defined time has
152 passed, writes the updates to the \s-1RRD\s0 file. A \fIflush\fR command may be used to
153 force writing of values to disk, so that graphing facilities and similar can
154 work with up-to-date data.
155 .PP
156 The daemon was written with big setups in mind. Those setups usually run into
157 \&\s-1IO\s0\ related problems sooner or later for reasons that are beyond the scope
158 of this document. Check the wiki at the RRDTool homepage for details. Also
159 check \*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" below before using this daemon! A detailed
160 description of how the daemon operates can be found in the \*(L"\s-1HOW\s0 \s-1IT\s0 \s-1WORKS\s0\*(R"
161 section below.
162 .SH "OPTIONS"
163 .IX Header "OPTIONS"
164 .IP "\fB\-l\fR \fIaddress\fR" 4
165 .IX Item "-l address"
166 Tells the daemon to bind to \fIaddress\fR and accept incoming connections on that
167 socket. If \fIaddress\fR begins with \f(CW\*(C`unix:\*(C'\fR, everything following that prefix is
168 interpreted as the path to a \s-1UNIX\s0 domain socket. Otherwise the address or node
169 name are resolved using getaddrinfo.
170 .Sp
171 For network sockets, a port may be specified by using the form
172 \&\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
173 qualified domain name (i.\ e. the address contains at least one dot
174 (\f(CW\*(C`.\*(C'\fR)), the square brackets can be omitted, resulting in the (simpler)
175 \&\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
176 specify a network socket, it is mandatory to read the
177 \&\*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" section.
178 .Sp
179 The following formats are accepted. Please note that the address of the \s-1UNIX\s0
180 domain socket \fBmust\fR start with a slash in the second case!
181 .Sp
182 .Vb 5
183 \& unix:</path/to/unix.sock>
184 \& /<path/to/unix.sock>
185 \& <hostname\-or\-ip>
186 \& [<hostname\-or\-ip>]:<port>
187 \& <hostname\-or\-ipv4>:<port>
188 .Ve
189 .Sp
190 If the \fB\-l\fR option is not specified the default address,
191 \&\f(CW\*(C`unix:/tmp/rrdcached.sock\*(C'\fR, will be used.
192 .IP "\fB\-P\fR \fIcommand\fR[,\fIcommand\fR[,...]]" 4
193 .IX Item "-P command[,command[,...]]"
194 Specifies the commands accepted via a network socket. This allows
195 administrators of \fIRRDCacheD\fR to control the actions accepted from various
196 sources.
197 .Sp
198 The arguments given to the \fB\-P\fR option is a comma separated list of commands.
199 For example, to allow the \f(CW\*(C`FLUSH\*(C'\fR and \f(CW\*(C`PENDING\*(C'\fR commands one could specify:
200 .Sp
201 .Vb 1
202 \& rrdcached \-P FLUSH,PENDING $MORE_ARGUMENTS
203 .Ve
204 .Sp
205 The \fB\-P\fR option effects the \fIfollowing\fR socket addresses (the following \fB\-l\fR
206 options). In the following example, only the IPv4 network socket (address
207 \&\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:
208 .Sp
209 .Vb 1
210 \& rrdcached \-l unix:/some/path \-P FLUSH,PENDING \-l 10.0.0.1
211 .Ve
212 .Sp
213 A complete list of available commands can be found in the section
214 \&\*(L"Valid Commands\*(R" below. There are two minor special exceptions:
215 .RS 4
216 .IP "\(bu" 4
217 The \f(CW\*(C`HELP\*(C'\fR and \f(CW\*(C`QUIT\*(C'\fR commands are always allowed.
218 .IP "\(bu" 4
219 If the \f(CW\*(C`BATCH\*(C'\fR command is accepted, the \fB.\fR\ command will automatically
220 be accepted, too.
221 .RE
222 .RS 4
223 .Sp
224 Please also read \*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" below.
225 .RE
226 .IP "\fB\-w\fR \fItimeout\fR" 4
227 .IX Item "-w timeout"
228 Data is written to disk every \fItimeout\fR seconds. If this option is not
229 specified the default interval of 300\ seconds will be used.
230 .IP "\fB\-z\fR \fIdelay\fR" 4
231 .IX Item "-z delay"
232 If specified, rrdcached will delay writing of each \s-1RRD\s0 for a random number
233 of seconds in the range\ [0,\fIdelay\fR). This will avoid too many
234 writes being queued simultaneously. This value should be no greater than
235 the value specified in \fB\-w\fR. By default, there is no delay.
236 .IP "\fB\-f\fR \fItimeout\fR" 4
237 .IX Item "-f timeout"
238 Every \fItimeout\fR seconds the entire cache is searched for old values which are
239 written to disk. This only concerns files to which updates have stopped, so
240 setting this to a high value, such as 3600\ seconds, is acceptable in most
241 cases. This timeout defaults to 3600\ seconds.
242 .IP "\fB\-p\fR \fIfile\fR" 4
243 .IX Item "-p file"
244 Sets the name and location of the PID-file. If not specified, the default,
245 \&\f(CW\*(C`\f(CI$localststedir\f(CW/run/rrdcached.pid\*(C'\fR will be used.
246 .IP "\fB\-t\fR \fIwrite_threads\fR" 4
247 .IX Item "-t write_threads"
248 Specifies the number of threads used for writing \s-1RRD\s0 files. The default
249 is\ 4. Increasing this number will allow rrdcached to have more
250 simultaneous I/O requests into the kernel. This may allow the kernel to
251 re-order disk writes, resulting in better disk throughput.
252 .IP "\fB\-j\fR \fIdir\fR" 4
253 .IX Item "-j dir"
254 Write updates to a journal in \fIdir\fR. In the event of a program or system
255 crash, this will allow the daemon to write any updates that were pending
256 at the time of the crash.
257 .Sp
258 On startup, the daemon will check for journal files in this directory. If
259 found, all updates therein will be read into memory before the daemon
260 starts accepting new connections.
261 .Sp
262 The journal will be rotated with the same frequency as the flush timer
263 given by \fB\-f\fR.
264 .Sp
265 When journaling is enabled, the daemon will use a fast shutdown procedure.
266 Rather than flushing all files to disk, it will make sure the journal is
267 properly written and exit immediately. Although the \s-1RRD\s0 data files are
268 not fully up-to-date, no information is lost; all pending updates will be
269 replayed from the journal next time the daemon starts up.
270 .Sp
271 To disable fast shutdown, use the \fB\-F\fR option.
272 .IP "\fB\-F\fR" 4
273 .IX Item "-F"
274 \&\s-1ALWAYS\s0 flush all updates to the \s-1RRD\s0 data files when the daemon is shut
275 down, regardless of journal setting.
276 .IP "\fB\-g\fR" 4
277 .IX Item "-g"
278 Run in the foreground. The daemon will not \fIfork()\fR.
279 .IP "\fB\-b\fR \fIdir\fR" 4
280 .IX Item "-b dir"
281 The daemon will change into a specific directory at startup. All files passed
282 to the daemon, that are specified by a \fBrelative\fR path, will be interpreted
283 to be relative to this directory. If not given the default, \f(CW\*(C`/tmp\*(C'\fR, will be
284 used.
285 .Sp
286 .Vb 10
287 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
288 \& ! Command line ! File updated !
289 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
290 \& ! foo.rrd ! /tmp/foo.rrd !
291 \& ! foo/bar.rrd ! /tmp/foo/bar.rrd !
292 \& ! /var/lib/rrd/foo.rrd ! /var/lib/rrd/foo.rrd !
293 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
294 \& Paths given on the command line and paths actually
295 \& updated by the daemon, assuming the base directory
296 \& "/tmp".
297 .Ve
298 .Sp
299 \&\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
300 symbolic links. In other words, if the base directory is
301 specified as:
302 .Sp
303 .Vb 1
304 \& \-b /base/dir/somewhere
305 .Ve
306 .Sp
307 \&... then \fB\s-1NONE\s0\fR of the following should be symbolic links:
308 .Sp
309 .Vb 3
310 \& /base
311 \& /base/dir
312 \& /base/dir/somewhere
313 .Ve
314 .IP "\fB\-B\fR" 4
315 .IX Item "-B"
316 Only permit writes into the base directory specified in \fB\-b\fR (and any
317 sub-directories). This does \fB\s-1NOT\s0\fR detect symbolic links. Paths
318 containing \f(CW\*(C`../\*(C'\fR will also be blocked.
319 .SH "AFFECTED RRDTOOL COMMANDS"
320 .IX Header "AFFECTED RRDTOOL COMMANDS"
321 The following commands may be made aware of the \fBrrdcached\fR using the command
322 line argument \fB\-\-daemon\fR or the environment variable \fB\s-1RRDCACHED_ADDRESS\s0\fR:
323 .IP "\fBdump\fR" 4
324 .IX Item "dump"
325 .PD 0
326 .IP "\fBfetch\fR" 4
327 .IX Item "fetch"
328 .IP "\fBflush\fR" 4
329 .IX Item "flush"
330 .IP "\fBgraph\fR" 4
331 .IX Item "graph"
332 .IP "\fBgraphv\fR" 4
333 .IX Item "graphv"
334 .IP "\fBinfo\fR" 4
335 .IX Item "info"
336 .IP "\fBlast\fR" 4
337 .IX Item "last"
338 .IP "\fBlastupdate\fR" 4
339 .IX Item "lastupdate"
340 .IP "\fBupdate\fR" 4
341 .IX Item "update"
342 .IP "\fBxport\fR" 4
343 .IX Item "xport"
344 .PD
345 .PP
346 The \fBupdate\fR command can send values to the daemon instead of writing them to
347 the disk itself. All other commands can send a \fB\s-1FLUSH\s0\fR command (see below) to
348 the daemon before accessing the files, so they work with up-to-date data even
349 if the cache timeout is large.
350 .SH "ERROR REPORTING"
351 .IX Header "ERROR REPORTING"
352 The daemon reports errors in one of two ways: During startup, error messages
353 are printed to \f(CW\*(C`STDERR\*(C'\fR. One of the steps when starting up is to fork to the
354 background and closing \f(CW\*(C`STDERR\*(C'\fR \- after this writing directly to the user is
355 no longer possible. Once this has happened, the daemon will send log messages
356 to the system logging daemon using \fIsyslog\fR\|(3). The facility used is
357 \&\f(CW\*(C`LOG_DAEMON\*(C'\fR.
358 .SH "HOW IT WORKS"
359 .IX Header "HOW IT WORKS"
360 When receiving an update, \fBrrdcached\fR does not write to disk but looks for an
361 entry for that file in its internal tree. If not found, an entry is created
362 including the current time (called \*(L"First\*(R" in the diagram below). This time is
363 \&\fBnot\fR the time specified on the command line but the time the operating system
364 considers to be \*(L"now\*(R". The value and time of the value (called \*(L"Time\*(R" in the
365 diagram below) are appended to the tree node.
366 .PP
367 When appending a value to a tree node, it is checked whether it's time to write
368 the values to disk. Values are written to disk if
369 \&\f(CW\*(C`now()\ \-\ First\ >=\ timeout\*(C'\fR, where \f(CW\*(C`timeout\*(C'\fR is the timeout specified
370 using the \fB\-w\fR option, see \s-1OPTIONS\s0. If the values are \*(L"old enough\*(R" they
371 will be enqueued in the \*(L"update queue\*(R", i.\ e. they will be appended to
372 the linked list shown below. Because the tree nodes and the elements of the
373 linked list are the same data structures in memory, any update to a file that
374 has already been enqueued will be written with the next write to the \s-1RRD\s0 file,
375 too.
376 .PP
377 A separate \*(L"update thread\*(R" constantly dequeues the first element in the update
378 queue and writes all its values to the appropriate file. So as long as the
379 update queue is not empty files are written at the highest possible rate.
380 .PP
381 Since the timeout of files is checked only when new values are added to the
382 file, \*(L"dead\*(R" files, i.\ e. files that are not updated anymore, would never
383 be written to disk. Therefore, every now and then, controlled by the \fB\-f\fR
384 option, the entire tree is walked and all \*(L"old\*(R" values are enqueued. Since this
385 only affects \*(L"dead\*(R" files and walking the tree is relatively expensive, you
386 should set the \*(L"flush interval\*(R" to a reasonably high value. The default is
387 3600\ seconds (one hour).
388 .PP
389 The downside of caching values is that they won't show up in graphs generated
390 from the \s-1RRD\s0\ files. To get around this, the daemon provides the \*(L"flush
391 command\*(R" to flush specific files. This means that the file is inserted at the
392 \&\fBhead\fR of the update queue or moved there if it is already enqueued. The flush
393 command will return only after the file's pending updates have been written
394 to disk.
395 .PP
396 .Vb 10
397 \& +\-\-\-\-\-\-+ +\-\-\-\-\-\-+ +\-\-\-\-\-\-+
398 \& ! head ! ! root ! ! tail !
399 \& +\-\-\-+\-\-+ +\-\-\-+\-\-+ +\-\-\-+\-\-+
400 \& ! /\e !
401 \& ! / \e !
402 \& ! /\e /\e !
403 \& ! /\e/\e \e \`\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- ... \-\-\-\-\-\-\-\-, !
404 \& V / \`\-\-\-\-\-\-\-, ! V
405 \& +\-\-\-+\-\-\-\-+\-\-\-+ +\-\-\-\-\-\-+\-\-\-\-\-+ +\-\-\-+\-\-\-\-+\-\-\-+
406 \& ! File: foo ! ! File: bar ! ! File: qux !
407 \& ! First: 101 ! ! First: 119 ! ! First: 180 !
408 \& ! Next:&bar \-+\-\-\->! Next:&... \-+\-\-\-> ... \-\-\->! Next:NULL !
409 \& | Prev:NULL !<\-\-\-+\-Prev:&foo !<\-\-\- ... \-\-\-\-+\-Prev: &... !
410 \& +============+ +============+ +============+
411 \& ! Time: 100 ! ! Time: 120 ! ! Time: 180 !
412 \& ! Value: 10 ! ! Value: 0.1 ! ! Value: 2,2 !
413 \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+
414 \& ! Time: 110 ! ! Time: 130 ! ! Time: 190 !
415 \& ! Value: 26 ! ! Value: 0.1 ! ! Value: 7,3 !
416 \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+
417 \& : : : : : :
418 \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+
419 \& ! Time: 230 ! ! Time: 250 ! ! Time: 310 !
420 \& ! Value: 42 ! ! Value: 0.2 ! ! Value: 1,2 !
421 \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+
422 .Ve
423 .PP
424 The above diagram demonstrates:
425 .IP "\(bu" 4
426 Files/values are stored in a (balanced) tree.
427 .IP "\(bu" 4
428 Tree nodes and entries in the update queue are the same data structure.
429 .IP "\(bu" 4
430 The local time (\*(L"First\*(R") and the time specified in updates (\*(L"Time\*(R") may differ.
431 .IP "\(bu" 4
432 Timed out values are inserted at the \*(L"tail\*(R".
433 .IP "\(bu" 4
434 Explicitly flushed values are inserted at the \*(L"head\*(R".
435 .IP "\(bu" 4
436 \&\s-1ASCII\s0 art rocks.
437 .SH "SECURITY CONSIDERATIONS"
438 .IX Header "SECURITY CONSIDERATIONS"
439 .SS "Authentication"
440 .IX Subsection "Authentication"
441 There is no authentication.
442 .PP
443 The client/server protocol does not yet have any authentication mechanism. It
444 is likely that authentication and encryption will be added in a future version,
445 but for the time being it is the administrator's responsibility to secure the
446 traffic from/to the daemon!
447 .PP
448 It is highly recommended to install a packet filter or similar mechanism to
449 prevent unauthorized connections. Unless you have a dedicated \s-1VLAN\s0 or \s-1VPN\s0 for
450 this, using network sockets is probably a bad idea!
451 .SS "Authorization"
452 .IX Subsection "Authorization"
453 There is minimal per-socket authorization.
454 .PP
455 Authorization is currently done on a per-socket basis. That means each socket
456 has a list of commands it will accept and it will accept. It will accept only
457 those commands explicitly listed but it will (currently) accept these commands
458 from anyone reaching the socket.
459 .PP
460 If the networking sockets are to be used, it is necessary to restrict the
461 accepted commands to those needed by external clients. If, for example,
462 external clients want to draw graphs of the cached data, they should only be
463 allowed to use the \f(CW\*(C`FLUSH\*(C'\fR command.
464 .SS "Encryption"
465 .IX Subsection "Encryption"
466 There is no encryption.
467 .PP
468 Again, this may be added in the future, but for the time being it is your job
469 to keep your private data private. Install a \s-1VPN\s0 or an encrypted tunnel if you
470 statistics are confidential!
471 .SS "Sanity checking"
472 .IX Subsection "Sanity checking"
473 There is no sanity checking.
474 .PP
475 The daemon will blindly write to any file it gets told, so you really should
476 create a separate user just for this daemon. Also it does not do any sanity
477 checks, so if it gets told to write values for a time far in the future, your
478 files will be messed up good!
479 .SS "Conclusion"
480 .IX Subsection "Conclusion"
481 .IP "\(bu" 4
482 Security is the job of the administrator.
483 .IP "\(bu" 4
484 We recommend to allow write access via \s-1UNIX\s0 domain sockets only.
485 .IP "\(bu" 4
486 You have been warned.
487 .SH "PROTOCOL"
488 .IX Header "PROTOCOL"
489 The daemon communicates with clients using a line based \s-1ASCII\s0 protocol which is
490 easy to read and easy to type. This makes it easy for scripts to implement the
491 protocol and possible for users to use telnet to connect to the daemon
492 and test stuff \*(L"by hand\*(R".
493 .PP
494 The protocol is line based, this means that each record consists of one or more
495 lines. A line is terminated by the line feed character \f(CW0x0A\fR, commonly
496 written as \f(CW\*(C`\en\*(C'\fR. In the examples below, this character will be written as
497 \&\f(CW\*(C`<LF>\*(C'\fR (\*(L"line feed\*(R").
498 .PP
499 After the connection has been established, the client is expected to send a
500 \&\*(L"command\*(R". A command consists of the command keyword, possibly some arguments,
501 and a terminating newline character. For a list of commands, see
502 \&\*(L"Valid Commands\*(R" below.
503 .PP
504 Example:
505 .PP
506 .Vb 1
507 \& FLUSH /tmp/foo.rrd<LF>
508 .Ve
509 .PP
510 The daemon answers with a line consisting of a status code and a short status
511 message, separated by one or more space characters. A negative status code
512 signals an error, a positive status code or zero signal success. If the status
513 code is greater than zero, it indicates the number of lines that follow the
514 status line.
515 .PP
516 Examples:
517 .PP
518 .Vb 1
519 \& 0 Success<LF>
520 \&
521 \& 2 Two lines follow<LF>
522 \& This is the first line<LF>
523 \& And this is the second line<LF>
524 .Ve
525 .SS "Valid Commands"
526 .IX Subsection "Valid Commands"
527 The following commands are understood by the daemon:
528 .IP "\fB\s-1FLUSH\s0\fR \fIfilename\fR" 4
529 .IX Item "FLUSH filename"
530 Causes the daemon to put \fIfilename\fR to the \fBhead\fR of the update queue
531 (possibly moving it there if the node is already enqueued). The answer will be
532 sent \fBafter\fR the node has been dequeued.
533 .IP "\fB\s-1FLUSHALL\s0\fR" 4
534 .IX Item "FLUSHALL"
535 Causes the daemon to start flushing \s-1ALL\s0 pending values to disk. This
536 returns immediately, even though the writes may take a long time.
537 .IP "\fB\s-1PENDING\s0\fR \fIfilename\fR" 4
538 .IX Item "PENDING filename"
539 Shows any \*(L"pending\*(R" updates for a file, in order. The updates shown have
540 not yet been written to the underlying \s-1RRD\s0 file.
541 .IP "\fB\s-1FORGET\s0\fR \fIfilename\fR" 4
542 .IX Item "FORGET filename"
543 Removes \fIfilename\fR from the cache. Any pending updates \fB\s-1WILL\s0 \s-1BE\s0 \s-1LOST\s0\fR.
544 .IP "\fB\s-1QUEUE\s0\fR" 4
545 .IX Item "QUEUE"
546 Shows the files that are on the output queue. Returns zero or more lines
547 in the following format, where <num_vals> is the number of values
548 to be written for the <file>:
549 .Sp
550 .Vb 1
551 \& <num_vals> <file>
552 .Ve
553 .IP "\fB\s-1HELP\s0\fR [\fIcommand\fR]" 4
554 .IX Item "HELP [command]"
555 Returns a short usage message. If no command is given, or \fIcommand\fR is
556 \&\fB\s-1HELP\s0\fR, a list of commands supported by the daemon is returned. Otherwise a
557 short description, possibly containing a pointer to a manual page, is returned.
558 Obviously, this is meant for interactive usage and the format in which the
559 commands and usage summaries are returned is not well defined.
560 .IP "\fB\s-1STATS\s0\fR" 4
561 .IX Item "STATS"
562 Returns a list of metrics which can be used to measure the daemons performance
563 and check its status. For a description of the values returned, see
564 \&\*(L"Performance Values\*(R" below.
565 .Sp
566 The format in which the values are returned is similar to many other line based
567 protocols: Each value is printed on a separate line, each consisting of the
568 name of the value, a colon, one or more spaces and the actual value.
569 .Sp
570 Example:
571 .Sp
572 .Vb 10
573 \& 9 Statistics follow
574 \& QueueLength: 0
575 \& UpdatesReceived: 30
576 \& FlushesReceived: 2
577 \& UpdatesWritten: 13
578 \& DataSetsWritten: 390
579 \& TreeNodesNumber: 13
580 \& TreeDepth: 4
581 \& JournalBytes: 190
582 \& JournalRotate: 0
583 .Ve
584 .IP "\fB\s-1UPDATE\s0\fR \fIfilename\fR \fIvalues\fR [\fIvalues\fR ...]" 4
585 .IX Item "UPDATE filename values [values ...]"
586 Adds more data to a filename. This is \fBthe\fR operation the daemon was designed
587 for, so describing the mechanism again is unnecessary. Read \*(L"\s-1HOW\s0 \s-1IT\s0 \s-1WORKS\s0\*(R"
588 above for a detailed explanation.
589 .Sp
590 Note that rrdcached only accepts absolute timestamps in the update values.
591 Updates strings like \*(L"N:1:2:3\*(R" are automatically converted to absolute
592 time by the \s-1RRD\s0 client library before sending to rrdcached.
593 .IP "\fB\s-1WROTE\s0\fR \fIfilename\fR" 4
594 .IX Item "WROTE filename"
595 This command is written to the journal after a file is successfully
596 written out to disk. It is used during journal replay to determine which
597 updates have already been applied. It is \fIonly\fR valid in the journal; it
598 is not accepted from the other command channels.
599 .IP "\fB\s-1BATCH\s0\fR" 4
600 .IX Item "BATCH"
601 This command initiates the bulk load of multiple commands. This is
602 designed for installations with extremely high update rates, since it
603 permits more than one command to be issued per \fIread()\fR and \fIwrite()\fR.
604 .Sp
605 All commands are executed just as they would be if given individually,
606 except for output to the user. Messages indicating success are
607 suppressed, and error messages are delayed until the client is finished.
608 .Sp
609 Command processing is finished when the client sends a dot (\*(L".\*(R") on its
610 own line. After the client has finished, the server responds with an
611 error count and the list of error messages (if any). Each error messages
612 indicates the number of the command to which it corresponds, and the error
613 message itself. The first user command after \fB\s-1BATCH\s0\fR is command number one.
614 .Sp
615 .Vb 9
616 \& client: BATCH
617 \& server: 0 Go ahead. End with dot \*(Aq.\*(Aq on its own line.
618 \& client: UPDATE x.rrd 1223661439:1:2:3 <\-\-\- command #1
619 \& client: UPDATE y.rrd 1223661440:3:4:5 <\-\-\- command #2
620 \& client: and so on...
621 \& client: .
622 \& server: 2 Errors
623 \& server: 1 message for command 1
624 \& server: 12 message for command 12
625 .Ve
626 .IP "\fB\s-1QUIT\s0\fR" 4
627 .IX Item "QUIT"
628 Disconnect from rrdcached.
629 .SS "Performance Values"
630 .IX Subsection "Performance Values"
631 The following counters are returned by the \fB\s-1STATS\s0\fR command:
632 .IP "\fBQueueLength\fR \fI(unsigned 64bit integer)\fR" 4
633 .IX Item "QueueLength (unsigned 64bit integer)"
634 Number of nodes currently enqueued in the update queue.
635 .IP "\fBUpdatesReceived\fR \fI(unsigned 64bit integer)\fR" 4
636 .IX Item "UpdatesReceived (unsigned 64bit integer)"
637 Number of \s-1UPDATE\s0 commands received.
638 .IP "\fBFlushesReceived\fR \fI(unsigned 64bit integer)\fR" 4
639 .IX Item "FlushesReceived (unsigned 64bit integer)"
640 Number of \s-1FLUSH\s0 commands received.
641 .IP "\fBUpdatesWritten\fR \fI(unsigned 64bit integer)\fR" 4
642 .IX Item "UpdatesWritten (unsigned 64bit integer)"
643 Total number of updates, i.\ e. calls to \f(CW\*(C`rrd_update_r\*(C'\fR, since the
644 daemon was started.
645 .IP "\fBDataSetsWritten\fR \fI(unsigned 64bit integer)\fR" 4
646 .IX Item "DataSetsWritten (unsigned 64bit integer)"
647 Total number of \*(L"data sets\*(R" written to disk since the daemon was
648 started. A data set is one or more values passed to the \fB\s-1UPDATE\s0\fR
649 command. For example: \f(CW\*(C`1223661439:123:456\*(C'\fR is one data set with two
650 values. The term \*(L"data set\*(R" is used to prevent confusion whether
651 individual values or groups of values are counted.
652 .IP "\fBTreeNodesNumber\fR \fI(unsigned 64bit integer)\fR" 4
653 .IX Item "TreeNodesNumber (unsigned 64bit integer)"
654 Number of nodes in the cache.
655 .IP "\fBTreeDepth\fR \fI(unsigned 64bit integer)\fR" 4
656 .IX Item "TreeDepth (unsigned 64bit integer)"
657 Depth of the tree used for fast key lookup.
658 .IP "\fBJournalBytes\fR \fI(unsigned 64bit integer)\fR" 4
659 .IX Item "JournalBytes (unsigned 64bit integer)"
660 Total number of bytes written to the journal since startup.
661 .IP "\fBJournalRotate\fR \fI(unsigned 64bit integer)\fR" 4
662 .IX Item "JournalRotate (unsigned 64bit integer)"
663 Number of times the journal has been rotated since startup.
664 .SH "SIGNALS"
665 .IX Header "SIGNALS"
666 .IP "\s-1SIGINT\s0 and \s-1SIGTERM\s0" 4
667 .IX Item "SIGINT and SIGTERM"
668 The daemon exits normally on receipt of either of these signals. Pending
669 updates are handled in accordance with the \fB\-j\fR and \fB\-F\fR options.
670 .IP "\s-1SIGUSR1\s0" 4
671 .IX Item "SIGUSR1"
672 The daemon exits \s-1AFTER\s0 flushing all updates out to disk. This may take a
673 while.
674 .IP "\s-1SIGUSR2\s0" 4
675 .IX Item "SIGUSR2"
676 The daemon exits immediately, without flushing updates out to disk.
677 Pending updates will be replayed from the journal when the daemon starts
678 up again. \fB\s-1WARNING:\s0 if journaling (\-j) is \s-1NOT\s0 enabled, any pending
679 updates \s-1WILL\s0 \s-1BE\s0 \s-1LOST\s0\fR.
680 .SH "BUGS"
681 .IX Header "BUGS"
682 No known bugs at the moment.
683 .SH "SEE ALSO"
684 .IX Header "SEE ALSO"
685 rrdtool, rrdgraph
686 .SH "AUTHOR"
687 .IX Header "AUTHOR"
688 \&\fBrrdcached\fR and this manual page have been written by Florian Forster
689 <octo\ at\ verplant.org>.
690 .SH "CONTRIBUTORS"
691 .IX Header "CONTRIBUTORS"
692 kevin brintnall <kbrint@rufus.net>