RRD_DIR=/var/lib/munin/openstreetmap
DIR=`mktemp -d`
-NPROCS=8
function cleanup {
-rm -rf "$DIR"
+ rm -rf "$DIR"
}
trap cleanup EXIT
cd "$RRD_DIR"
-find -name "*.rrd" -print0 | xargs --null --max-procs=$NPROCS -I {} rrdtool dump {} "$DIR/{}.xml"
+for f in *.rrd; do
+ rrdtool dump "$f" "$DIR/${f}.xml"
+ touch -r "$f" "$DIR/${f}.xml"
+done
cd "$DIR"
find -name "*.xml" -print0 | tar zcf - --null -T -
MAILTO=zerebubuth@gmail.com
-# do the dump in the early hours of the morning
-43 3 * * * www-data nice /usr/local/bin/rrddump > /srv/munin.openstreetmap.org/dumps/`date "+munin-data-%Y-%m-%d.tar.gz"`
+# do the dump in the early hours of the morning and follow, if successful, by a cleanup of the old files. i don't think these are of any historical interest, so just keep three consecutive.
+43 3 * * * www-data nice /usr/local/bin/rrddump > /srv/munin.openstreetmap.org/dumps/`date "+munin-data-%Y-%m-%d.tar.gz"` && ls -1 /srv/munin.openstreetmap.org/dumps/munin-data-*.tar.gz | sort -r | tail -n +4 | xargs rm -f