Skip to content

Instantly share code, notes, and snippets.

@infertux
Created December 19, 2016 12:06
Show Gist options
  • Save infertux/857d3e31fdb359f2958bfe9650e8caa5 to your computer and use it in GitHub Desktop.
Save infertux/857d3e31fdb359f2958bfe9650e8caa5 to your computer and use it in GitHub Desktop.
Bash scripts to export/import RRD files for Collectd
#!/bin/bash -eu
cd /var/lib/collectd/rrd/$HOST
for f in $(find -name *.rrd); do
echo "rrdtool dump $f"
rrdtool dump $f > ${f%.rrd}.xml
done
rsync -avz --exclude *.rrd /var/lib/collectd/rrd/$HOST/ $COLLECTD_HOST:/var/lib/collectd/rrd/$HOST/
#!/bin/bash -eu
cd /var/lib/collectd/rrd/$HOST
for f in $(find -name *.xml); do
echo "rrdtool restore $f"
rrdtool restore -f $f ${f%.xml}.rrd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment