new style for 2.7
authormh <mh@immerda.ch>
Tue, 5 Jun 2012 22:39:49 +0000 (19:39 -0300)
committermh <mh@immerda.ch>
Tue, 5 Jun 2012 22:39:49 +0000 (19:39 -0300)
21 files changed:
files/config/host/munin.conf.header.Debian.sid [changed from symlink to file mode: 0644]
files/config/host/munin.conf.header.Debian.wheezy [changed from symlink to file mode: 0644]
manifests/client.pp
manifests/client/base.pp
manifests/client/centos.pp
manifests/client/debian.pp
manifests/client/gentoo.pp
manifests/client/openbsd.pp
manifests/client/package.pp
manifests/host.pp
manifests/host/cgi.pp
manifests/plugin.pp
manifests/plugin/deploy.pp
manifests/plugin/scriptpaths.pp
manifests/plugins/base.pp
manifests/plugins/gentoo.pp
manifests/plugins/interfaces.pp
manifests/plugins/linux.pp
manifests/register.pp
manifests/register/snmp.pp
manifests/remoteplugin.pp

deleted file mode 120000 (symlink)
index 5fa2037883cf2dda0f080748adfeb367121e6e4c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-munin.conf.header.Debian.squeeze
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..771d50db7b34d778ac1ce49d002fa600f21c8916
--- /dev/null
@@ -0,0 +1,75 @@
+# Example configuration file for Munin, generated by 'make build'
+
+# The next three variables specifies where the location of the RRD
+# databases, the HTML output, and the logs, severally.  They all
+# must be writable by the user running munin-cron.
+dbdir   /var/lib/munin
+htmldir /var/cache/munin/www
+logdir  /var/log/munin
+rundir  /var/run/munin
+
+# Where to look for the HTML templates
+tmpldir /etc/munin/templates
+
+# Make graphs show values per minute instead of per second
+#graph_period minute
+
+# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
+# something changes (OK -> WARNING, CRITICAL -> OK, etc)
+#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
+#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
+#
+# For those with Nagios, the following might come in handy. In addition,
+# the services must be defined in the Nagios server as well.
+#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
+
+#contacts me
+#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root
+#contact.me.always_send warning critical
+
+# a simple host tree
+#[localhost]
+#    address 127.0.0.1
+#    use_node_name yes
+
+#
+# A more complex example of a host tree
+#
+## First our "normal" host.
+# [fii.foo.com]
+#       address foo
+#
+## Then our other host...
+# [fay.foo.com]
+#       address fay
+#
+## Then we want totals...
+# [foo.com;Totals] #Force it into the "foo.com"-domain...
+#       update no   # Turn off data-fetching for this "host".
+#
+#   # The graph "load1". We want to see the loads of both machines...
+#   # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
+#       load1.graph_title Loads side by side
+#       load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+#
+#   # The graph "load2". Now we want them stacked on top of each other.
+#       load2.graph_title Loads on top of each other
+#       load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+#       load2.dummy_field.draw AREA # We want area instead the default LINE2.
+#       load2.dummy_field.label dummy # This is needed. Silly, really.
+#
+#   # The graph "load3". Now we want them summarised into one field
+#       load3.graph_title Loads summarised
+#       load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
+#       load3.combined_loads.label Combined loads # Must be set, as this is
+#                                                 # not a dummy field!
+#
+## ...and on a side note, I want them listen in another order (default is
+## alphabetically)
+#
+# # Since [foo.com] would be interpreted as a host in the domain "com", we
+# # specify that this is a domain by adding a semicolon.
+# [foo.com;]
+#       node_order Totals fii.foo.com fay.foo.com
+#
+
deleted file mode 120000 (symlink)
index 5fa2037883cf2dda0f080748adfeb367121e6e4c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-munin.conf.header.Debian.squeeze
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..771d50db7b34d778ac1ce49d002fa600f21c8916
--- /dev/null
@@ -0,0 +1,75 @@
+# Example configuration file for Munin, generated by 'make build'
+
+# The next three variables specifies where the location of the RRD
+# databases, the HTML output, and the logs, severally.  They all
+# must be writable by the user running munin-cron.
+dbdir   /var/lib/munin
+htmldir /var/cache/munin/www
+logdir  /var/log/munin
+rundir  /var/run/munin
+
+# Where to look for the HTML templates
+tmpldir /etc/munin/templates
+
+# Make graphs show values per minute instead of per second
+#graph_period minute
+
+# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
+# something changes (OK -> WARNING, CRITICAL -> OK, etc)
+#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
+#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
+#
+# For those with Nagios, the following might come in handy. In addition,
+# the services must be defined in the Nagios server as well.
+#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
+
+#contacts me
+#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root
+#contact.me.always_send warning critical
+
+# a simple host tree
+#[localhost]
+#    address 127.0.0.1
+#    use_node_name yes
+
+#
+# A more complex example of a host tree
+#
+## First our "normal" host.
+# [fii.foo.com]
+#       address foo
+#
+## Then our other host...
+# [fay.foo.com]
+#       address fay
+#
+## Then we want totals...
+# [foo.com;Totals] #Force it into the "foo.com"-domain...
+#       update no   # Turn off data-fetching for this "host".
+#
+#   # The graph "load1". We want to see the loads of both machines...
+#   # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
+#       load1.graph_title Loads side by side
+#       load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+#
+#   # The graph "load2". Now we want them stacked on top of each other.
+#       load2.graph_title Loads on top of each other
+#       load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+#       load2.dummy_field.draw AREA # We want area instead the default LINE2.
+#       load2.dummy_field.label dummy # This is needed. Silly, really.
+#
+#   # The graph "load3". Now we want them summarised into one field
+#       load3.graph_title Loads summarised
+#       load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
+#       load3.combined_loads.label Combined loads # Must be set, as this is
+#                                                 # not a dummy field!
+#
+## ...and on a side note, I want them listen in another order (default is
+## alphabetically)
+#
+# # Since [foo.com] would be interpreted as a host in the domain "com", we
+# # specify that this is a domain by adding a semicolon.
+# [foo.com;]
+#       node_order Totals fii.foo.com fay.foo.com
+#
+
index 0ff5b79..5080f99 100644 (file)
@@ -4,16 +4,15 @@
 # Adapted and improved by admin(at)immerda.ch
 
 class munin::client {
-
-    case $::operatingsystem {
-        openbsd: { include munin::client::openbsd }
-        darwin: { include munin::client::darwin }
-        debian,ubuntu: { include munin::client::debian }
-        gentoo: { include munin::client::gentoo }
-        centos: { include munin::client::package }
-        default: { include munin::client::base }
-    }
-    if $use_shorewall {
-        include shorewall::rules::munin
-    }
+  case $::operatingsystem {
+    openbsd: { include munin::client::openbsd }
+    darwin: { include munin::client::darwin }
+    debian,ubuntu: { include munin::client::debian }
+    gentoo: { include munin::client::gentoo }
+    centos: { include munin::client::package }
+    default: { include munin::client::base }
+  }
+  if hiera('use_shorewall',false) {
+    include shorewall::rules::munin
+  }
 }
