FAQ
Excellent fix to a perplexing problem. Thanks!
On Thursday, July 21, 2011 8:50:32 AM UTC-5, vagn wrote:
On 07/21/2011 08:52 AM, vagn scott wrote:
Thinking about this some more, if you need the reports for dashboard
to work,
then any cleanup script should leave the latest report from any server,
so that, even if the server has not checked in for a while it won't
disappear.

Thanks for the question. Clearly I need to revisit this.
So, here is a script that ought to do the job. Not heavily tested yet.
Please let me know if you have problems with it. --vagn

#! /bin/sh
# puppet-reports-stalker
# vagn scott, 21-jul-2011

days="+7" # more than 7 days old

for d in `find /var/lib/puppet/reports -mindepth 1 -maxdepth 1 -type d`
do
find $d -type f -name \*.yaml -mtime $days |
sort -r |
tail -n +2 |
xargs -n50 /bin/rm -f
done

exit 0


And the updated class.

class puppet::clean_reports {

file { '/usr/local/bin/puppet-reports-stalker':
source =>
'puppet:///modules/puppet/puppet-reports-stalker',
before => Cron[ 'puppet clean reports' ],
mode => 755,
owner => root,
group => root,
}

cron { 'puppet clean reports':
command => '/usr/local/bin/puppet-reports-stalker',
user => root,
hour => 21,
minute => 22,
weekday => 0,
}
}

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/g5uMpBkZnvMJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Jo Rhett at Oct 8, 2012 at 7:23 pm

    On Thursday, July 21, 2011 8:50:32 AM UTC-5, vagn wrote:
    find $d -type f -name \*.yaml -mtime $days |
    sort -r |
    tail -n +2 |
    xargs -n50 /bin/rm -f
    All this is really better than…?

    find $d -type f -name \*.yaml -mtime $days -exec rm -f {} \;

    --
    Jo Rhett
    Net Consonance : net philanthropy to improve open source and internet projects.



    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 8, '12 at 6:50a
activeOct 8, '12 at 7:23p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Jo Rhett: 1 post Allen Minix: 1 post

People

Translate

site design / logo © 2021 Grokbase