RRDXPORT(1) rrdtool RRDXPORT(1)
NAME
rrdxport - Export data in XML format based on data from one or several RRD
SYNOPSIS
rrdtool xport [-s|--start seconds] [-e|--end seconds] [-m|--maxrows rows]
[-S|--step value] [--json] [-t|--showtime] [--enumds] [--daemon|-d address]
[DEF:vname=rrd:ds-name:CF] [CDEF:vname=rpn-expression] [XPORT:vname[:leg-
end]]
DESCRIPTION
The xport function's main purpose is to write an XML formatted representa-
tion of the data stored in one or several RRDs. It can also extract numeri-
cal reports.
If no XPORT statements are found, there will be no output.
-s|--start seconds (default end-1day)
The time when the exported range should begin. Time in seconds since
epoch (1970-01-01) is required. Negative numbers are relative to the
current time. By default one day worth of data will be printed. See
also "AT-STYLE TIME SPECIFICATION" in rrdfetch for a detailed explana-
tion on how to specify time.
See "OUTPUT FORMAT" below for details on how this affects the output.
-e|--end seconds (default now)
The time when the exported range should end. Time in seconds since
epoch. See also "AT-STYLE TIME SPECIFICATION" in rrdfetch for a de-
tailed explanation on how to specify time.
See "OUTPUT FORMAT" below for details on how this affects the output.
-m|--maxrows rows (default 400 rows)
This works like the -w|--width parameter of rrdgraph. In fact it is
exactly the same, but the parameter was renamed to describe its purpose
in this module. See rrdgraph documentation for details.
-S|--step value (default automatic)
See rrdgraph documentation.
--daemon|-d address
Address of the rrdcached daemon. If specified, a "flush" command is
sent to the server before reading the RRD files. This allows rrdtool to
return fresh data even if the daemon is configured to cache values for
a long time. For a list of accepted formats, see the -l option in the
rrdcached manual.
rrdtool xport --daemon unix:/var/run/rrdcached.sock ...
-t|--showtime
include the time into each data row.
--json
produce json formatted output (instead of xml)
--enumds
The generated xml should contain the data values in enumerated tags.
valval
DEF:vname=rrd:ds-name:CF
See rrdgraph documentation.
CDEF:vname=rpn-expression
See rrdgraph documentation.
XPORT:vname[:legend]
At least one XPORT statement should be present. The values referenced
by vname are printed. Optionally add a legend.
OUTPUT FORMAT
The output is enclosed in an xport element and contains two blocks. The
first block is enclosed by a meta element and contains some meta data. The
second block is enclosed by a data element and contains the data rows.
Let's assume that the xport command looks like this:
rrdtool xport \
--start now-1h --end now \
DEF:xx=host-inout.lo.rrd:output:AVERAGE \
DEF:yy=host-inout.lo.rrd:input:AVERAGE \
CDEF:aa=xx,yy,+,8,* \
XPORT:xx:"out bytes" \
XPORT:aa:"in and out bits"
The resulting meta data section is (the values will depend on the RRD char-
acteristics):
1020611700
300
1020615600
14
2
The resulting data section is:
10206117003.4000000000e+005.4400000000e+01
10206120003.4000000000e+005.4400000000e+01
10206123003.4000000000e+005.4400000000e+01
10206126003.4113333333e+005.4581333333e+01
10206129003.4000000000e+005.4400000000e+01
10206132003.4000000000e+005.4400000000e+01
10206135003.4000000000e+005.4400000000e+01
10206138003.4000000000e+005.4400000000e+01
10206141003.4000000000e+005.4400000000e+01
10206144003.4000000000e+005.4400000000e+01
10206147003.7333333333e+005.9733333333e+01
10206150003.4000000000e+005.4400000000e+01
10206153003.4000000000e+005.4400000000e+01
1020615600NaNNaN
All the statistics in the output will use the same step. The first sample
will be the first sample starting immediately after --start. The last sam-
ple will be the one ending at or immediately after --end.
Each sample has a timestamp and one or more values. The timestamps associ-
ated with a value in RRDtool ALWAYS represent the time the sample was
taken. Since any value you sample will represent some sort of past state
your sampling apparatus has gathered, the timestamp will always be at the
end of the sampling period.
RRDtool does not store the actual samples, but does internal resampling of
the values presented to it. Nevertheless when a data value is presented
with a single timestamp the timestamp is at the end of the period the value
represents. Note that the timestamp itself is outside the period the sample
is valid for. For more details about this, see PDP calculation explanation.
So the time range for a sample with a timestamp is actually from "timestamp
- step" inclusive to "timestamp" exclusive.
The first line of the sample output:
10206117003.4000000000e+005.4400000000e+01
therefore means that the values for the interval 1020611400 to 1020611699
were 3.4 and 54.4 for "out bytes" and "in and out bits" respectively, be-
cause the value was taken at 1020611700.
EXAMPLE 1
rrdtool xport \
DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
XPORT:out:"out bytes"
EXAMPLE 2
rrdtool xport \
DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
CDEF:sum=out1,out2,+ \
XPORT:out1:"if1 out bytes" \
XPORT:out2:"if2 out bytes" \
XPORT:sum:"output sum"
ENVIRONMENT VARIABLES
The following environment variables may be used to change the behavior of
"rrdtool xport":
RRDCACHED_ADDRESS
If this environment variable is set it will have the same effect as
specifying the "--daemon" option on the command line. If both are
present, the command line argument takes precedence.
AUTHOR
Tobias Oetiker
1.10.3 2026-05-25 RRDXPORT(1)