RRDXPORT(1)

✨ RRDXPORT(1) ✨ β€” the rrdtool girlie's guide to xporting ur data

okay bestie, so this is rrdxport from the rrdtool fam, and honestly? it's lowkey one of the most useful ones. let's get into it πŸ’…


🌸 NAME 🌸

rrdxport β€” export data in XML format based on data from one or several RRD. that's the whole vibe. you got RRD files, you want them out as XML, this is the girl for the job πŸŽ€


πŸ¦‹ 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[:legend]]

πŸ‘‘ DESCRIPTION πŸ‘‘

so the xport function's main character purpose is literally to write an XML formatted representation of the data stored in one or several RRDs. that's the job, that's the assignment, she ate. ✨ it can also extract numerical reports, which is a whole extra slay.

⚠️ real talk: if no XPORT statements are found, there will be no output. like, none. zero. nothing. the void. don't come crying to me πŸ’€

πŸ“ the options, one by one

  • -s|--start seconds (default end-1day) β€” the time when the exported range should begin. time in seconds since epoch (1970-01-01) is required, no cap. negative numbers are relative to the current time. by default one day worth of data will be printed. also peep "AT-STYLE TIME SPECIFICATION" in rrdfetch for a detailed explanation 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. also see "AT-STYLE TIME SPECIFICATION" in rrdfetch for a detailed 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. she's the same girl with a new name, iykyk πŸ’…
  • -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. iconic behaviour honestly πŸ”₯ 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. that's it. that's the tweet ⭐
  • --json β€” produce json formatted output (instead of xml). a little plot twist, we love a format option 🌈
  • --enumds β€” the generated xml should contain the data values in enumerated tags. like so:
<v0>val</v0><v1>val</v1>
  • 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 (remember the whole "no output" situation?). 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. two blocks, one vibe check, both slaying πŸ’…

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 characteristics):

<meta>
  <start>1020611700</start>
  <step>300</step>
  <end>1020615600</end>
  <rows>14</rows>
  <columns>2</columns>
  <legend>
    <entry>out bytes</entry>
    <entry>in and out bits</entry>
  </legend>
</meta>

the resulting data section is:

<data>
  <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row>
  <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row>
  <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
  <row><t>1020615600</t><v>NaN</v><v>NaN</v></row>
</data>

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 sample will be the one ending at or immediately after --end. πŸ“

each sample has a timestamp and one or more values. the timestamps associated 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. periodt. πŸ’€

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. this is the lore, bestie, and the lore matters 🧚

so the time range for a sample with a timestamp is actually from timestamp - step inclusive to timestamp exclusive. inclusive start, exclusive end β€” write that down πŸ“

the first line of the sample output:

    <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>

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, because the value was taken at 1020611700. math is mathing, we love to see it πŸ’–


🌈 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. cmdline stays winning, no cap πŸ‘‘

πŸ’œ AUTHOR πŸ’œ

Tobias Oetiker <tobi@oetiker.ch> β€” the icon, the legend, the moment 🫢


and that's the whole page bestie! this one's 1.11.0, dated 2026-10-17, from the rrdtool source, RRDXPORT(1) β€” go forth and xport ur little heart out πŸŒΈπŸ’…βœ¨

πŸ“¦ where this page comes from