Puppet Class: etcd::monitoring

Defined in:
modules/etcd/manifests/monitoring.pp

Overview

Class etcd::monitoring



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
# File 'modules/etcd/manifests/monitoring.pp', line 3

class etcd::monitoring {
    require ::etcd

    # For now, this is not critical, but should probably be in the future.
    nrpe::monitor_systemd_unit_state { 'etcd':
        require => Service['etcd'],
    }

    if os_version('debian >= stretch') {
        $plugin_package = 'libmonitoring-plugin-perl'
        $plugin_file = 'etcd_cluster_health_stretch'
    } else {
        $plugin_package = 'libnagios-plugin-perl'
        $plugin_file = 'etcd_cluster_health'
    }

    require_package($plugin_package)

    file { '/usr/local/bin/nrpe_etcd_cluster_health':
        ensure  => present,
        source  => "puppet:///modules/etcd/${plugin_file}",
        owner   => 'root',
        group   => 'root',
        mode    => '0555',
        require => Service['etcd'],
    }

    sudo::user { 'nagios_check_etcd':
        user       => 'nagios',
        privileges => ['ALL = NOPASSWD: /usr/local/bin/nrpe_etcd_cluster_health'],
    }

    nrpe::monitor_service{ 'etcd_cluster_health':
        description  => 'Etcd cluster health',
        nrpe_command => "/usr/local/bin/nrpe_etcd_cluster_health --url ${::etcd::adv_client_url}",
        require      => [
          File['/usr/local/bin/nrpe_etcd_cluster_health'],
          Sudo::User['nagios_check_etcd'],
        ],
        notes_url    => 'https://wikitech.wikimedia.org/wiki/Etcd',
    }

}