ebfc479825dcbe79db46fe53e10588f29765fce9
[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<DEF:>I<vname>B<=>I<rrd>B<:>I<ds-name>B<:>I<CF>
52
53 See I<rrdgraph> documentation.
54
55 =item B<CDEF:>I<vname>B<=>I<rpn-expression>
56
57 See I<rrdgraph> documentation.
58
59 =item B<XPORT:>I<vname>B<:>B<:>I<legend>
60
61 At least one I<XPORT> statement should be present. The values
62 referenced by I<vname> are printed. Optionally add a legend.
63
64 =back
65
66 =head1 Output format
67
68 The output is enclosed in an B<xport> element and contains two
69 blocks. The first block is enclosed by a B<meta> element and
70 contains some meta data. The second block is enclosed by a
71 B<data> element and contains the data rows.
72
73 Let's assume that the I<xport> command looks like this:
74
75   rrdtool xport \
76           --start now-1h --end now \
77           DEF:xx=host-inout.lo.rrd:output:AVERAGE \
78           DEF:yy=host-inout.lo.rrd:input:AVERAGE \
79           CDEF:aa=xx,yy,+,8,* \
80           XPORT:xx:"out bytes" \
81           XPORT:aa:"in and out bits"
82
83 The resulting meta data section is (the values will depend on the
84 RRD characteristics):
85
86   <meta>
87     <start>1020611700</start>
88     <step>300</step>
89     <end>1020615600</end>
90     <rows>14</rows>
91     <columns>2</columns>
92     <legend>
93       <entry>out bytes</entry>
94       <entry>in and out bits</entry>
95     </legend>
96   </meta>
97
98 The resulting data section is:
99
100   <data>
101     <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
102     <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
103     <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
104     <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row>
105     <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
106     <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
107     <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
108     <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
109     <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
110     <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
111     <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row>
112     <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
113     <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
114     <row><t>1020615600</t><v>NaN</v><v>NaN</v></row>
115   </data>
116
117
118 =head1 EXAMPLE 1
119
120   rrdtool xport \
121           DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
122           XPORT:out:"out bytes"
123
124 =head1 EXAMPLE 2
125
126   rrdtool xport \
127           DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
128           DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
129           CDEF:sum=out1,out2,+ \
130           XPORT:out1:"if1 out bytes" \
131           XPORT:out2:"if2 out bytes" \
132           XPORT:sum:"output sum"
133
134
135 =head1 AUTHOR
136
137 Tobias Oetiker E<lt>oetiker@ee.ethz.chE<gt>
138