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