RRDcached patch. This implements an infrastructure, where rrd updates can be
[rrdtool.git] / doc / rrdupdate.pod
1 =head1 NAME
2
3 rrdupdate - Store a new set of values into the RRD
4
5 =head1 SYNOPSIS
6
7 B<rrdtool> {B<update> | B<updatev>} I<filename>
8 S<[B<--template>|B<-t> I<ds-name>[B<:>I<ds-name>]...]>
9 S<[B<--daemon> I<address>]>
10 S<B<N>|I<timestamp>B<:>I<value>[B<:>I<value>...]>
11 S<I<at-timestamp>B<@>I<value>[B<:>I<value>...]>
12 S<[I<timestamp>B<:>I<value>[B<:>I<value>...] ...]>
13
14 =head1 DESCRIPTION
15
16 The B<update> function feeds new data values into an B<RRD>. The data
17 is time aligned (interpolated) according to the properties of the
18 B<RRD> to which the data is written.
19
20 =over 8
21
22 =item B<updatev>
23
24 This alternate version of B<update> takes the same arguments and
25 performs the same function. The I<v> stands for I<verbose>, which
26 describes the output returned. B<updatev> returns a list of any and all
27 consolidated data points (CDPs) written to disk as a result of the
28 invocation of update. The values are indexed by timestamp (time_t),
29 RRA (consolidation function and PDPs per CDP), and data source (name).
30 Note that depending on the arguments of the current and previous call to
31 update, the list may have no entries or a large number of entries.
32
33 Since B<updatev> requires direct disk access, the B<--daemon> option cannot be
34 used with this command.
35
36 =item I<filename>
37
38 The name of the B<RRD> you want to update.
39
40 =item B<--template>|B<-t> I<ds-name>[B<:>I<ds-name>]...
41
42 By default, the B<update> function expects its data input in the order
43 the data sources are defined in the RRD, excluding any COMPUTE data
44 sources (i.e. if the third data source B<DST> is COMPUTE, the third
45 input value will be mapped to the fourth data source in the B<RRD> and
46 so on). This is not very error resistant, as you might be sending the
47 wrong data into an RRD.
48
49 The template switch allows you to specify which data sources you are
50 going to update and in which order. If the data sources specified in
51 the template are not available in the RRD file, the update process
52 will abort with an error message.
53
54 While it appears possible with the template switch to update data sources
55 asynchronously, B<RRDtool> implicitly assigns non-COMPUTE data sources missing
56 from the template the I<*UNKNOWN*> value.
57
58 Do not specify a value for a COMPUTE B<DST> in the B<update>
59 function. If this is done accidentally (and this can only be done
60 using the template switch), B<RRDtool> will ignore the value specified
61 for the COMPUTE B<DST>.
62
63 =item B<--daemon> I<address>
64
65 If given, B<RRDTool> will try to connect to the caching daemon L<rrdcached>
66 at I<address> and will fail if the connection cannot be established. If the
67 connection is successfully established the values will be sent to the daemon
68 instead of accessing the files directly. If I<address> begins with C<unix:>
69 then everything after this prefix will be considered to be a UNIX domain
70 socket, see L<EXAMPLES> below. Otherwise the address is interpreted as network
71 address or node name as understood by L<getaddrinfo>. One practical
72 consequence is that both, IPv4 and IPv6, may be used if the system supports
73 it. This option is available for the B<update> command only.
74
75 =item B<N>|I<timestamp>B<:>I<value>[B<:>I<value>...]
76
77 The data used for updating the RRD was acquired at a certain
78 time. This time can either be defined in seconds since 1970-01-01 or
79 by using the letter 'N', in which case the update time is set to be
80 the current time. Negative time values are subtracted from the current
81 time. An AT_STYLE TIME SPECIFICATION (see the I<rrdfetch>
82 documentation) may also be used by delimiting the end of the time
83 specification with the '@' character instead of a ':'. Getting the
84 timing right to the second is especially important when you are
85 working with data-sources of type B<COUNTER>, B<DERIVE> or
86 B<ABSOLUTE>.
87
88 The remaining elements of the argument are DS updates. The order of
89 this list is the same as the order the data sources were defined in
90 the RRA. If there is no data for a certain data-source, the letter
91 B<U> (e.g., N:0.1:U:1) can be specified.
92
93 The format of the value acquired from the data source is dependent on
94 the data source type chosen. Normally it will be numeric, but the data
95 acquisition modules may impose their very own parsing of this
96 parameter as long as the colon (B<:>) remains the data source value
97 separator.
98
99 =back
100
101 =head1 ENVIRONMENT VARIABLES
102
103 The following environment variables may be used to change the behavior of
104 C<rrdtoolE<nbsp>update>:
105
106 =over
107
108 =item B<RRDCACHED_ADDRESS>
109
110 If this environment variable is set it will have the same effect as specifying
111 the C<--daemon> option on the command line. If both are present, the command
112 line argument takes precedence.
113
114 =back
115
116 =head1 EXAMPLES
117
118 =over
119
120 =item *
121
122 C<rrdtool update demo1.rrd N:3.44:3.15:U:23>
123
124 Update the database file demo1.rrd with 3 known and one I<*UNKNOWN*>
125 value. Use the current time as the update time.
126
127 =item *
128
129 C<rrdtool update demo2.rrd 887457267:U 887457521:22 887457903:2.7>
130
131 Update the database file demo2.rrd which expects data from a single
132 data-source, three times. First with an I<*UNKNOWN*> value then with two
133 regular readings. The update interval seems to be around 300 seconds.
134
135 =item *
136
137 C<rrdtool update --cache /var/lib/rrd/demo3.rrd N:42>
138
139 Update the file C</var/lib/rrd/demo3.rrd> with a single data source, using the
140 current time. If the caching daemon cannot be reached, do B<not> fall back to
141 direct file access.
142
143 =item *
144
145 C<rrdtool update --daemon unix:/tmp/rrdd.sock demo4.rrd N:23>
146
147 Use the UNIX domain socket C</tmp/rrdd.sock> to contact the caching daemon. If
148 the caching daemon is not available, update the file C<demo4.rrd> directly.
149 B<WARNING:> Since a relative path is specified, the following disturbing effect
150 may occur: If the daemon is available, the file relative to the working
151 directory B<of the daemon> is used. If the daemon is not available, the file
152 relative to the current working directory of the invoking process is used.
153 B<This may update two different files depending on whether the daemon could be
154 reached or not.> Don't do relative paths, kids!
155
156 =back
157
158 =head1 AUTHORS
159
160 Tobias Oetiker <tobi@oetiker.ch>,
161 Florian Forster <octoE<nbsp>atE<nbsp>verplant.org>
162