index 0c7a62a..80a25c5 100644 (file)
@@ -1,23 +1,23 @@
 class munin::client::base(
   $munin_allow = hiera('munin_allow','127.0.0.1')
 ) {
-    service { 'munin-node':
-        ensure => running,
-        enable => true,
-        hasstatus => true,
-        hasrestart => true,
-    }
-    file {'/etc/munin':
-        ensure => directory,
-        mode => 0755, owner => root, group => 0;
-    }
-    file {'/etc/munin/munin-node.conf':
-        content => template("munin/munin-node.conf.${::operatingsystem}"),
-        notify => Service['munin-node'],
-        mode => 0644, owner => root, group => 0,
-    }
-    munin::register { $::fqdn:
-        config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
-    }
-    include munin::plugins::base
+  service { 'munin-node':
+    ensure => running,
+    enable => true,
+    hasstatus => true,
+    hasrestart => true,
+  }
+  file {'/etc/munin':
+    ensure => directory,
+    mode => 0755, owner => root, group => 0;
+  }
+  file {'/etc/munin/munin-node.conf':
+    content => template("munin/munin-node.conf.${::operatingsystem}"),
+    notify => Service['munin-node'],
+    mode => 0644, owner => root, group => 0,
+  }
+  munin::register { $::fqdn:
+    config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
+  }
+  include munin::plugins::base
 }
