compress old puppet reports

seth vidal skvidal at fedoraproject.org
Mon May 16 20:55:27 UTC 2011


Puppet reports have grown since we switched from 0.25 to 2.6.X by
roughly 10x their original size.

so they are sucking the disk space out of puppet1 b/c we keep them
there.

When I reduced the number we keep it didn't have as nice of an impact on
our free space as I would like.

So - I wrote this to modify our reports clean up to compress all .yaml
files except for the latest 24hours worth of them.

It keeps 1month present - but much, much, smaller

and it keeps the latest 24 hours worth immediately available.

here's the patch:


diff --git a/modules/puppet/files/puppet-report-clean.sh
b/modules/puppet/files/puppet-report-clean.sh
index d274e2b..d4af330 100755
--- a/modules/puppet/files/puppet-report-clean.sh
+++ b/modules/puppet/files/puppet-report-clean.sh
@@ -2,3 +2,11 @@
 
 # clean up all but the last 1 month of puppet reports
 /usr/sbin/tmpwatch --mtime 720 /var/lib/puppet/reports/
+
+# compress all the .yaml files per host dir, except for the latest 24
hours worth.
+# since they are txt files and compress really well
+
+for host in `echo /var/lib/puppet/reports/*`
+do 
+ /bin/ls -1 $host/*.yaml | head --lines=-48 | xargs --no-run-if-empty
xz -9
+done



need two +1's please

-sv




More information about the infrastructure mailing list