variable für munin-node-service (einmal munin-node, das andere mal munin)
authorandreas <andreas@immerda.ch>
Tue, 4 Dec 2007 17:24:33 +0000 (17:24 +0000)
committerandreas <andreas@immerda.ch>
Tue, 4 Dec 2007 17:24:33 +0000 (17:24 +0000)
manifests/plugin.pp

index 81d8ed4..1420260 100644 (file)
@@ -7,6 +7,15 @@ define munin::plugin (
        $script_path = "/usr/share/munin/plugins",
        $config = '')
 {
+       case $operatingsystem {
+               debian: {       
+                       $munin-node-service = "munin-node";
+               }
+               gentoo: {       
+                       $munin-node-service = "munin";
+               }
+       }
+                                       $plugin_src = $ensure ? { "present" => $name, default => $ensure }
        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"
@@ -16,16 +25,12 @@ define munin::plugin (
                        file { $plugin: ensure => absent, } 
                }
                default: {
-                       case $operatingsystem {
-                               debian: {       
-                                       $plugin_src = $ensure ? { "present" => $name, default => $ensure }
-                                       debug ( "munin_plugin: making $plugin using src: $plugin_src" )
-                                       file { $plugin:
-                                               ensure => "$script_path/${plugin_src}",
-                                               require => Package["munin-node"],
-                                               notify => Service["munin-node"],
-                               }
-                               }
+                       $plugin_src = $ensure ? { "present" => $name, default => $ensure }
+                       debug ( "munin_plugin: making $plugin using src: $plugin_src" )
+                       file { $plugin:
+                               ensure => "$script_path/${plugin_src}",
+                               require => Package[$munin-node-service],
+                               notify => Service[$munin-node-service],
                        }
                }
        }
@@ -70,21 +75,20 @@ define munin::remoteplugin($ensure = "present", $source, $config = '') {
        }
 }
 
-class munin::plugins::base {
-
-       file {
-               [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]:
-                       source => "puppet://$servername/munin/empty",
-                       ensure => directory, checksum => mtime,
-                       recurse => true, purge => true, force => true, 
-                       mode => 0755, owner => root, group => root,
-                       notify => Service[munin-node];
-               "/etc/munin/plugin-conf.d/munin-node":
-                       ensure => present, 
-                       mode => 0644, owner => root, group => root,
-                       notify => Service[munin-node];
-       }
-
+class munin::plugins::base-debian {
+
+               file {
+                       [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]:
+                               source => "puppet://$servername/munin/empty",
+                               ensure => directory, checksum => mtime,
+                               recurse => true, purge => true, force => true, 
+                               mode => 0755, owner => root, group => root,
+                               notify => Service[$munin-node-service];
+                       "/etc/munin/plugin-conf.d/munin-node":
+                               ensure => present, 
+                               mode => 0644, owner => root, group => root,
+                               notify => Service[$munin-node-service];
+               }
 }
 
 # handle if_ and if_err_ plugins