Puppet Class: profile::cumin::monitoring_agentrun

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

Summary

class to configure nrpe checks to ensure hosts are not performing a change on every puppet run

Overview

SPDX-License-Identifier: Apache-2.0

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'))


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

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':
        ensure => absent,
    }

    nrpe::plugin { 'check_puppet_run_changes':
        source  => 'puppet:///modules/profile/cumin/check_puppet_run_changes.py',
        require => Package['python3-pypuppetdb'],
    }

    $nrpe_command = @("COMMAND"/L)
    /usr/local/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':
        ensure => absent,
    }

    nrpe::monitor_service { 'puppet_run_changes':
        description    => 'Ensure hosts are not performing a change on every puppet run',
        nrpe_command   => $nrpe_command,
        sudo_user      => 'root',
        check_interval => 360,
        retry_interval => 5,
        retries        => 2,
        notes_url      => 'https://wikitech.wikimedia.org/wiki/Puppet#check_puppet_run_changes',
    }
}