diff options
Diffstat (limited to 'manifests/plugin.pp')
-rw-r--r-- | manifests/plugin.pp | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/manifests/plugin.pp b/manifests/plugin.pp index c9bb6e5..75c4423 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -1,12 +1,16 @@ # plugin.pp - configure a specific munin plugin # Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at> # See LICENSE for the full license granted to you. +# adapted and improved by admin(at)immerda.ch + +### defines define munin::plugin ( - $ensure = "present", - $script_path = "/usr/share/munin/plugins", - $config = '') + $ensure = "present", + $script_path_in = '', + $config = '') { +<<<<<<< HEAD debug ( "munin_plugin: name=$name, ensure=$ensure, script_path=$script_path" ) $plugin = "/etc/munin/plugins/$name" $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf" @@ -126,4 +130,57 @@ class munin::plugins::vserver inherits munin::plugins::base { ensure => present; } +======= + include munin::plugin::scriptpaths + $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in } + + $plugin_src = $ensure ? { "present" => $name, default => $ensure } + $plugin = "/etc/munin/plugins/$name" + $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf" + case $ensure { + "absent": { + file { $plugin: ensure => absent, } + } + default: { + case $kernel { + openbsd: { $basic_require = File['/var/run/munin'] } + default: { $basic_require = Package['munin-node'] } + } + if $require { + $real_require = [ $require, $basic_require ] + } else { + $real_require = $basic_require + } + file { $plugin: + ensure => "${real_script_path}/${plugin_src}", + require => $real_require, + notify => Service['munin-node']; + } + + } + } + case $config { + '': { + file { $plugin_conf: ensure => absent } + } + default: { + case $ensure { + absent: { + file { $plugin_conf: ensure => absent } + } + default: { + file { $plugin_conf: + content => "[${name}]\n$config\n", + mode => 0644, owner => root, group => 0, + } + if $require { + File[$plugin_conf]{ + require +> $require, + } + } + } + } + } + } +>>>>>>> 76352415fec5c2ab6975e3a8843dd4983f7cae6a } |