Puppet Class: profile::wmcs::monitoring

Defined in:
modules/profile/manifests/wmcs/monitoring.pp

Overview

Parameters:

  • monitoring_master (String) (defaults to: lookup('profile::wmcs::monitoring::statsd_master'))
  • monitoring_standby (String) (defaults to: lookup('profile::wmcs::monitoring::statsd_standby'))


3
4
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'modules/profile/manifests/wmcs/monitoring.pp', line 3

class profile::wmcs::monitoring (
    String $monitoring_master = lookup('profile::wmcs::monitoring::statsd_master'),
    String $monitoring_standby = lookup('profile::wmcs::monitoring::statsd_standby'),
) {
    require ::profile::openstack::eqiad1::clientpackages

    package { 'rsync':
        ensure => 'present',
    }

    # hourly job to rsync whisper files
    ssh::userkey { '_graphite':
        ensure  => 'present',
        content => secret('ssh/wmcs/monitoring/wmcs_monitoring_rsync.pub'),
    }

    file { '/var/lib/graphite/.ssh':
        ensure => directory,
        owner  => '_graphite',
        group  => '_graphite',
        mode   => '0700',
    }

    file { '/var/lib/graphite/.ssh/id_rsa':
        content   => secret('ssh/wmcs/monitoring/wmcs_monitoring_rsync.priv'),
        owner     => '_graphite',
        group     => '_graphite',
        mode      => '0600',
        require   => File['/var/lib/graphite/.ssh'],
        show_diff => false,
    }

    # master / slave specific bits
    if $::facts['fqdn'] == $monitoring_master {
        $rsync_ensure = 'absent'

        ferm::service { 'wmcs_monitoring_rsync_ferm':
            proto  => 'tcp',
            port   => '22',
            srange => "(@resolve(${monitoring_standby}) @resolve(${monitoring_standby}, AAAA))",
        }

        user { '_graphite':
            ensure => present,
            shell  => '/bin/rbash',
        }
    } else {
        $cron_ensure = 'present'

        user { '_graphite':
            ensure => present,
            shell  => '/bin/false',
        }
    }

    $whisper_dir = '/srv/carbon/whisper/'
    systemd::timer::job { 'wmcs_monitoring_graphite_rsync':
        ensure                    => $rsync_ensure,
        description               => 'Mirror files from Graphite master to standby server',
        command                   => "/usr/bin/rsync --delete --delete-after -aSOrd ${monitoring_master}:${whisper_dir} ${whisper_dir}",
        interval                  => {
            'start'    => 'OnCalendar',
            'interval' => '*-*-* 00/8:00:00', # Every 8 hours
        },
        logging_enabled           => false,
        monitoring_enabled        => true,
        monitoring_contact_groups => 'wmcs-team',
        user                      => '_graphite',
    }
}