From: Tom Hughes Date: Mon, 13 Jul 2015 21:38:56 +0000 (+0100) Subject: Add munin backup script X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/9e84412b7279e2b3438637e4dd121c0adea4cd53 Add munin backup script Closes #29 --- diff --git a/cookbooks/backup/templates/default/expire.cron.erb b/cookbooks/backup/templates/default/expire.cron.erb index 2cabb6880..b7dec58ed 100644 --- a/cookbooks/backup/templates/default/expire.cron.erb +++ b/cookbooks/backup/templates/default/expire.cron.erb @@ -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 diff --git a/cookbooks/munin/recipes/server.rb b/cookbooks/munin/recipes/server.rb index 4729f4321..6d628bb8c 100644 --- a/cookbooks/munin/recipes/server.rb +++ b/cookbooks/munin/recipes/server.rb @@ -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 index 000000000..80e78c43f --- /dev/null +++ b/cookbooks/munin/templates/default/backup.cron.erb @@ -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