Puppet Class: nrpe

Defined in:
modules/nrpe/manifests/init.pp

Overview

Class: nrpe

This installes nrpe packages, ensures service is running and collects all configuration

Parameters:

Actions:

Install nrpe packages
Manage nrpe service status
Collect all needed exported resources

Requires:

Definition[monitor_service]

Sample Usage:

include ::nrpe

Parameters:

  • allowed_hosts (Any) (defaults to: '127.0.0.1')


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
# File 'modules/nrpe/manifests/init.pp', line 19

class nrpe($allowed_hosts='127.0.0.1') {
    package { [ 'nagios-nrpe-server',
                'monitoring-plugins',
                'monitoring-plugins-basic',
                'monitoring-plugins-standard',
            ]:
        ensure => present,
    }

    file { '/etc/nagios/nrpe_local.cfg':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('nrpe/nrpe_local.cfg.erb'),
        require => Package['nagios-nrpe-server'],
        notify  => Service['nagios-nrpe-server'],
    }

    file { '/usr/local/lib/nagios/':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
    }

    # Have a directory with all our plugins.
    file { '/usr/local/lib/nagios/plugins/':
        ensure  => directory,
        owner   => 'root',
        group   => 'root',
        mode    => '0555',
        recurse => true,
        purge   => true,
        force   => true,
        source  => 'puppet:///modules/nrpe/plugins',
        require => File['/usr/local/lib/nagios/'],
    }

    base::service_unit { 'nagios-nrpe-server':
        systemd => systemd_template('nagios-nrpe-server'),
        strict  => false,
        require => Package['nagios-nrpe-server'],
    }

    base::service_auto_restart { 'nagios-nrpe-server': }

    #Collect virtual nrpe checks
    File <| tag == 'nrpe::check' |> {
        require => Package['nagios-nrpe-server'],
    }
}