rrdxport(1): Document the new `--daemon' option.
[rrdtool.git] / doc / rrdxport.pod
1 =head1 NAME
2
3 rrdxport - Export data in XML format based on data from one or several RRD
4
5 =head1 SYNOPSIS
6
7 B<rrdtool> B<xport>
8 S<[B<-s>|B<--start> I<seconds>]>
9 S<[B<-e>|B<--end> I<seconds>]>
10 S<[B<-m>|B<--maxrows> I<rows>]>
11 S<[B<--step> I<value>]>
12 S<[B<DEF:>I<vname>B<=>I<rrd>B<:>I<ds-name>B<:>I<CF>]>
13 S<[B<CDEF:>I<vname>B<=>I<rpn-expression>]>
14 S<[B<XPORT>B<:>I<vname>[B<:>I<legend>]]>
15
16 =head1 DESCRIPTION
17
18 The B<xport> function's main purpose is to write an XML formatted
19 representation of the data stored in one or several B<RRD>s. It
20 can also extract numerical reports.
21
22 If no I<XPORT> statements are found, there will be no output.
23
24 =over
25
26 =item B<-s>|B<--start> I<seconds> (default end-1day)
27
28 The time when the exported range should begin. Time in seconds since
29 epoch (1970-01-01) is required. Negative numbers are relative to the
30 current time. By default one day worth of data will be printed.
31 See also AT-STYLE TIME SPECIFICATION section in the I<rrdfetch>
32 documentation for a detailed explanation on how to specify time.
33
34 =item B<-e>|B<--end> I<seconds> (default now)
35
36 The time when the exported range should end. Time in seconds since epoch.
37 See also AT-STYLE TIME SPECIFICATION section in the I<rrdfetch>
38 documentation for a detailed explanation of ways to specify time.
39
40 =item B<-m>|B<--maxrows> I<rows> (default 400 rows)
41
42 This works like the B<-w>|B<--width> parameter of I<rrdgraph>.
43 In fact it is exactly the same, but the parameter was renamed to
44 describe its purpose in this module. See I<rrdgraph> documentation
45 for details.
46
47 =item B<--step> I<value> (default automatic)
48
49 See L<rrdgraph> documentation.
50
51 =item B<--daemon> I<address>
52
53 Address of the L<rrdcached(1)> daemon. If specified, a C<flush> command is sent
54 to the server before reading the RRD files. This allows B<rrdtool> to return
55 fresh data even if the daemon is configured to cache values for a long time. To
56 specify a UNIX domain socket use the prefix C<unix:>, see example below. Other
57 addresses are interpreted as normal network addresses, i.E<nbsp>e. IPv4 or IPv6
58 addresses in most cases.
59
60  rrdtool xport --daemon unix:/var/run/rrdcached.sock ...
61
62 =item B<--enumds> 
63
64 The generated xml should contain the data values in enumerated tags.
65
66  <v0>val</v0><v1>val</v1>
67
68 =item B<DEF:>I<vname>B<=>I<rrd>B<:>I<ds-name>B<:>I<CF>
69
70 See I<rrdgraph> documentation.
71
72 =item B<CDEF:>I<vname>B<=>I<rpn-expression>
73
74 See I<rrdgraph> documentation.
75
76 =item B<XPORT:>I<vname>B<:>B<:>I<legend>
77
78 At least one I<XPORT> statement should be present. The values
79 referenced by I<vname> are printed. Optionally add a legend.
80
81 =back
82
83 =head1 Output format
84
85 The output is enclosed in an B<xport> element and contains two
86 blocks. The first block is enclosed by a B<meta> element and
87 contains some meta data. The second block is enclosed by a
88 B<data> element and contains the data rows.
89
90 Let's assume that the I<xport> command looks like this:
91
92   rrdtool xport \
93           --start now-1h --end now \
94           DEF:xx=host-inout.lo.rrd:output:AVERAGE \
95           DEF:yy=host-inout.lo.rrd:input:AVERAGE \
96           CDEF:aa=xx,yy,+,8,* \
97           XPORT:xx:"out bytes" \
98           XPORT:aa:"in and out bits"
99
100 The resulting meta data section is (the values will depend on the
101 RRD characteristics):
102
103   <meta>
104     <start>1020611700</start>
105     <step>300</step>
106     <end>1020615600</end>
107     <rows>14</rows>
108     <columns>2</columns>
109     <legend>
110       <entry>out bytes</entry>
111       <entry>in and out bits</entry>
112     </legend>
113   </meta>
114
115 The resulting data section is:
116
117   <data>
118     <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
119     <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
120     <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
121     <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row>
122     <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
123     <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
124     <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
125     <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
126     <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
127     <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
128     <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row>
129     <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
130     <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
131     <row><t>1020615600</t><v>NaN</v><v>NaN</v></row>
132   </data>
133
134
135 =head1 EXAMPLE 1
136
137   rrdtool xport \
138           DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
139           XPORT:out:"out bytes"
140
141 =head1 EXAMPLE 2
142
143   rrdtool xport \
144           DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
145           DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
146           CDEF:sum=out1,out2,+ \
147           XPORT:out1:"if1 out bytes" \
148           XPORT:out2:"if2 out bytes" \
149           XPORT:sum:"output sum"
150
151 =head1 ENVIRONMENT VARIABLES
152
153 The following environment variables may be used to change the behavior of
154 C<rrdtoolE<nbsp>xport>:
155
156 =over 4
157
158 =item B<RRDCACHED_ADDRESS>
159
160 If this environment variable is set it will have the same effect as specifying
161 the C<--daemon> option on the command line. If both are present, the command
162 line argument takes precedence.
163
164 =back
165
166 =head1 AUTHOR
167
168 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
169