.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RRDCACHED 1" .TH RRDCACHED 1 "2013-05-23" "1.4.8" "rrdtool" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" rrdcached \- Data caching daemon for rrdtool .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBrrdcached\fR [\fB\-P\fR\ \fIpermissions\fR] [\fB\-l\fR\ \fIaddress\fR] [\fB\-s\fR\ \fIgroup\fR] [\fB\-w\fR\ \fItimeout\fR] [\fB\-z\fR\ \fIdelay\fR] [\fB\-f\fR\ \fItimeout\fR] [\fB\-p\fR\ \fIpid_file\fR] [\fB\-t\fR\ \fIwrite_threads\fR] [\fB\-j\fR\ \fIjournal_dir\fR] [\-F] [\-g] [\fB\-b\fR\ \fIbase_dir\fR\ [\fB\-B\fR]] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBrrdcached\fR is a daemon that receives updates to existing \s-1RRD\s0 files, accumulates them and, if enough have been received or a defined time has passed, writes the updates to the \s-1RRD\s0 file. A \fIflush\fR command may be used to force writing of values to disk, so that graphing facilities and similar can work with up-to-date data. .PP The daemon was written with big setups in mind. Those setups usually run into \&\s-1IO\s0\ related problems sooner or later for reasons that are beyond the scope of this document. Check the wiki at the RRDtool homepage for details. Also check \*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" below before using this daemon! A detailed description of how the daemon operates can be found in the \*(L"\s-1HOW\s0 \s-1IT\s0 \s-1WORKS\s0\*(R" section below. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-l\fR \fIaddress\fR" 4 .IX Item "-l address" Tells the daemon to bind to \fIaddress\fR and accept incoming connections on that socket. If \fIaddress\fR begins with \f(CW\*(C`unix:\*(C'\fR, everything following that prefix is interpreted as the path to a \s-1UNIX\s0 domain socket. Otherwise the address or node name are resolved using \f(CW\*(C`getaddrinfo()\*(C'\fR. .Sp For network sockets, a port may be specified by using the form \&\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 qualified domain name (i.\ e. the address contains at least one dot (\f(CW\*(C`.\*(C'\fR)), the square brackets can be omitted, resulting in the (simpler) \&\f(CW\*(C`\f(CIaddress\f(CW\f(CB:\f(CW\f(CIport\f(CW\*(C'\fR pattern. The default port is \fB42217/tcp\fR. If you specify a network socket, it is mandatory to read the \&\*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" section. .Sp The following formats are accepted. Please note that the address of the \s-1UNIX\s0 domain socket \fBmust\fR start with a slash in the second case! .Sp .Vb 5 \& unix: \& / \& \& []: \& : .Ve .Sp If the \fB\-l\fR option is not specified the default address, \&\f(CW\*(C`unix:/tmp/rrdcached.sock\*(C'\fR, will be used. .IP "\fB\-s\fR \fIgroup_name\fR|\fIgid\fR" 4 .IX Item "-s group_name|gid" Set the group permissions of a \s-1UNIX\s0 domain socket. The option accepts either a numeric group id or group name. That group will then have both read and write permissions (the socket will have file permissions 0750) for the socket and, therefore, is able to send commands to the daemon. This may be useful in cases where you cannot easily run all \s-1RRD\s0 processes with the same user privileges (e.g. graph generating \s-1CGI\s0 scripts that typically run in the permission context of the web server). .Sp This option affects the \fIfollowing\fR \s-1UNIX\s0 socket addresses (the following \&\fB\-l\fR options) or the default socket (if no \fB\-l\fR options have been specified), i.e., you may specify different settings for different sockets. .Sp The default is not to change ownership or permissions of the socket and, thus, use the system default. .IP "\fB\-m\fR \fImode\fR" 4 .IX Item "-m mode" Set the file permissions of a \s-1UNIX\s0 domain socket. The option accepts an octal number representing the bit pattern for the mode (see \fIchmod\fR\|(1) for details). .Sp Please note that not all systems honor this setting. On Linux, read/write permissions are required to connect to a \s-1UNIX\s0 socket. However, many BSD-derived systems ignore permissions for \s-1UNIX\s0 sockets. See \fIunix\fR\|(7) for details. .Sp This option affects the \fIfollowing\fR \s-1UNIX\s0 socket addresses (the following \&\fB\-l\fR options) or the default socket (if no \fB\-l\fR options have been specified), i.e., you may specify different settings for different sockets. .Sp The default is not to change ownership or permissions of the socket and, thus, use the system default. .IP "\fB\-P\fR \fIcommand\fR[,\fIcommand\fR[,...]]" 4 .IX Item "-P command[,command[,...]]" Specifies the commands accepted via a network socket. This allows administrators of \fIRRDCacheD\fR to control the actions accepted from various sources. .Sp The arguments given to the \fB\-P\fR option is a comma separated list of commands. For example, to allow the \f(CW\*(C`FLUSH\*(C'\fR and \f(CW\*(C`PENDING\*(C'\fR commands one could specify: .Sp .Vb 1 \& rrdcached \-P FLUSH,PENDING $MORE_ARGUMENTS .Ve .Sp The \fB\-P\fR option affects the \fIfollowing\fR socket addresses (the following \fB\-l\fR options) or the default socket (if no \fB\-l\fR options have been specified). In the following example, only the IPv4 network socket (address \&\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: .Sp .Vb 1 \& rrdcached \-l unix:/some/path \-P FLUSH,PENDING \-l 10.0.0.1 .Ve .Sp A complete list of available commands can be found in the section \&\*(L"Valid Commands\*(R" below. There are two minor special exceptions: .RS 4 .IP "\(bu" 4 The \f(CW\*(C`HELP\*(C'\fR and \f(CW\*(C`QUIT\*(C'\fR commands are always allowed. .IP "\(bu" 4 If the \f(CW\*(C`BATCH\*(C'\fR command is accepted, the \fB.\fR\ command will automatically be accepted, too. .RE .RS 4 .Sp Please also read \*(L"\s-1SECURITY\s0 \s-1CONSIDERATIONS\s0\*(R" below. .RE .IP "\fB\-w\fR \fItimeout\fR" 4 .IX Item "-w timeout" Data is written to disk every \fItimeout\fR seconds. If this option is not specified the default interval of 300\ seconds will be used. .IP "\fB\-z\fR \fIdelay\fR" 4 .IX Item "-z delay" If specified, rrdcached will delay writing of each \s-1RRD\s0 for a random number of seconds in the range\ [0,\fIdelay\fR). This will avoid too many writes being queued simultaneously. This value should be no greater than the value specified in \fB\-w\fR. By default, there is no delay. .IP "\fB\-f\fR \fItimeout\fR" 4 .IX Item "-f timeout" Every \fItimeout\fR seconds the entire cache is searched for old values which are written to disk. This only concerns files to which updates have stopped, so setting this to a high value, such as 3600\ seconds, is acceptable in most cases. This timeout defaults to 3600\ seconds. .IP "\fB\-p\fR \fIfile\fR" 4 .IX Item "-p file" Sets the name and location of the PID-file. If not specified, the default, \&\f(CW\*(C`\f(CI$localststedir\f(CW/run/rrdcached.pid\*(C'\fR will be used. .IP "\fB\-t\fR \fIwrite_threads\fR" 4 .IX Item "-t write_threads" Specifies the number of threads used for writing \s-1RRD\s0 files. The default is\ 4. Increasing this number will allow rrdcached to have more simultaneous I/O requests into the kernel. This may allow the kernel to re-order disk writes, resulting in better disk throughput. .IP "\fB\-j\fR \fIdir\fR" 4 .IX Item "-j dir" Write updates to a journal in \fIdir\fR. In the event of a program or system crash, this will allow the daemon to write any updates that were pending at the time of the crash. .Sp On startup, the daemon will check for journal files in this directory. If found, all updates therein will be read into memory before the daemon starts accepting new connections. .Sp The journal will be rotated with the same frequency as the flush timer given by \fB\-f\fR. .Sp When journaling is enabled, the daemon will use a fast shutdown procedure. Rather than flushing all files to disk, it will make sure the journal is properly written and exit immediately. Although the \s-1RRD\s0 data files are not fully up-to-date, no information is lost; all pending updates will be replayed from the journal next time the daemon starts up. .Sp To disable fast shutdown, use the \fB\-F\fR option. .IP "\fB\-F\fR" 4 .IX Item "-F" \&\s-1ALWAYS\s0 flush all updates to the \s-1RRD\s0 data files when the daemon is shut down, regardless of journal setting. .IP "\fB\-g\fR" 4 .IX Item "-g" Run in the foreground. The daemon will not \fIfork()\fR. .IP "\fB\-b\fR \fIdir\fR" 4 .IX Item "-b dir" The daemon will change into a specific directory at startup. All files passed to the daemon, that are specified by a \fBrelative\fR path, will be interpreted to be relative to this directory. If not given the default, \f(CW\*(C`/tmp\*(C'\fR, will be used. .Sp .Vb 10 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& ! Command line ! File updated ! \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& ! foo.rrd ! /tmp/foo.rrd ! \& ! foo/bar.rrd ! /tmp/foo/bar.rrd ! \& ! /var/lib/rrd/foo.rrd ! /var/lib/rrd/foo.rrd ! \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& Paths given on the command line and paths actually \& updated by the daemon, assuming the base directory \& "/tmp". .Ve .Sp \&\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 symbolic links. In other words, if the base directory is specified as: .Sp .Vb 1 \& \-b /base/dir/somewhere .Ve .Sp \&... then \fB\s-1NONE\s0\fR of the following should be symbolic links: .Sp .Vb 3 \& /base \& /base/dir \& /base/dir/somewhere .Ve .IP "\fB\-B\fR" 4 .IX Item "-B" Only permit writes into the base directory specified in \fB\-b\fR (and any sub-directories). This does \fB\s-1NOT\s0\fR detect symbolic links. Paths containing \f(CW\*(C`../\*(C'\fR will also be blocked. .SH "AFFECTED RRDTOOL COMMANDS" .IX Header "AFFECTED RRDTOOL COMMANDS" The following commands may be made aware of the \fBrrdcached\fR using the command line argument \fB\-\-daemon\fR or the environment variable \fB\s-1RRDCACHED_ADDRESS\s0\fR: .IP "\(bu" 4 dump .IP "\(bu" 4 fetch .IP "\(bu" 4 flush .IP "\(bu" 4 graph .IP "\(bu" 4 graphv .IP "\(bu" 4 info .IP "\(bu" 4 last .IP "\(bu" 4 lastupdate .IP "\(bu" 4 update .IP "\(bu" 4 xport .PP The \fBupdate\fR command can send values to the daemon instead of writing them to the disk itself. All other commands can send a \fB\s-1FLUSH\s0\fR command (see below) to the daemon before accessing the files, so they work with up-to-date data even if the cache timeout is large. .SH "ERROR REPORTING" .IX Header "ERROR REPORTING" The daemon reports errors in one of two ways: During startup, error messages are printed to \f(CW\*(C`STDERR\*(C'\fR. One of the steps when starting up is to fork to the background and closing \f(CW\*(C`STDERR\*(C'\fR \- after this writing directly to the user is no longer possible. Once this has happened, the daemon will send log messages to the system logging daemon using \fIsyslog\fR\|(3). The facility used is \&\f(CW\*(C`LOG_DAEMON\*(C'\fR. .SH "HOW IT WORKS" .IX Header "HOW IT WORKS" When receiving an update, \fBrrdcached\fR does not write to disk but looks for an entry for that file in its internal tree. If not found, an entry is created including the current time (called \*(L"First\*(R" in the diagram below). This time is \&\fBnot\fR the time specified on the command line but the time the operating system considers to be \*(L"now\*(R". The value and time of the value (called \*(L"Time\*(R" in the diagram below) are appended to the tree node. .PP When appending a value to a tree node, it is checked whether it's time to write the values to disk. Values are written to disk if \&\f(CW\*(C`now()\ \-\ First\ >=\ timeout\*(C'\fR, where \f(CW\*(C`timeout\*(C'\fR is the timeout specified using the \fB\-w\fR option, see \*(L"\s-1OPTIONS\s0\*(R". If the values are \*(L"old enough\*(R" they will be enqueued in the \*(L"update queue\*(R", i.\ e. they will be appended to the linked list shown below. Because the tree nodes and the elements of the linked list are the same data structures in memory, any update to a file that has already been enqueued will be written with the next write to the \s-1RRD\s0 file, too. .PP A separate \*(L"update thread\*(R" constantly dequeues the first element in the update queue and writes all its values to the appropriate file. So as long as the update queue is not empty files are written at the highest possible rate. .PP Since the timeout of files is checked only when new values are added to the file, \*(L"dead\*(R" files, i.\ e. files that are not updated anymore, would never be written to disk. Therefore, every now and then, controlled by the \fB\-f\fR option, the entire tree is walked and all \*(L"old\*(R" values are enqueued. Since this only affects \*(L"dead\*(R" files and walking the tree is relatively expensive, you should set the \*(L"flush interval\*(R" to a reasonably high value. The default is 3600\ seconds (one hour). .PP The downside of caching values is that they won't show up in graphs generated from the \s-1RRD\s0\ files. To get around this, the daemon provides the \*(L"flush command\*(R" to flush specific files. This means that the file is inserted at the \&\fBhead\fR of the update queue or moved there if it is already enqueued. The flush command will return only after the file's pending updates have been written to disk. .PP .Vb 10 \& +\-\-\-\-\-\-+ +\-\-\-\-\-\-+ +\-\-\-\-\-\-+ \& ! head ! ! root ! ! tail ! \& +\-\-\-+\-\-+ +\-\-\-+\-\-+ +\-\-\-+\-\-+ \& ! /\e ! \& ! / \e ! \& ! /\e /\e ! \& ! /\e/\e \e \`\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- ... \-\-\-\-\-\-\-\-, ! \& V / \`\-\-\-\-\-\-\-, ! V \& +\-\-\-+\-\-\-\-+\-\-\-+ +\-\-\-\-\-\-+\-\-\-\-\-+ +\-\-\-+\-\-\-\-+\-\-\-+ \& ! File: foo ! ! File: bar ! ! File: qux ! \& ! First: 101 ! ! First: 119 ! ! First: 180 ! \& ! Next:&bar \-+\-\-\->! Next:&... \-+\-\-\-> ... \-\-\->! Next:NULL ! \& | Prev:NULL !<\-\-\-+\-Prev:&foo !<\-\-\- ... \-\-\-\-+\-Prev: &... ! \& +============+ +============+ +============+ \& ! Time: 100 ! ! Time: 120 ! ! Time: 180 ! \& ! Value: 10 ! ! Value: 0.1 ! ! Value: 2,2 ! \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ \& ! Time: 110 ! ! Time: 130 ! ! Time: 190 ! \& ! Value: 26 ! ! Value: 0.1 ! ! Value: 7,3 ! \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ \& : : : : : : \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ \& ! Time: 230 ! ! Time: 250 ! ! Time: 310 ! \& ! Value: 42 ! ! Value: 0.2 ! ! Value: 1,2 ! \& +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ .Ve .PP The above diagram demonstrates: .IP "\(bu" 4 Files/values are stored in a (balanced) tree. .IP "\(bu" 4 Tree nodes and entries in the update queue are the same data structure. .IP "\(bu" 4 The local time (\*(L"First\*(R") and the time specified in updates (\*(L"Time\*(R") may differ. .IP "\(bu" 4 Timed out values are inserted at the \*(L"tail\*(R". .IP "\(bu" 4 Explicitly flushed values are inserted at the \*(L"head\*(R". .IP "\(bu" 4 \&\s-1ASCII\s0 art rocks. .SH "SECURITY CONSIDERATIONS" .IX Header "SECURITY CONSIDERATIONS" .SS "Authentication" .IX Subsection "Authentication" If your rrdtool installation was built without libwrap there is no form of authentication for clients connecting to the rrdcache daemon! .PP If your rrdtool installation was built with libwrap then you can use hosts_access to restrict client access to the rrdcache daemon (rrdcached). For more information on how to use hosts_access to restrict access to the rrdcache daemon you should read the \fIhosts_access\fR\|(5) man pages. .PP It is still highly recommended to install a packet filter or similar mechanism to prevent unauthorized connections. Unless you have a dedicated \s-1VLAN\s0 or \s-1VPN\s0 for this, using network sockets is probably a bad idea! .SS "Authorization" .IX Subsection "Authorization" There is minimal per-socket authorization. .PP Authorization is currently done on a per-socket basis. That means each socket has a list of commands it will accept and it will accept. It will accept only those commands explicitly listed but it will (currently) accept these commands from anyone reaching the socket. .PP If the networking sockets are to be used, it is necessary to restrict the accepted commands to those needed by external clients. If, for example, external clients want to draw graphs of the cached data, they should only be allowed to use the \f(CW\*(C`FLUSH\*(C'\fR command. .SS "Encryption" .IX Subsection "Encryption" There is no encryption. .PP Again, this may be added in the future, but for the time being it is your job to keep your private data private. Install a \s-1VPN\s0 or an encrypted tunnel if you statistics are confidential! .SS "Sanity checking" .IX Subsection "Sanity checking" There is no sanity checking. .PP The daemon will blindly write to any file it gets told, so you really should create a separate user just for this daemon. Also it does not do any sanity checks, so if it gets told to write values for a time far in the future, your files will be messed up good! .SS "Conclusion" .IX Subsection "Conclusion" .IP "\(bu" 4 Security is the job of the administrator. .IP "\(bu" 4 We recommend to allow write access via \s-1UNIX\s0 domain sockets only. .IP "\(bu" 4 You have been warned. .SH "PROTOCOL" .IX Header "PROTOCOL" The daemon communicates with clients using a line based \s-1ASCII\s0 protocol which is easy to read and easy to type. This makes it easy for scripts to implement the protocol and possible for users to use telnet to connect to the daemon and test stuff \*(L"by hand\*(R". .PP The protocol is line based, this means that each record consists of one or more lines. A line is terminated by the line feed character \f(CW0x0A\fR, commonly written as \f(CW\*(C`\en\*(C'\fR. In the examples below, this character will be written as \&\f(CW\*(C`\*(C'\fR (\*(L"line feed\*(R"). .PP After the connection has been established, the client is expected to send a \&\*(L"command\*(R". A command consists of the command keyword, possibly some arguments, and a terminating newline character. For a list of commands, see \&\*(L"Valid Commands\*(R" below. .PP Example: .PP .Vb 1 \& FLUSH /tmp/foo.rrd .Ve .PP The daemon answers with a line consisting of a status code and a short status message, separated by one or more space characters. A negative status code signals an error, a positive status code or zero signal success. If the status code is greater than zero, it indicates the number of lines that follow the status line. .PP Examples: .PP .Vb 1 \& 0 Success \& \& 2 Two lines follow \& This is the first line \& And this is the second line .Ve .SS "Valid Commands" .IX Subsection "Valid Commands" The following commands are understood by the daemon: .IP "\fB\s-1FLUSH\s0\fR \fIfilename\fR" 4 .IX Item "FLUSH filename" Causes the daemon to put \fIfilename\fR to the \fBhead\fR of the update queue (possibly moving it there if the node is already enqueued). The answer will be sent \fBafter\fR the node has been dequeued. .IP "\fB\s-1FLUSHALL\s0\fR" 4 .IX Item "FLUSHALL" Causes the daemon to start flushing \s-1ALL\s0 pending values to disk. This returns immediately, even though the writes may take a long time. .IP "\fB\s-1PENDING\s0\fR \fIfilename\fR" 4 .IX Item "PENDING filename" Shows any \*(L"pending\*(R" updates for a file, in order. The updates shown have not yet been written to the underlying \s-1RRD\s0 file. .IP "\fB\s-1FORGET\s0\fR \fIfilename\fR" 4 .IX Item "FORGET filename" Removes \fIfilename\fR from the cache. Any pending updates \fB\s-1WILL\s0 \s-1BE\s0 \s-1LOST\s0\fR. .IP "\fB\s-1QUEUE\s0\fR" 4 .IX Item "QUEUE" Shows the files that are on the output queue. Returns zero or more lines in the following format, where is the number of values to be written for the : .Sp .Vb 1 \& .Ve .IP "\fB\s-1HELP\s0\fR [\fIcommand\fR]" 4 .IX Item "HELP [command]" Returns a short usage message. If no command is given, or \fIcommand\fR is \&\fB\s-1HELP\s0\fR, a list of commands supported by the daemon is returned. Otherwise a short description, possibly containing a pointer to a manual page, is returned. Obviously, this is meant for interactive usage and the format in which the commands and usage summaries are returned is not well defined. .IP "\fB\s-1STATS\s0\fR" 4 .IX Item "STATS" Returns a list of metrics which can be used to measure the daemons performance and check its status. For a description of the values returned, see \&\*(L"Performance Values\*(R" below. .Sp The format in which the values are returned is similar to many other line based protocols: Each value is printed on a separate line, each consisting of the name of the value, a colon, one or more spaces and the actual value. .Sp Example: .Sp .Vb 10 \& 9 Statistics follow \& QueueLength: 0 \& UpdatesReceived: 30 \& FlushesReceived: 2 \& UpdatesWritten: 13 \& DataSetsWritten: 390 \& TreeNodesNumber: 13 \& TreeDepth: 4 \& JournalBytes: 190 \& JournalRotate: 0 .Ve .IP "\fB\s-1UPDATE\s0\fR \fIfilename\fR \fIvalues\fR [\fIvalues\fR ...]" 4 .IX Item "UPDATE filename values [values ...]" Adds more data to a filename. This is \fBthe\fR operation the daemon was designed for, so describing the mechanism again is unnecessary. Read \*(L"\s-1HOW\s0 \s-1IT\s0 \s-1WORKS\s0\*(R" above for a detailed explanation. .Sp Note that rrdcached only accepts absolute timestamps in the update values. Updates strings like \*(L"N:1:2:3\*(R" are automatically converted to absolute time by the \s-1RRD\s0 client library before sending to rrdcached. .IP "\fB\s-1WROTE\s0\fR \fIfilename\fR" 4 .IX Item "WROTE filename" This command is written to the journal after a file is successfully written out to disk. It is used during journal replay to determine which updates have already been applied. It is \fIonly\fR valid in the journal; it is not accepted from the other command channels. .IP "\fB\s-1BATCH\s0\fR" 4 .IX Item "BATCH" This command initiates the bulk load of multiple commands. This is designed for installations with extremely high update rates, since it permits more than one command to be issued per \fIread()\fR and \fIwrite()\fR. .Sp All commands are executed just as they would be if given individually, except for output to the user. Messages indicating success are suppressed, and error messages are delayed until the client is finished. .Sp Command processing is finished when the client sends a dot (\*(L".\*(R") on its own line. After the client has finished, the server responds with an error count and the list of error messages (if any). Each error messages indicates the number of the command to which it corresponds, and the error message itself. The first user command after \fB\s-1BATCH\s0\fR is command number one. .Sp .Vb 9 \& client: BATCH \& server: 0 Go ahead. End with dot \*(Aq.\*(Aq on its own line. \& client: UPDATE x.rrd 1223661439:1:2:3 <\-\-\- command #1 \& client: UPDATE y.rrd 1223661440:3:4:5 <\-\-\- command #2 \& client: and so on... \& client: . \& server: 2 Errors \& server: 1 message for command 1 \& server: 12 message for command 12 .Ve .IP "\fB\s-1QUIT\s0\fR" 4 .IX Item "QUIT" Disconnect from rrdcached. .SS "Performance Values" .IX Subsection "Performance Values" The following counters are returned by the \fB\s-1STATS\s0\fR command: .IP "\fBQueueLength\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "QueueLength (unsigned 64bit integer)" Number of nodes currently enqueued in the update queue. .IP "\fBUpdatesReceived\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "UpdatesReceived (unsigned 64bit integer)" Number of \s-1UPDATE\s0 commands received. .IP "\fBFlushesReceived\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "FlushesReceived (unsigned 64bit integer)" Number of \s-1FLUSH\s0 commands received. .IP "\fBUpdatesWritten\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "UpdatesWritten (unsigned 64bit integer)" Total number of updates, i.\ e. calls to \f(CW\*(C`rrd_update_r\*(C'\fR, since the daemon was started. .IP "\fBDataSetsWritten\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "DataSetsWritten (unsigned 64bit integer)" Total number of \*(L"data sets\*(R" written to disk since the daemon was started. A data set is one or more values passed to the \fB\s-1UPDATE\s0\fR command. For example: \f(CW\*(C`1223661439:123:456\*(C'\fR is one data set with two values. The term \*(L"data set\*(R" is used to prevent confusion whether individual values or groups of values are counted. .IP "\fBTreeNodesNumber\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "TreeNodesNumber (unsigned 64bit integer)" Number of nodes in the cache. .IP "\fBTreeDepth\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "TreeDepth (unsigned 64bit integer)" Depth of the tree used for fast key lookup. .IP "\fBJournalBytes\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "JournalBytes (unsigned 64bit integer)" Total number of bytes written to the journal since startup. .IP "\fBJournalRotate\fR \fI(unsigned 64bit integer)\fR" 4 .IX Item "JournalRotate (unsigned 64bit integer)" Number of times the journal has been rotated since startup. .SH "SIGNALS" .IX Header "SIGNALS" .IP "\s-1SIGINT\s0 and \s-1SIGTERM\s0" 4 .IX Item "SIGINT and SIGTERM" The daemon exits normally on receipt of either of these signals. Pending updates are handled in accordance with the \fB\-j\fR and \fB\-F\fR options. .IP "\s-1SIGUSR1\s0" 4 .IX Item "SIGUSR1" The daemon exits \s-1AFTER\s0 flushing all updates out to disk. This may take a while. .IP "\s-1SIGUSR2\s0" 4 .IX Item "SIGUSR2" The daemon exits immediately, without flushing updates out to disk. Pending updates will be replayed from the journal when the daemon starts up again. \fB\s-1WARNING:\s0 if journaling (\-j) is \s-1NOT\s0 enabled, any pending updates \s-1WILL\s0 \s-1BE\s0 \s-1LOST\s0\fR. .SH "BUGS" .IX Header "BUGS" No known bugs at the moment. .SH "SEE ALSO" .IX Header "SEE ALSO" rrdtool, rrdgraph .SH "AUTHOR" .IX Header "AUTHOR" Florian Forster .PP Both \fBrrdcached\fR and this manual page have been written by Florian. .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" kevin brintnall