Skip to content

Instantly share code, notes, and snippets.

@Strykar
Created June 12, 2016 17:25
Show Gist options
  • Save Strykar/95e730a7d7cb801758c9afa9b9f16a73 to your computer and use it in GitHub Desktop.
Save Strykar/95e730a7d7cb801758c9afa9b9f16a73 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Two examples for batch conversion of RRD to XML (done on the host the RRD were created on)
# Convert from XML back to RRD on the new host/arch
for f in *.rrd; do rrdtool dump ${f} > ${f}.xml; done
for f in *.xml; do rrdtool restore ${f} `echo ${f} | cut -f1 -d .`.rrd; done
find /tmp/data -type f -iname '*.rrd' -print0|while IFS= read -r -d '' f; do rrdtool dump ${f} > ${f}.xml; done
find /tmp/data -type f -iname '*.xml' -print0|while IFS= read -r -d '' f; do rrdtool restore ${f} `echo ${f} | cut -f1 -d .`.rrd -f; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment