]> git.openstreetmap.org Git - chef.git/blob - cookbooks/prometheus/templates/default/backup.cron.erb
Add backup script for prometheus
[chef.git] / cookbooks / prometheus / templates / default / backup.cron.erb
1 #!/bin/sh
2
3 # DO NOT EDIT - This file is being maintained by Chef
4
5 T=$(mktemp -d -t -p /var/tmp prometheus.XXXXXXXXXX)
6 D=$(date +%Y-%m-%d)
7 B=prometheus-$D.tar.gz
8
9 mkdir $T/prometheus-$D
10
11 ln -s /var/lib/prometheus/alertmanager $T/prometheus-$D/alertmanager
12 ln -s /var/lib/grafana $T/prometheus-$D/grafana
13
14 export RSYNC_RSH="ssh -ax"
15
16 nice tar --create --dereference --directory=$T prometheus-$D | nice gzip --rsyncable -9 > $T/$B
17 nice rsync --preallocate --fuzzy $T/$B backup::backup
18
19 rm -rf $T