summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Haerry <haerry@puzzle.ch>2008-05-26 11:21:28 +0200
committerMarcel Haerry <haerry@puzzle.ch>2008-05-26 11:21:28 +0200
commit013317ba7744477be001bb3850f69ec37cc1540b (patch)
tree2656f7be20f75cb63401440286c6e583ecbceff7
parent5547be2954d17040727d048d16fb245965ebe144 (diff)
made munin_allow a lot more scalable
-rw-r--r--README4
-rw-r--r--manifests/client.pp4
-rw-r--r--templates/munin-node.conf.Debian.etch6
-rw-r--r--templates/munin-node.conf.default7
4 files changed, 15 insertions, 6 deletions
diff --git a/README b/README
index 762a802..4f0e2db 100644
--- a/README
+++ b/README
@@ -45,6 +45,10 @@ To use this module, follow these directions:
connect to your individual munin-nodes (this is typically your main munin host's IP):
$munin_allow = '192.168.0.1'
+
+ If you want to define more than one host, you can seperate them by colon:
+
+ $munin_allow = '127.0.0.1:192.168.0.1'
e. In the node definition in your site.pp for your main munin host, add the following:
diff --git a/manifests/client.pp b/manifests/client.pp
index bee3609..59b6980 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -60,6 +60,10 @@ class munin::client::base {
ensure => directory,
mode => 0755, owner => root, group => 0;
}
+ $real_munin_allow = $munin_allow ? {
+ '' => '127.0.0.1',
+ default => $munin_allow
+ }
file {"/etc/munin/munin-node.conf":
content => template("munin/munin-node.conf.$operatingsystem"),
mode => 0644, owner => root, group => 0,
diff --git a/templates/munin-node.conf.Debian.etch b/templates/munin-node.conf.Debian.etch
index 0f0f568..56da89d 100644
--- a/templates/munin-node.conf.Debian.etch
+++ b/templates/munin-node.conf.Debian.etch
@@ -33,5 +33,7 @@ host_name <%= fqdn %>
# regular expression, due to brain damage in Net::Server, which
# doesn't understand CIDR-style network notation. You may repeat
# the allow line as many times as you'd like
-allow <%= munin_allow1 %>
-allow <%= munin_allow2 %>
+<% real_munin_allow.split(':').each do |val| -%>
+allow <%= '^'+val.gsub(/\./, '\.')+'$' %>
+<% end -%>
+
diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default
index f10349e..5eed749 100644
--- a/templates/munin-node.conf.default
+++ b/templates/munin-node.conf.default
@@ -33,7 +33,6 @@ host_name <%= fqdn %>
# regular expression, due to brain damage in Net::Server, which
# doesn't understand CIDR-style network notation. You may repeat
# the allow line as many times as you'd like
-allow ^127\.0\.0\.1$
-allow <%= munin_allow1 %>
-allow <%= munin_allow2 %>
-
+<% real_munin_allow.split(':').each do |val| -%>
+allow <%= '^'+val.gsub(/\./, '\.')+'$' %>
+<% end -%>