Puppet Class: graphite::wmcs::archiver

Defined in:
modules/graphite/manifests/wmcs/archiver.pp

Overview

Class; graphite::wmcs::archiver

Sets up a cron job that clears metrics from killed instances every hour



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'modules/graphite/manifests/wmcs/archiver.pp', line 5

class graphite::wmcs::archiver {

    # FIXME: no logrotate config?

    # logging file used by the script
    file { '/var/log/graphite/instance-archiver.log':
        ensure => present,
        owner  => '_graphite',
        group  => '_graphite',
        mode   => '0644',
    }

    # prevent some cronspam if the delete cronjob is run before the script
    file { '/srv/carbon/whisper/archived_metrics':
        ensure => directory,
        owner  => '_graphite',
        group  => '_graphite',
    }

    require_package('python-yaml')

    file { '/usr/local/bin/archive-instances':
        source => 'puppet:///modules/graphite/archive-instances.py',
        owner  => '_graphite',
        group  => '_graphite',
        mode   => '0700',
    }

    cron { 'archive-deleted-instances':
        ensure  => present,
        command => '/usr/local/bin/archive-instances > /dev/null 2>&1',
        user    => '_graphite',
        minute  => 0,
        hour    => 13,
        require => File['/usr/local/bin/archive-instances'],
    }

    # Clean up archives more than a 90 days old
    cron { 'delete-old-instance-archives':
        ensure  => present,
        command => 'find /srv/carbon/whisper/archived_metrics -mindepth 2 -maxdepth 2 -mtime +90 -type d -exec /bin/rm -rf \'{}\' \;',
        user    => '_graphite',
        minute  => 0,
        hour    => 12,
    }
}