RRD XML data in a backup
-
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
-
"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>
-
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>
-
Sorry for the slow reply.
Thanks for this, will try that tomorrow if I can get it working it will be really helpful.