index 42e8c59..3a7151b 100644 (file)
@@ -1,3 +1,3 @@
 class munin::client::centos inherits munin::client::package {
-    include munin::plugins::centos
+  include munin::plugins::centos
 }
index 903fb2d..e67ac26 100644 (file)
@@ -1,15 +1,15 @@
 class munin::client::debian inherits munin::client::package {
-    # the plugin will need that
-    package { "iproute": ensure => installed }
+  # the plugin will need that
+  package { "iproute": ensure => installed }
 
-    Service["munin-node"]{
-        # sarge's munin-node init script has no status
-        hasstatus => $::lsbdistcodename ? { sarge => false, default => true }
-    }
-    File["/etc/munin/munin-node.conf"]{
-            content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"),
-    }
-    # workaround bug in munin_node_configure
-    plugin { "postfix_mailvolume": ensure => absent }
-    include munin::plugins::debian
+  Service["munin-node"]{
+    # sarge's munin-node init script has no status
+    hasstatus => $::lsbdistcodename ? { sarge => false, default => true }
+  }
+  File["/etc/munin/munin-node.conf"]{
+    content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"),
+  }
+  # workaround bug in munin_node_configure
+  plugin { "postfix_mailvolume": ensure => absent }
+  include munin::plugins::debian
 }
index c24d317..6a01050 100644 (file)
@@ -4,5 +4,5 @@ class munin::client::gentoo inherits munin::client::package {
     category => 'net-analyzer',
   }
 
-    include munin::plugins::gentoo
+  include munin::plugins::gentoo
 }
