Puppet Class: pybal::monitoring

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

Overview

Parameters:

  • config_host (String)
  • config_source (Enum['etcd', 'http'])
  • etcd_port (Stdlib::Port::User)
  • services (Hash[String, Wmflib::Service])


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

class pybal::monitoring(
    String $config_host,
    Enum['etcd', 'http'] $config_source,
    Stdlib::Port::User $etcd_port,
    Hash[String, Wmflib::Service] $services,
) {
    require ::pybal::configuration

    apt::package_from_component { 'python-prometheus-client':
        component => 'component/pybal',
    }

    ensure_packages([
        'libmonitoring-plugin-perl',
        'libwww-perl',
    ])

    nrpe::plugin { 'check_pybal':
        source => 'puppet:///modules/pybal/check_pybal',
    }

    nrpe::monitor_service { 'pybal_backends':
        description  => 'PyBal backends health check',
        nrpe_command => '/usr/local/lib/nagios/plugins/check_pybal --url http://localhost:9090/alerts',
        notes_url    => 'https://wikitech.wikimedia.org/wiki/PyBal',
    }

    nrpe::plugin { 'check_pybal_ipvs_diff':
        source => 'puppet:///modules/pybal/check_pybal_ipvs_diff.py',
    }

    nrpe::monitor_service { 'pybal_ipvs_diff':
        description    => 'PyBal IPVS diff check',
        nrpe_command   => "/usr/local/lib/nagios/plugins/check_pybal_ipvs_diff --req-timeout=10.0 --prometheus-url http://${::ipaddress}:9100/metrics",
        check_interval => 5,
        timeout        => 60,
        notes_url      => 'https://wikitech.wikimedia.org/wiki/PyBal',
    }

    if $config_source == 'etcd' {
        # Get the configuration of all services for this LVS host
        # then sum all values.
        $n_etcd_connections = map($services) |$name,$service| {
            size($service['ip'][$::site])
        }.reduce() |$memo,$value| { $memo + $value }

        nrpe::monitor_service { 'pybal_etcd_connections':
            description    => 'PyBal connections to etcd',
            nrpe_command   => "/usr/local/lib/nagios/plugins/check_established_connections ${config_host} ${etcd_port} ${n_etcd_connections}",
            check_interval => 5,
            timeout        => 60,
            notes_url      => 'https://wikitech.wikimedia.org/wiki/PyBal',
        }
    }

}