1RRDXPORT(1)                         rrdtool                        RRDXPORT(1)
2
3
4

NAME

6       rrdxport - Export data in XML format based on data from one or several
7       RRD
8

SYNOPSIS

10       rrdtool xport [-s|--start seconds] [-e|--end seconds]
11       [-m|--maxrows rows] [--step value] [--json] [-t|--showtime] [--enumds]
12       [--daemon|-d address] [DEF:vname=rrd:ds-name:CF] [CDEF:vname=rpn-
13       expression] [XPORT:vname[:legend]]
14

DESCRIPTION

16       The xport function's main purpose is to write an XML formatted
17       representation of the data stored in one or several RRDs. It can also
18       extract numerical reports.
19
20       If no XPORT statements are found, there will be no output.
21
22       -s|--start seconds (default end-1day)
23           The time when the exported range should begin. Time in seconds
24           since epoch (1970-01-01) is required. Negative numbers are relative
25           to the current time. By default one day worth of data will be
26           printed.  See also "AT-STYLE TIME SPECIFICATION" in rrdfetch for a
27           detailed explanation on how to specify time.
28
29           See "OUTPUT FORMAT" below for details on how this affects the
30           output.
31
32       -e|--end seconds (default now)
33           The time when the exported range should end. Time in seconds since
34           epoch.  See also "AT-STYLE TIME SPECIFICATION" in rrdfetch for a
35           detailed explanation on how to specify time.
36
37           See "OUTPUT FORMAT" below for details on how this affects the
38           output.
39
40       -m|--maxrows rows (default 400 rows)
41           This works like the -w|--width parameter of rrdgraph.  In fact it
42           is exactly the same, but the parameter was renamed to describe its
43           purpose in this module. See rrdgraph documentation for details.
44
45       --step value (default automatic)
46           See rrdgraph documentation.
47
48       --daemon|-d address
49           Address of the rrdcached daemon. If specified, a "flush" command is
50           sent to the server before reading the RRD files. This allows
51           rrdtool to return fresh data even if the daemon is configured to
52           cache values for a long time.  For a list of accepted formats, see
53           the -l option in the rrdcached manual.
54
55             rrdtool xport --daemon unix:/var/run/rrdcached.sock ...
56
57       -t|--showtime
58           include the time into each data row.
59
60       --json
61           produce json formatted output (instead of xml)
62
63       --enumds
64           The generated xml should contain the data values in enumerated
65           tags.
66
67            <v0>val</v0><v1>val</v1>
68
69       DEF:vname=rrd:ds-name:CF
70           See rrdgraph documentation.
71
72       CDEF:vname=rpn-expression
73           See rrdgraph documentation.
74
75       XPORT:vname[:legend]
76           At least one XPORT statement should be present. The values
77           referenced by vname are printed. Optionally add a legend.
78

OUTPUT FORMAT

80       The output is enclosed in an xport element and contains two blocks. The
81       first block is enclosed by a meta element and contains some meta data.
82       The second block is enclosed by a data element and contains the data
83       rows.
84
85       Let's assume that the xport command looks like this:
86
87         rrdtool xport \
88                 --start now-1h --end now \
89                 DEF:xx=host-inout.lo.rrd:output:AVERAGE \
90                 DEF:yy=host-inout.lo.rrd:input:AVERAGE \
91                 CDEF:aa=xx,yy,+,8,* \
92                 XPORT:xx:"out bytes" \
93                 XPORT:aa:"in and out bits"
94
95       The resulting meta data section is (the values will depend on the RRD
96       characteristics):
97
98         <meta>
99           <start>1020611700</start>
100           <step>300</step>
101           <end>1020615600</end>
102           <rows>14</rows>
103           <columns>2</columns>
104           <legend>
105             <entry>out bytes</entry>
106             <entry>in and out bits</entry>
107           </legend>
108         </meta>
109
110       The resulting data section is:
111
112         <data>
113           <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
114           <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
115           <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
116           <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row>
117           <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
118           <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
119           <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
120           <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
121           <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
122           <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
123           <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row>
124           <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
125           <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
126           <row><t>1020615600</t><v>NaN</v><v>NaN</v></row>
127         </data>
128
129       All the statistics in the output will use the same step. The first
130       sample will be the first sample starting at or immediately after
131       --start. The last sample will be the one ending at or immediately after
132       --end.
133
134       Each sample has a timestamp and one or more values. The timestamps
135       associated with a value in RRDtool ALWAYS represent the time the sample
136       was taken. Since any value you sample will represent some sort of past
137       state your sampling apparatus has gathered, the timestamp will always
138       be at the end of the sampling period.
139
140       RRDtool does not store the actual samples, but does internal resampling
141       of the values presented to it. Nevertheless when a data value is
142       presented with a single timestamp the timestamp is at the end of the
143       period the value represents. Note that the timestamp itself is outside
144       the period the sample is valid for. For more details about this, see
145       PDP calculation explanation.
146
147       So the time range for a sample with a timestamp is actually from
148       "timestamp - step" inclusive to "timestamp" exclusive.
149
150       The first line of the sample output:
151
152           <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
153
154       therefore means that the values for the interval 1020611700 to
155       1020611999 were 3.4 and 54.4 for "out bytes" and "in and out bits"
156       respectively, as if the value was taken at 1020612000.
157

EXAMPLE 1

159         rrdtool xport \
160                 DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
161                 XPORT:out:"out bytes"
162

EXAMPLE 2

164         rrdtool xport \
165                 DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
166                 DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
167                 CDEF:sum=out1,out2,+ \
168                 XPORT:out1:"if1 out bytes" \
169                 XPORT:out2:"if2 out bytes" \
170                 XPORT:sum:"output sum"
171

ENVIRONMENT VARIABLES

173       The following environment variables may be used to change the behavior
174       of "rrdtool xport":
175
176       RRDCACHED_ADDRESS
177           If this environment variable is set it will have the same effect as
178           specifying the "--daemon" option on the command line. If both are
179           present, the command line argument takes precedence.
180

AUTHOR

182       Tobias Oetiker <tobi@oetiker.ch>
183
184
185
1861.7.1                             2019-02-04                       RRDXPORT(1)
Impressum