From 013317ba7744477be001bb3850f69ec37cc1540b Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 26 May 2008 11:21:28 +0200 Subject: made munin_allow a lot more scalable --- README | 4 ++++ manifests/client.pp | 4 ++++ templates/munin-node.conf.Debian.etch | 6 ++++-- templates/munin-node.conf.default | 7 +++---- 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 -%> -- cgit v1.2.3