Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    RRD XML data in a backup

    Scheduled Pinned Locked Moved General pfSense Questions
    4 Posts 2 Posters 2.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      TheGPS
      last edited by

      Hi,

      Trying to read the RRD data in a full backup without doing a restore.

      Currently my research into RRD databases points me a at a totally different XML setup as below:

      <rrd><version><step><lastupdate><ds><name><type><step><minimal_heartbeat><min><max><last_ds><value></value></last_ds></max></min></minimal_heartbeat></step></type></name></ds>…
        <rra><cf><pdp_per_row><xff><cdp_prep><ds><value><unknown_datapoints></unknown_datapoints></value></ds>... <cdp_prep><database><row><v>...</v></row> ...</database></cdp_prep></cdp_prep></xff></pdp_per_row></cf></rra> ...</lastupdate></step></version></rrd>

      But what I get in the backup is:

      <rrddatafile><filename>XXXX</filename>
          <xmldata>XXXXXXXXXXXXXXXXXonwards</xmldata></rrddatafile>

      Does anyone know how to convert one to the other?

      Thanks

      1 Reply Last reply Reply Quote 0
      • T
        TheGPS
        last edited by

        "The dump function writes the contents of an RRD in human readable (?) XML format to a file or to stdout"

        The human readable part put me on the wrong path.

        Is there an easy way of finding which version of rrdtool different versions of pfsense use? Mostly interested in 2.2.4 and 2.3.X

        EDIT:

        Get "ERROR: Can only restore version >= 2 (Not ). Dump your rrd using a current rrdtool dump." when trying to do a rrdtool restore.

        EDIT 2:

        2.2.4 is using rrdtool version 1.2.30 - booted up a linux vm to try and get the xml back into rrd data and now getting:

        "ERROR: line 1:expected <xmldata>element but found <rrd>"

        For anyone trying this, it is quicker to download and boot up a VM than it is trying to get newer versions of rrdtool to work under windows FYI.</rrd></xmldata>

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          We couldn't include the rrdtool xml directly in the config, it would be massive! We compress it and then encode it so it can be archived in XML.

          Take the contents of <xmldata>, run it through a base64 decode and then gz inflate, and then you'll have the format of data rrdtool wants.

          For example, when making the backup, it gets run through something like this:

          base64_encode(gzdeflate($xml_data))
          

          And when restoring, this:

          gzinflate(base64_decode($rrd['xmldata']))
          ```</xmldata>

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • T
            TheGPS
            last edited by

            Sorry for the slow reply.

            Thanks for this, will try that tomorrow if I can get it working it will be really helpful.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.