index e1742d2..88d0640 100644 (file)
@@ -1,59 +1,59 @@
 # currently we install munin on openbsd by targz
 # :(
 class munin::client::openbsd inherits munin::client::base {
-    if $::operatingsystemrelease == '4.3' {
-      file{'/usr/src/munin_openbsd.tar.gz':
-        source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz",
-        owner => root, group => 0, mode => 0600;
-      }
-      exec{'extract_openbsd':
-        command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz',
-        unless => 'test -d /opt/munin',
-        require => File['/usr/src/munin_openbsd.tar.gz'],
-        before => File['/var/run/munin'],
-      }
-      package{'p5-Compress-Zlib':
-        ensure => installed,
-        before => File['/var/run/munin'],
-      }
-    } else {
-      package{'munin-node':
-        ensure => installed,
-      }
+  if $::operatingsystemrelease == '4.3' {
+    file{'/usr/src/munin_openbsd.tar.gz':
+      source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz",
+      owner => root, group => 0, mode => 0600;
     }
-    package{ [  'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP',
-                'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server',
-                'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
-        ensure => installed,
-        before => File['/var/run/munin'],
+    exec{'extract_openbsd':
+      command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz',
+      unless => 'test -d /opt/munin',
+      require => File['/usr/src/munin_openbsd.tar.gz'],
+      before => File['/var/run/munin'],
     }
-    file{[ '/var/run/munin', '/var/log/munin' ]:
-      ensure => directory,
-      owner => root, group  => 0, mode => 0755;
+    package{'p5-Compress-Zlib':
+      ensure => installed,
+      before => File['/var/run/munin'],
     }
-    openbsd::rc_local{'munin-node':
-        binary => $::operatingsystemrelease ? {
-          '4.3' => '/opt/munin/sbin/munin-node',
-          default => '/usr/local/sbin/munin-node'
-        },
-        require => File['/var/run/munin'],
-    }
-    Service['munin-node']{
-        restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
-        stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
-        start => $::operatingsystemrelease ? {
-          '4.3' => '/opt/munin/sbin/munin-node',
-          default => '/usr/local/sbin/munin-node'
-        },
-        status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^$(cat /var/run/munin/munin-node.pid).*munin-node")',
-        hasstatus => true,
-        hasrestart => true,
-        require => [ File['/var/run/munin'], File['/var/log/munin'] ],
-    }
-    cron{'clean_munin_logfile':
-        command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
-        minute => 0,
-        hour => 2,
-        weekday => 0,
+  } else {
+    package{'munin-node':
+      ensure => installed,
     }
+  }
+  package{ [  'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP',
+              'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server',
+              'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
+    ensure => installed,
+    before => File['/var/run/munin'],
+  }
+  file{[ '/var/run/munin', '/var/log/munin' ]:
+    ensure => directory,
+    owner => root, group  => 0, mode => 0755;
+  }
+  openbsd::rc_local{'munin-node':
+    binary => $::operatingsystemrelease ? {
+      '4.3' => '/opt/munin/sbin/munin-node',
+      default => '/usr/local/sbin/munin-node'
+    },
+    require => File['/var/run/munin'],
+  }
+  Service['munin-node']{
+    restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
+    stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
+    start => $::operatingsystemrelease ? {
+      '4.3' => '/opt/munin/sbin/munin-node',
+      default => '/usr/local/sbin/munin-node'
+    },
+    status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^$(cat /var/run/munin/munin-node.pid).*munin-node")',
+    hasstatus => true,
+    hasrestart => true,
+    require => [ File['/var/run/munin'], File['/var/log/munin'] ],
+  }
+  cron{'clean_munin_logfile':
+    command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
+    minute => 0,
+    hour => 2,
+    weekday => 0,
+  }
 }
index 18566b8..58f40da 100644 (file)
@@ -1,11 +1,11 @@
 class munin::client::package inherits munin::client::base {
-    package { 'munin-node': ensure => installed }
-    Service['munin-node']{
-        require => Package[munin-node],
-    }
-    File['/etc/munin/munin-node.conf']{
-        # this has to be installed before the package, so the postinst can
-        # boot the munin-node without failure!
-        before => Package['munin-node'],
-    }
+  package { 'munin-node': ensure => installed }
+  Service['munin-node']{
+    require => Package[munin-node],
+  }
+  File['/etc/munin/munin-node.conf']{
+    # this has to be installed before the package, so the postinst can
+    # boot the munin-node without failure!
+    before => Package['munin-node'],
+  }
 }
index e81f08f..524cddf 100644 (file)
@@ -2,7 +2,9 @@
 # Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
 # See LICENSE for the full license granted to you.
 
-class munin::host {
+class munin::host(
+  $cgi_graphing = false
+) {
   package {"munin": ensure => installed, }
   include concat::setup
 
@@ -10,10 +12,10 @@ class munin::host {
 
   concat::fragment{'munin.conf.header':
     target => '/etc/munin/munin.conf',
-    source => [ "puppet:///modules/site-munin/config/host/${::fqdn}/munin.conf.header",
-                "puppet:///modules/site-munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}",
-                "puppet:///modules/site-munin/config/host/munin.conf.header.${::operatingsystem}",
-                "puppet:///modules/site-munin/config/host/munin.conf.header",
+    source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/munin.conf.header",
+                "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}",
+                "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}",
+                "puppet:///modules/site_munin/config/host/munin.conf.header",
                 "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}",
                 "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}",
                 "puppet:///modules/munin/config/host/munin.conf.header" ],
@@ -26,7 +28,7 @@ class munin::host {
 
   include munin::plugins::muninhost
 
-  if $munin_do_cgi_graphing {
+  if $munin::host::cgi_graphing {
     include munin::host::cgi
   }
 
@@ -35,7 +37,7 @@ class munin::host {
     content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n",
     owner => root, group => 0, mode => 0644;
   }
-  if $use_shorewall {
+  if hiera('use_shorewall',false) {
     include shorewall::rules::out::munin
   }
 }
index 283a243..9980856 100644 (file)
@@ -1,16 +1,16 @@
 class munin::host::cgi {
-    exec{'set_modes_for_cgi':
-        command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
-        refreshonly => true,
-        subscribe => File['/etc/munin/munin.conf.header'],
-    }
+  exec{'set_modes_for_cgi':
+    command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
+    refreshonly => true,
+    subscribe => File['/etc/munin/munin.conf.header'],
+  }
 
-    file{'/etc/logrotate.d/munin':
-        source => [ "puppet:///modules/site-munin/config/host/${::fqdn}/logrotate",
-                    "puppet:///modules/site-munin/config/host/logrotate.${::operatingsystem}",
-                    "puppet:///modules/site-munin/config/host/logrotate",
-                    "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}",
-                    "puppet:///modules/munin/config/host/logrotate" ],
-        owner => root, group => 0, mode => 0644;
-    }
+  file{'/etc/logrotate.d/munin':
+    source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/logrotate",
+                "puppet:///modules/site_munin/config/host/logrotate.${::operatingsystem}",
+                "puppet:///modules/site_munin/config/host/logrotate",
+                "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}",
+                "puppet:///modules/munin/config/host/logrotate" ],
+    owner => root, group => 0, mode => 0644;
+  }
 }
index 9f799aa..fec7b6b 100644 (file)
@@ -4,65 +4,65 @@
 # adapted and improved by admin(at)immerda.ch
 
 define munin::plugin (
-    $ensure = "present",
-    $script_path_in = '',
-    $config = '')
-{
-    include munin::plugin::scriptpaths
-    $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
+  $ensure = "present",
+  $script_path_in = '',
+  $config = ''
+{
+  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"
+  $plugin_src = $ensure ? { "present" => $name, default => $ensure }
+  $plugin = "/etc/munin/plugins/${name}"
+  $plugin_conf = "/etc/munin/plugin-conf.d/${name}.conf"
 
-    include munin::plugins::setup
-    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'];
-            }
-            if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
-              File[$plugin]{
-                seltype => 'munin_etc_t',
-              }
-            }
+  include munin::plugins::setup
+  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'];
+      }
+      if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
+        File[$plugin]{
+          seltype => 'munin_etc_t',
         }
+      }
+    }
+  }
+  case $config {
+    '': {
+      file { $plugin_conf: ensure => absent }
     }
-    case $config {
-        '': {
-            file { $plugin_conf: ensure => absent }
+    default: {
+      case $ensure {
+        absent: {
+          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,
-                        }
-                    }
-                }
+          file { $plugin_conf:
+            content => "[${name}]\n$config\n",
+            mode => 0644, owner => root, group => 0,
+          }
+          if $require {
+            File[$plugin_conf]{
+              require +> $require,
             }
+          }
         }
+      }
     }
+  }
 }
index 5003153..9e74afb 100644 (file)
@@ -1,43 +1,43 @@
 define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') {
-    $plugin_src = $ensure ? {
-        'present' => $name,
-        'absent' => $name,
-        default => $ensure
-    }
-    $real_source = $source ? {
-        ''  =>  "munin/plugins/$plugin_src",
-        default => $source
-    }
-    include munin::plugin::scriptpaths
-    file { "munin_plugin_${name}":
-            path => "$munin::plugin::scriptpaths::script_path/${name}",
-            source => "puppet:///modules/$real_source",
-            mode => 0755, owner => root, group => 0;
-    }
+  $plugin_src = $ensure ? {
+    'present' => $name,
+    'absent' => $name,
+    default => $ensure
+  }
+  $real_source = $source ? {
+    ''  =>  "munin/plugins/$plugin_src",
+    default => $source
+  }
+  include munin::plugin::scriptpaths
+  file { "munin_plugin_${name}":
+    path => "${munin::plugin::scriptpaths::script_path}/${name}",
+    source => "puppet:///modules/${real_source}",
+    mode => 0755, owner => root, group => 0;
+  }
 
-    if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
-      File["munin_plugin_${name}"]{
-        seltype =>  'munin_exec_t',
-      }
+  if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
+    File["munin_plugin_${name}"]{
+      seltype =>  'munin_exec_t',
     }
+  }
 
-    case $::kernel {
-        openbsd: { $basic_require = File['/var/run/munin'] }
-        default: { $basic_require = Package['munin-node'] }
-    }
-    if $require {
-        File["munin_plugin_${name}"]{
-            require => [ $basic_require, $require ],
-        }
-    } else {
-        File["munin_plugin_${name}"]{
-            require => $basic_require,
-        }
+  case $::kernel {
+    openbsd: { $basic_require = File['/var/run/munin'] }
+    default: { $basic_require = Package['munin-node'] }
+  }
+  if $require {
+    File["munin_plugin_${name}"]{
+      require => [ $basic_require, $require ],
     }
-    # register the plugin
-    if $require {
-        munin::plugin{$name: ensure => $ensure, config => $config, require => $require }
-    } else {
-        munin::plugin{$name: ensure => $ensure, config => $config }
+  } else {
+    File["munin_plugin_${name}"]{
+      require => $basic_require,
     }
+  }
+  # register the plugin
+  if $require {
+    munin::plugin{$name: ensure => $ensure, config => $config, require => $require }
+  } else {
+    munin::plugin{$name: ensure => $ensure, config => $config }
+  }
 }
index f4bd39b..2cad97b 100644 (file)
@@ -1,12 +1,12 @@
 class munin::plugin::scriptpaths {
-    case $::operatingsystem {
-        gentoo: { $script_path =  "/usr/libexec/munin/plugins" }
-        debian: { $script_path =  "/usr/share/munin/plugins" }
-        centos: { $script_path =  "/usr/share/munin/plugins" }
-        openbsd: { $script_path = $::operatingsystemrelease ? {
-                                  '4.3' => '/opt/munin/lib/plugins/',
-                                  default => '/usr/local/libexec/munin/plugins/'
-                  } }
-        default: { $script_path =  "/usr/share/munin/plugins" }
-    }
+  case $::operatingsystem {
+    gentoo: { $script_path =  "/usr/libexec/munin/plugins" }
+    debian: { $script_path =  "/usr/share/munin/plugins" }
+    centos: { $script_path =  "/usr/share/munin/plugins" }
+    openbsd: { $script_path = $::operatingsystemrelease ? {
+      '4.3' => '/opt/munin/lib/plugins/',
+      default => '/usr/local/libexec/munin/plugins/'
+    } }
+    default: { $script_path =  "/usr/share/munin/plugins" }
+  }
 }
index 972a674..d26aaeb 100644 (file)
@@ -17,7 +17,7 @@ class munin::plugins::base {
     }
   }
         
-  case $virtual {
+  case $::virtual {
     physical: { include munin::plugins::physical }
     xen0: { include munin::plugins::dom0 }
   }
index 25c1626..27d4689 100644 (file)
@@ -1,5 +1,5 @@
 class munin::plugins::gentoo { 
-    munin::plugin::deploy { 'gentoo_lastupdated':
-      config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail        /usr/bin/tail\nenv.grep        /bin/grep"
-    }
+  munin::plugin::deploy { 'gentoo_lastupdated':
+    config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail        /usr/bin/tail\nenv.grep        /bin/grep"
+  }
 }
index b2c448b..cc79259 100644 (file)
@@ -1,19 +1,19 @@
 # handle if_ and if_err_ plugins
 class munin::plugins::interfaces  { 
 
-  $ifs = regsubst(split($interfaces, " |,"), "(.+)", "if_\\1")
+  $ifs = regsubst(split($::interfaces, " |,"), "(.+)", "if_\\1")
   munin::plugin {
     $ifs: ensure => "if_";
   }
   case $::operatingsystem {
     openbsd: {
-      $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1")
+      $if_errs = regsubst(split($::interfaces, " |,"), "(.+)", "if_errcoll_\\1")
       munin::plugin{
         $if_errs: ensure => "if_errcoll_";
       }
     }
     default: {
-      $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_err_\\1")
+      $if_errs = regsubst(split($::interfaces, " |,"), "(.+)", "if_err_\\1")
       munin::plugin{
         $if_errs: ensure => "if_err_";
       }
index 30e0af6..a73de63 100644 (file)
@@ -3,6 +3,6 @@ class munin::plugins::linux {
     [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]:
       ensure => present;
     acpi:
-      ensure => $acpi_available;
+      ensure => $::acpi_available;
   }
 }
index 254eaaf..14019d0 100644 (file)
@@ -5,27 +5,27 @@ define munin::register (
   $config = []
 )
 {
-    $fhost = $name
-    $client_type = 'client'
+  $fhost = $name
+  $client_type = 'client'
 
-    $munin_port_real = $port ? {
-        'absent' => hiera('munin_port','4949'),
-        default => $port
-    }
+  $munin_port_real = $port ? {
+    'absent' => hiera('munin_port','4949'),
+    default => $port
+  }
 
-    $hiera_munin_host = hiera('munin_host','')
-    $munin_host_real = $host ? {
-        'absent' =>  $hiera_munin_host ? {
-                        '' => $::fqdn,
-                        'fqdn' => $::fqdn,
-                        default => $hiera_munin_host
-                    },
-        default => $host
-    }
+  $hiera_munin_host = hiera('munin_host','')
+  $munin_host_real = $host ? {
+    'absent' =>  $hiera_munin_host ? {
+      '' => $::fqdn,
+      'fqdn' => $::fqdn,
+      default => $hiera_munin_host
+    },
+    default => $host
+  }
 
-    @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}":
-        target => '/etc/munin/munin.conf',
-        content => template("munin/client.erb"),
-        tag => 'munin',
-    }
+  @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}":
+    target => '/etc/munin/munin.conf',
+    content => template("munin/client.erb"),
+    tag => 'munin',
+  }
 }
index acd1e03..3007b67 100644 (file)
@@ -2,26 +2,25 @@ define munin::register::snmp (
   $community = 'public',
   $description = 'absent',
   $port = 'absent'
-)
-{
-    $fhost = $name
-    $munin_host_real = $::fqdn
-    $client_type = 'snmp'
-    $config = [ 'use_node_name no' ]
+) {
+  $fhost = $name
+  $munin_host_real = $::fqdn
+  $client_type = 'snmp'
+  $config = [ 'use_node_name no' ]
 
-    $munin_port_real = $port ? {
-      'absent' => hiera('munin_port','4949'),
-      default => $port
-    }
+  $munin_port_real = $port ? {
+    'absent' => hiera('munin_port','4949'),
+    default => $port
+  }
 
-    exec { "munin_register_snmp_${fhost}":
-        command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh",
-        unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null",
-    }
+  exec { "munin_register_snmp_${fhost}":
+    command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh",
+    unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null",
+  }
 
-    @@concat::fragment{ "munin_snmp_${fhost}":
-        target => '/etc/munin/munin.conf',
-        content => template("munin/client.erb"),
-        tag => 'munin',
-    }
+  @@concat::fragment{ "munin_snmp_${fhost}":
+    target => '/etc/munin/munin.conf',
+    content => template("munin/client.erb"),
+    tag => 'munin',
+  }
 }
index ce87492..603cb66 100644 (file)
@@ -1,18 +1,18 @@
 define munin::remoteplugin($ensure = "present", $source, $config = '') {
-    case $ensure {
-        "absent": { munin::plugin{ $name: ensure => absent } }
-        default: {
-            file {
-                "/var/lib/puppet/modules/munin/plugins/${name}":
-                    source => $source,
-                    mode => 0755, owner => root, group => 0;
-            }
-            munin::plugin { $name:
-                ensure => $ensure,
-                config => $config,
-                script_path_in => "/var/lib/puppet/modules/munin/plugins",
-            }
-        }
+  case $ensure {
+    "absent": { munin::plugin{ $name: ensure => absent } }
+    default: {
+      file {
+        "/var/lib/puppet/modules/munin/plugins/${name}":
+          source => $source,
+          mode => 0755, owner => root, group => 0;
+      }
+      munin::plugin { $name:
+        ensure => $ensure,
+        config => $config,
+        script_path_in => "/var/lib/puppet/modules/munin/plugins",
+      }
     }
+  }
 }