]> git.openstreetmap.org Git - chef.git/commitdiff
Add munin backup script
authorTom Hughes <tom@compton.nu>
Mon, 13 Jul 2015 21:38:56 +0000 (22:38 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 13 Jul 2015 21:40:52 +0000 (22:40 +0100)
Closes #29

cookbooks/backup/templates/default/expire.cron.erb
cookbooks/munin/recipes/server.rb
cookbooks/munin/templates/default/backup.cron.erb [new file with mode: 0644]

index 2cabb6880d1bd86dc1d0bb6268f2d2a7be0ed183..b7dec58ed7e819157ca07d4d6dc981bf7b614783 100644 (file)
@@ -2,7 +2,7 @@
 
 # DO NOT EDIT - This file is being maintained by Chef
 
-for prefix in chef-server chef-repository chef-git git lists osm-blog osmf-crm osmf-ledgersmb wiki-wiki.osmfoundation.org osqa otrs sotm svn switch2osm thinkup trac wiki-board.osmfoundation.org wiki-wiki.openstreetmap.org
+for prefix in chef-server chef-repository chef-git git lists munin osm-blog osmf-crm osmf-ledgersmb wiki-wiki.osmfoundation.org osqa otrs sotm svn switch2osm thinkup trac wiki-board.osmfoundation.org wiki-wiki.openstreetmap.org
 do
   /usr/local/bin/expire-backups --days=3 --weeks=3 --months=3 /store/backup $prefix
 done
index 4729f4321edc6c5981dec81989a332065dd932b5..6d628bb8cd0fd5adf1c5d70f69bd25377ae7d8f1 100644 (file)
@@ -81,6 +81,13 @@ apache_site "munin.openstreetmap.org" do
   template "apache.erb"
 end
 
+template "/etc/cron.daily/munin-backup" do
+  source "backup.cron.erb"
+  owner "root"
+  group "root"
+  mode 0750
+end
+
 munin_plugin "munin_stats"
 munin_plugin "munin_update"
 munin_plugin "munin_rrdcached"
diff --git a/cookbooks/munin/templates/default/backup.cron.erb b/cookbooks/munin/templates/default/backup.cron.erb
new file mode 100644 (file)
index 0000000..80e78c4
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+T=$(mktemp -d -t -p /var/tmp munin.XXXXXXXXXX)
+D=$(date +%Y-%m-%d)
+B=munin-$D.tar.gz
+
+export GZIP="--rsyncable -9"
+export RSYNC_RSH="ssh -ax -c arcfour"
+
+nice tar --create --gzip --dereference --directory=/var/lib/munin --file=$T/$B openstreetmap *.storable
+nice rsync $T/$B backup::backup
+
+rm -rf $T