--- /dev/null
+#!/bin/bash
+
+RRD_DIR=/var/lib/munin/openstreetmap
+DIR=`mktemp -d`
+NPROCS=8
+
+function cleanup {
+rm -rf "$DIR"
+}
+
+trap cleanup EXIT
+
+cd "$RRD_DIR"
+find -name "*.rrd" -print0 | xargs --null --max-procs=$NPROCS -I {} rrdtool dump {} "$DIR/{}.xml"
+
+cd "$DIR"
+find -name "*.xml" -print0 | tar zcf - --null -T -
files_owner "root"
files_group "root"
files_mode 0o644
- purge true
+end
+
+# directory to put dumped files in
+directory "/srv/munin.openstreetmap.org/dumps" do
+ owner "www-data"
+ group "www-data"
+ mode 0o755
end
apache_site "munin.openstreetmap.org" do
mode 0o755
end
+# simple shell script to dump RRD data to a file
+cookbook_file "/usr/local/bin/rrddump" do
+ source "rrddump.sh"
+ owner "root"
+ group "root"
+ mode 0o755
+end
+
+template "/etc/cron.d/rrddump" do
+ source "rrddump.cron.erb"
+ owner "root"
+ group "root"
+ mode 0o755
+end
+
munin_plugin "munin_stats"
munin_plugin "munin_update"
munin_plugin "munin_rrdcached"
--- /dev/null
+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"`