From 74f66a8e77b153552ef52efee03187320e1ce877 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 10 Dec 2010 16:48:01 -0500 Subject: standardize formatting --- manifests/client/base.pp | 10 ++++- manifests/client/darwin.pp | 44 +++++++++++--------- manifests/client/debian.pp | 4 +- manifests/client/gentoo.pp | 8 ++-- manifests/client/openbsd.pp | 83 ++++++++++++++++++++----------------- manifests/client/package.pp | 1 + manifests/host/cgi.pp | 8 ++-- manifests/plugin.pp | 91 ++++++++++++++++++++--------------------- manifests/plugin/deploy.pp | 70 ++++++++++++++++--------------- manifests/plugin/scriptpaths.pp | 3 +- manifests/plugins/apache.pp | 10 +++-- manifests/plugins/base.pp | 91 ++++++++++++++++++++++------------------- manifests/plugins/dom0.pp | 15 +++---- manifests/plugins/gentoo.pp | 4 +- manifests/plugins/interfaces.pp | 32 +++++++-------- manifests/plugins/linux.pp | 16 ++++---- manifests/plugins/openbsd.pp | 14 +++---- manifests/plugins/physical.pp | 8 ++-- manifests/plugins/selinux.pp | 6 ++- manifests/plugins/vserver.pp | 10 +++-- manifests/register.pp | 24 +++++------ manifests/register_snmp.pp | 37 +++++++++-------- manifests/remoteplugin.pp | 30 +++++++------- manifests/snmp_collector.pp | 24 +++++------ 24 files changed, 342 insertions(+), 301 deletions(-) (limited to 'manifests') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index b834e9b..0f0feca 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,23 +1,29 @@ class munin::client::base { + service { 'munin-node': ensure => running, enable => true, hasstatus => true, hasrestart => true, } - file {'/etc/munin': + + file { '/etc/munin': 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': + + 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: } include munin::plugins::base + } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index f6fc95f..5ae5b60 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,21 +1,27 @@ class munin::client::darwin { - file { "/usr/share/snmp/snmpd.conf": - mode => 744, - content => template("munin/darwin_snmpd.conf.erb"), - group => 0, - owner => root, - } - delete_matching_line{"startsnmpdno": - file => "/etc/hostconfig", - pattern => "SNMPSERVER=-NO-", - } - line { "startsnmpdyes": - file => "/etc/hostconfig", - line => "SNMPSERVER=-YES-", - notify => Exec["/sbin/SystemStarter start SNMP"], - } - exec{"/sbin/SystemStarter start SNMP": - noop => false, - } - munin::register_snmp { $fqdn: } + + file { '/usr/share/snmp/snmpd.conf': + mode => 744, + content => template("munin/darwin_snmpd.conf.erb"), + group => 0, + owner => root, + } + + delete_matching_line{"startsnmpdno": + file => "/etc/hostconfig", + pattern => "SNMPSERVER=-NO-", + } + + line { "startsnmpdyes": + file => "/etc/hostconfig", + line => "SNMPSERVER=-YES-", + notify => Exec["/sbin/SystemStarter start SNMP"], + } + + exec{"/sbin/SystemStarter start SNMP": + noop => false, + } + + munin::register_snmp { $fqdn: } + } diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index bd0fad5..e75f484 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,13 +1,15 @@ class munin::client::debian inherits munin::client::package { + # the plugin will need that if !defined(Package["iproute"]) { 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"), } diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index 53d472b..e651134 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,8 +1,10 @@ class munin::client::gentoo inherits munin::client::package { + Package['munin-node'] { name => 'munin', category => 'net-analyzer', - } - - include munin::plugins::gentoo + } + + include munin::plugins::gentoo + } diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 90bf7df..468cffa 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,43 +1,50 @@ # currently we install munin on openbsd by targz # :( + class munin::client::openbsd inherits munin::client::base { - file{'/usr/src/munin_openbsd.tar.gz': - source => "puppet://$server/modules/munin/openbsd/package/munin_openbsd.tar.gz", - owner => root, group => 0, mode => 0600; - } - package{ [ 'p5-Compress-Zlib', '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'], - } - file{[ '/var/run/munin', '/var/log/munin' ]: - ensure => directory, - require => Exec['extract_openbsd'], - owner => root, group => 0, mode => 0755; - } - openbsd::rc_local{'munin-node': - binary => '/opt/munin/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 => '/opt/munin/sbin/munin-node', - hasstatus => false, - hasrestart => false, - 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, - } + file{ '/usr/src/munin_openbsd.tar.gz': + source => "puppet://$server/modules/munin/openbsd/package/munin_openbsd.tar.gz", + owner => root, group => 0, mode => 0600; + } + + package { [ 'p5-Compress-Zlib', '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'], + } + + file{ [ '/var/run/munin', '/var/log/munin' ]: + ensure => directory, + require => Exec['extract_openbsd'], + owner => root, group => 0, mode => 0755; + } + + openbsd::rc_local{ 'munin-node': + binary => '/opt/munin/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 => '/opt/munin/sbin/munin-node', + hasstatus => false, + hasrestart => false, + 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, + } } diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 921d996..f6e7a08 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -25,4 +25,5 @@ class munin::client::package inherits munin::client::base { # boot the munin-node without failure! before => Package['munin-node'], } + } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 45e0034..0cb3b32 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,14 +1,15 @@ class munin::host::cgi inherits munin::host { + case $operatingsystem { debian: { - exec{'set_modes_for_cgi': + exec { 'set_modes_for_cgi': command => 'chgrp www-data /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/munin/* -maxdepth 1 -type d -exec chgrp -R www-data {} \; && find /var/www/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', refreshonly => true, subscribe => File['/etc/munin/munin.conf.header'], } } default: { - exec{'set_modes_for_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'], @@ -16,7 +17,7 @@ class munin::host::cgi inherits munin::host { } } - file{'/etc/logrotate.d/munin': + file{ '/etc/logrotate.d/munin': source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/logrotate", "puppet://$server/modules/site-munin/config/host/logrotate.$operatingsystem", "puppet://$server/modules/site-munin/config/host/logrotate", @@ -24,4 +25,5 @@ class munin::host::cgi inherits munin::host { "puppet://$server/modules/munin/config/host/logrotate" ], owner => root, group => 0, mode => 0644; } + } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 1fa4651..10aab79 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -8,57 +8,54 @@ define munin::plugin ( $ensure = "present", $script_path_in = '', - $config = '') + $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" - 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']; - } - - } + 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, } } - case $config { - '': { - file { $plugin_conf: 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: { - 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, + } + } } + } } + } } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 846a873..d4dbf6d 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,37 +1,39 @@ -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://$server/modules/$real_source", - mode => 0755, owner => root, group => 0; - } +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://$server/modules/$real_source", + mode => 0755, owner => root, group => 0; + } - 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, - } - } - # register the plugin - if $require { - munin::plugin{$name: ensure => $ensure, config => $config, require => $require } - } else { - munin::plugin{$name: ensure => $ensure, config => $config } + 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, } + } + + # register the plugin + if $require { munin::plugin{$name: ensure => $ensure, config => $config, require => $require } } } + else { + munin::plugin{$name: ensure => $ensure, config => $config } + } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index ebaa6fa..bfdf1be 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,5 +1,6 @@ class munin::plugin::scriptpaths { - case $operatingsystem { + + case $operatingsystem { gentoo: { $script_path = "/usr/libexec/munin/plugins" } debian: { $script_path = "/usr/share/munin/plugins" } centos: { $script_path = "/usr/share/munin/plugins" } diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp index ee90de8..030e7e6 100644 --- a/manifests/plugins/apache.pp +++ b/manifests/plugins/apache.pp @@ -1,6 +1,8 @@ class munin::plugins::apache inherits munin::plugins::base { - munin::plugin{ "apache_accesses": } - munin::plugin{ "apache_processes": } - munin::plugin{ "apache_volume": } - munin::plugin::deploy { "apache_activity": } + + munin::plugin{ "apache_accesses": } + munin::plugin{ "apache_processes": } + munin::plugin{ "apache_volume": } + munin::plugin::deploy { "apache_activity": } + } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 5fc2476..64756bc 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -1,50 +1,55 @@ class munin::plugins::base { - file { - [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - source => "puppet://$server/modules/common/empty", - ignore => [ '\.ignore', 'snmp_*' ], - ensure => directory, checksum => mtime, - recurse => true, purge => true, force => true, - mode => 0755, owner => root, group => 0, - notify => Service['munin-node']; - '/etc/munin/plugin-conf.d/munin-node': - ensure => present, - mode => 0644, owner => root, group => 0, - notify => Service['munin-node'], - } - munin::plugin { - [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, uptime, vmstat - ]: - ensure => present, - } - include munin::plugins::interfaces + file { + [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: + source => "puppet://$server/modules/common/empty", + ignore => [ '\.ignore', 'snmp_*' ], + ensure => directory, checksum => mtime, + recurse => true, purge => true, force => true, + mode => 0755, owner => root, group => 0, + notify => Service['munin-node']; - case $kernel { - openbsd: { - File['/etc/munin/plugin-conf.d/munin-node']{ - before => File['/var/run/munin'], - } - } - default: { - File['/etc/munin/plugin-conf.d/munin-node']{ - before => Package['munin-node'], - } - } + '/etc/munin/plugin-conf.d/munin-node': + ensure => present, + mode => 0644, owner => root, group => 0, + notify => Service['munin-node'], + } + + munin::plugin { + [ df, cpu, interrupts, load, memory, netstat, open_files, + processes, swap, uptime, vmstat ]: + ensure => present, + } + + include munin::plugins::interfaces + + case $kernel { + openbsd: { + File['/etc/munin/plugin-conf.d/munin-node']{ + before => File['/var/run/munin'], + } } - case $kernel { - linux: { - case $vserver { - guest: { include munin::plugins::vserver } - default: { - include munin::plugins::linux - } - } - } + default: { + File['/etc/munin/plugin-conf.d/munin-node']{ + before => Package['munin-node'], + } } - case $virtual { - physical: { include munin::plugins::physical } - xen0: { include munin::plugins::dom0 } + } + + case $kernel { + linux: { + case $vserver { + guest: { include munin::plugins::vserver } + default: { + include munin::plugins::linux + } + } } + } + + case $virtual { + physical: { include munin::plugins::physical } + xen0: { include munin::plugins::dom0 } + } + } diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp index 8d919c3..3efc6bd 100644 --- a/manifests/plugins/dom0.pp +++ b/manifests/plugins/dom0.pp @@ -1,9 +1,10 @@ class munin::plugins::dom0 inherits munin::plugins::physical { - munin::plugin::deploy { "xen": config => "user root"} - munin::plugin::deploy { "xen-cpu": config => "user root"} - munin::plugin::deploy { "xen_memory": config => "user root"} - munin::plugin::deploy { "xen_mem": config => "user root"} - munin::plugin::deploy { "xen_vm": config => "user root"} - munin::plugin::deploy { "xen_vbd": config => "user root"} - munin::plugin::deploy { "xen_traffic_all": config => "user root"} + + munin::plugin::deploy { "xen": config => "user root"} + munin::plugin::deploy { "xen-cpu": config => "user root"} + munin::plugin::deploy { "xen_memory": config => "user root"} + munin::plugin::deploy { "xen_mem": config => "user root"} + munin::plugin::deploy { "xen_vm": config => "user root"} + munin::plugin::deploy { "xen_vbd": config => "user root"} + munin::plugin::deploy { "xen_traffic_all": config => "user root"} } diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp index 81d0e6b..6d02a24 100644 --- a/manifests/plugins/gentoo.pp +++ b/manifests/plugins/gentoo.pp @@ -1,3 +1,5 @@ class munin::plugins::gentoo inherits munin::plugins::base { - 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"} + } diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 99b85ba..de4b75b 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,22 +1,22 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces inherits munin::plugins::base { + + $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") - $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") - munin::plugin { - $ifs: ensure => "if_"; + munin::plugin { $ifs: ensure => "if_"; } + + case $operatingsystem { + openbsd: { + $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") + munin::plugin{ + $if_errs: ensure => "if_errcoll_"; + } } - case $operatingsystem { - openbsd: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") - munin::plugin{ - $if_errs: ensure => "if_errcoll_"; - } - } - default: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1") - munin::plugin{ - $if_errs: ensure => "if_err_"; - } - } + default: { + $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1") + munin::plugin{ + $if_errs: ensure => "if_err_"; + } } + } } diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index c7beb59..5c6afe9 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,10 +1,12 @@ class munin::plugins::linux inherits munin::plugins::base { - munin::plugin { - [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: - ensure => present; - acpi: - ensure => $acpi_available; - } - include munin::plugins::interfaces + munin::plugin { + [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: + ensure => present; + acpi: + ensure => $acpi_available; + } + + include munin::plugins::interfaces + } diff --git a/manifests/plugins/openbsd.pp b/manifests/plugins/openbsd.pp index 67cf32d..feb71fb 100644 --- a/manifests/plugins/openbsd.pp +++ b/manifests/plugins/openbsd.pp @@ -1,13 +1,9 @@ class munin::plugins::openbsd inherits munin::plugins::base { - munin::plugin { + + munin::plugin { [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, users, vmstat - ]: - ensure => present, - } - munin::plugin { - [ memory_pools, memory_types ]: + processes, swap, users, vmstat, memory_pools, memory_types ]: ensure => present, - } - + } + } diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp index 6706711..1bf1465 100644 --- a/manifests/plugins/physical.pp +++ b/manifests/plugins/physical.pp @@ -1,5 +1,7 @@ class munin::plugins::physical inherits munin::plugins::base { - case $kernel { - linux: { munin::plugin { iostat: } } - } + + case $kernel { + linux: { munin::plugin { iostat: } } + } + } diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp index 6affc86..847f0b9 100644 --- a/manifests/plugins/selinux.pp +++ b/manifests/plugins/selinux.pp @@ -1,4 +1,6 @@ class munin::plugins::selinux inherits munin::plugins::base { - munin::plugin::deploy { "selinuxenforced": } - munin::plugin::deploy { "selinux_avcstats": } + + munin::plugin::deploy { "selinuxenforced": } + munin::plugin::deploy { "selinux_avcstats": } + } diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp index bce28a1..ffc4b0a 100644 --- a/manifests/plugins/vserver.pp +++ b/manifests/plugins/vserver.pp @@ -1,7 +1,9 @@ class munin::plugins::vserver inherits munin::plugins::base { - munin::plugin { - [ netstat, processes ]: - ensure => present; - } + + munin::plugin { + [ netstat, processes ]: + ensure => present; + } + } diff --git a/manifests/register.pp b/manifests/register.pp index e1271e1..55b98fe 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,17 +1,17 @@ define munin::register() { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => $fqdn, - 'fqdn' => $fqdn, - default => $munin_host - } - - @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": - ensure => present, - content => template("munin/defaultclient.erb"), - tag => 'munin', - } + $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } + $munin_host_real = $munin_host ? { + '' => $fqdn, + 'fqdn' => $fqdn, + default => $munin_host + } + + @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": + ensure => present, + content => template("munin/defaultclient.erb"), + tag => 'munin', + } } diff --git a/manifests/register_snmp.pp b/manifests/register_snmp.pp index e74ba44..1ce606e 100644 --- a/manifests/register_snmp.pp +++ b/manifests/register_snmp.pp @@ -1,21 +1,22 @@ # snmp_testplugin: the plugin we use to test if it's set -define munin::register_snmp( - $snmpd_testplugin = 'load' -) +define munin::register_snmp( $snmpd_testplugin = 'load' ) { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => '*', - 'fqdn' => '*', - default => $munin_host - } - exec{"register_snmp_munin_for_${name}": - command => "munin-node-configure-snmp ${name} | sh", - unless => "test -e /etc/munin/plugins/snmp_${name}_${snmpd_testplugin}", - } - @@file { "munin_snmp_${name}": path => "/var/lib/puppet/modules/munin/nodes/${name}", - ensure => present, - content => template("munin/snmpclient.erb"), - tag => 'munin', - } + $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } + $munin_host_real = $munin_host ? { + '' => '*', + 'fqdn' => '*', + default => $munin_host + } + + exec{"register_snmp_munin_for_${name}": + command => "munin-node-configure-snmp ${name} | sh", + unless => "test -e /etc/munin/plugins/snmp_${name}_${snmpd_testplugin}", + } + + @@file { "munin_snmp_${name}": + path => "/var/lib/puppet/modules/munin/nodes/${name}", + ensure => present, + content => template("munin/snmpclient.erb"), + tag => 'munin', + } } diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp index 4bca235..cc83f8c 100644 --- a/manifests/remoteplugin.pp +++ b/manifests/remoteplugin.pp @@ -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", - } - } +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", + } } + } } diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp index 4f72b95..3b60541 100644 --- a/manifests/snmp_collector.pp +++ b/manifests/snmp_collector.pp @@ -1,14 +1,14 @@ -class munin::snmp_collector{ - file { - "/var/lib/puppet/modules/munin/create_snmp_links": - source => "puppet://$server/modules/munin/create_snmp_links.sh", - mode => 755, owner => root, group => 0; - } +class munin::snmp_collector { - exec { "create_snmp_links": - command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes", - require => File["snmp_links"], - timeout => "2048", - schedule => daily - } + file { "/var/lib/puppet/modules/munin/create_snmp_links": + source => "puppet://$server/modules/munin/create_snmp_links.sh", + mode => 755, owner => root, group => 0; + } + + exec { "create_snmp_links": + command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes", + require => File["snmp_links"], + timeout => "2048", + schedule => daily + } } -- cgit v1.2.3