From 4f8fbfcc736d02ec0528b0df571d5d4a458c261e Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2008 20:02:35 +0000 Subject: Merge commit 'puzzle/development' git-svn-id: https://svn/ipuppet/trunk/modules/munin@1600 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- README | 4 ++++ files/empty/.git_placeholder | 1 + manifests/client.pp | 5 +++++ manifests/init.pp | 16 +++++++++++++--- manifests/plugin.pp | 25 +++++++++++++++++++++---- templates/munin-node.conf.Debian.etch | 6 ++++-- templates/munin-node.conf.default | 7 +++---- 7 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 files/empty/.git_placeholder diff --git a/README b/README index f7ecba6..5384c30 100644 --- a/README +++ b/README @@ -46,6 +46,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/files/empty/.git_placeholder b/files/empty/.git_placeholder new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.git_placeholder @@ -0,0 +1 @@ +# just used for git diff --git a/manifests/client.pp b/manifests/client.pp index 8305bf0..59b6980 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -51,6 +51,7 @@ class munin::client::base { package { "munin-node": ensure => installed } service { "munin-node": ensure => running, + enable => true, hasstatus => true, hasrestart => true, require => Package[munin-node], @@ -59,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/manifests/init.pp b/manifests/init.pp index 6b6cd08..b0c2ba1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,9 +1,19 @@ +# +# munin module # munin.pp - everything a sitewide munin installation needs # Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. -# adapted by Puzzle ITC - haerry+puppet(at)puzzle.ch +# +# Copyright 2008, Puzzle ITC GmbH +# Marcel Härry haerry+puppet(at)puzzle.ch +# Simon Josi josi+puppet(at)puzzle.ch +# +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by +# the Free Software Foundation. # -# the port is a parameter so vservers can share IP addresses and still be happy +# the port is a parameter so vservers can share +# IP addresses and still be happy # Define where the individual nodes' configs are stored $NODESDIR="/var/lib/puppet/modules/munin/nodes" diff --git a/manifests/plugin.pp b/manifests/plugin.pp index d24b580..76d12a0 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -45,11 +45,17 @@ define munin::plugin ( } default: { debug ( "munin_plugin: making $plugin using src: $plugin_src" ) + if $require { + $real_require = [ $require, Package['munin-node'] ] + } else { + $real_require = Package['munin-node'] + } file { $plugin: ensure => "${real_script_path}/${plugin_src}", - require => Package['munin-node'], + require => $real_require, notify => Service['munin-node']; } + } } case $config { @@ -69,6 +75,11 @@ define munin::plugin ( content => "[${name}]\n$config\n", mode => 0644, owner => root, group => 0, } + if $require { + File[$plugin_conf]{ + require +> $require, + } + } } } } @@ -107,11 +118,17 @@ define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') { file { "munin_plugin_${name}": path => "$munin::plugin::scriptpaths::script_path/${name}", source => "puppet://$server/$real_source", - ensure => file, + require => Package['munin-node'], mode => 0755, owner => root, group => 0; } - - munin::plugin{$name: ensure => $ensure, config => $config } + if $require { + File["munin_plugin_${name}"]{ + require +> $require, + } + munin::plugin{$name: ensure => $ensure, config => $config, require => $require } + } else { + munin::plugin{$name: ensure => $ensure, config => $config } + } } ### clases for plugins 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