Puppet Class: profile::cumin::monitoring_agentrun

Defined in:
modules/profile/manifests/cumin/monitoring_agentrun.pp

Overview

Parameters:

  • warn (Integer[1,99]) (defaults to: lookup('profile::cumin::monitoring_agentrun::warn'))
  • crit (Integer[1,99]) (defaults to: lookup('profile::cumin::monitoring_agentrun::crit'))


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
# File 'modules/profile/manifests/cumin/monitoring_agentrun.pp', line 3

class profile::cumin::monitoring_agentrun (
    Integer[1,99] $warn = lookup('profile::cumin::monitoring_agentrun::warn'),
    Integer[1,99] $crit = lookup('profile::cumin::monitoring_agentrun::crit'),
) {

    ensure_packages(['python3-pypuppetdb'])

    file { '/usr/lib/nagios/plugins/check_puppet_run_changes':
        mode    => '0555',
        content => file('profile/cumin/check_puppet_run_changes.py'),
        require => Package['python3-pypuppetdb'],
    }
    $nrpe_command = @("COMMAND"/L)
    /usr/lib/nagios/plugins/check_puppet_run_changes \
    -w ${warn} -c ${crit} \
    --ssl-key ${facts['puppet_config']['hostprivkey']} \
    --ssl-cert ${facts['puppet_config']['hostcert']} \
    --ssl-ca ${facts['puppet_config']['localcacert']}
    | COMMAND
    sudo::user {'check_puppet_run command':
        user       => 'nagios',
        privileges => ["ALL = NOPASSWD: ${nrpe_command}"],
    }
    nrpe::monitor_service{'puppet_run_changes':
        description    => 'Ensure hosts are not performing a change on every puppet run',
        nrpe_command   => "sudo ${nrpe_command}",
        check_interval => 360,
        retry_interval => 5,
        retries        => 2,
        notes_url      => 'https://wikitech.wikimedia.org/wiki/Puppet#check_puppet_run_changes',
        require        => File['/usr/lib/nagios/plugins/check_puppet_run_changes'],
    }
}