Handle munin_allow and nagios_allow variables as arrays
This commit is contained in:
parent
e13e510b6e
commit
c8be8b86af
3 changed files with 17 additions and 4 deletions
|
@ -3,11 +3,18 @@
|
||||||
#
|
#
|
||||||
# === Global variables
|
# === Global variables
|
||||||
#
|
#
|
||||||
|
# $munin_allow:
|
||||||
|
# Array of IP addresses allowed to connect to munin-node.
|
||||||
|
#
|
||||||
# $munin_tls:
|
# $munin_tls:
|
||||||
# Enable and require TLS if set to "true".
|
# Enable and require TLS if set to "true".
|
||||||
#
|
#
|
||||||
class munin::node {
|
class munin::node {
|
||||||
|
|
||||||
|
if !$munin_allow {
|
||||||
|
$munin_allow = [ "127.0.0.1" ]
|
||||||
|
}
|
||||||
|
|
||||||
package { "munin-node":
|
package { "munin-node":
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,9 @@ host_name <%= @homename %>
|
||||||
# regular expression, due to brain damage in Net::Server, which
|
# regular expression, due to brain damage in Net::Server, which
|
||||||
# doesn't understand CIDR-style network notation. You may repeat
|
# doesn't understand CIDR-style network notation. You may repeat
|
||||||
# the allow line as many times as you'd like
|
# the allow line as many times as you'd like
|
||||||
|
<% @munin_allow.each do |allow| -%>
|
||||||
allow <%= @munin_allow %>
|
allow <%= "^%s$" % allow.gsub('.', '\.') %>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
# Which address to bind to;
|
# Which address to bind to;
|
||||||
host <%= @ipaddress %>
|
host <%= @ipaddress %>
|
||||||
|
|
|
@ -179,10 +179,15 @@ define nagios::target::tcp($port, $description=undef) {
|
||||||
|
|
||||||
# Configure nagios nrpe target.
|
# Configure nagios nrpe target.
|
||||||
#
|
#
|
||||||
|
# === Global variables
|
||||||
|
#
|
||||||
|
# $nagios_allow:
|
||||||
|
# Array of IP addresses allowed to connect to the nrpe service.
|
||||||
|
#
|
||||||
class nagios::target::nrpe inherits nagios::target {
|
class nagios::target::nrpe inherits nagios::target {
|
||||||
|
|
||||||
if !$nagios_allow {
|
if !$nagios_allow {
|
||||||
$nagios_allow = "127.0.0.1"
|
$nagios_allow = [ "127.0.0.1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
include nagios::common
|
include nagios::common
|
||||||
|
@ -248,7 +253,7 @@ class nagios::target::nrpe inherits nagios::target {
|
||||||
"openbsd" => "wheel",
|
"openbsd" => "wheel",
|
||||||
default => "root",
|
default => "root",
|
||||||
},
|
},
|
||||||
content => "allowed_hosts=${nagios_allow}\n",
|
content => inline_template("allowed_hosts=<%= @nagios_allow.join(',') %>\n"),
|
||||||
require => File["/etc/nrpe.d"],
|
require => File["/etc/nrpe.d"],
|
||||||
notify => Service["nrpe"],
|
notify => Service["nrpe"],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue