]> git.openstreetmap.org Git - chef.git/commitdiff
Touch XML files to reflect date of original RRD file. Don't run dump in parallel...
authorMatt Amos <zerebubuth@gmail.com>
Tue, 24 Jan 2017 12:45:07 +0000 (12:45 +0000)
committerMatt Amos <zerebubuth@gmail.com>
Tue, 24 Jan 2017 12:45:07 +0000 (12:45 +0000)
cookbooks/munin/files/default/rrddump.sh
cookbooks/munin/templates/default/rrddump.cron.erb

index ba7e42f94137330ea682e3b84318554095c45d62..7e54630bca2d353b019d26c9ae83a8513bcc7c5b 100644 (file)
@@ -2,16 +2,18 @@
 
 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 -
index 289fde65b409392587a78e00369c66caff5686c0..604917336b919c469104cb50f616f74e8fd72085 100644 (file)
@@ -1,3 +1,3 @@
 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