1
2
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
|
class sunet::nagios {
$nagios_ip_v4 = hiera('nagios_ip_v4', '109.105.111.111')
$nagios_ip_v6 = hiera('nagios_ip_v6', '2001:948:4:6::111')
$allowed_hosts = "${nagios_ip_v4},${nagios_ip_v6}"
package {'nagios-nrpe-server':
ensure => 'installed',
} ->
service {'nagios-nrpe-server':
ensure => 'running'
} ->
file { "/etc/nagios/nrpe.cfg" :
ensure => 'file',
mode => '0640',
group => 'nagios',
content => template('sunet/nagioshost/nrpe.cfg.erb'),
} ->
file { "/usr/lib/nagios/plugins/check_uptime.pl" :
ensure => 'file',
mode => '0640',
group => 'nagios',
content => template('sunet/nagioshost/check_uptime.pl.erb'),
} ->
ufw::allow { "allow-nrpe-v4":
from => "${nagios_ip_v4}",
ip => 'any',
proto => 'tcp',
port => 5666
} ->
ufw::allow { "allow-nrpe-v6":
from => "${nagios_ip_v6}",
ip => 'any',
proto => 'tcp',
port => 5666
}
}
|