From d6369efd46e00c31b6ee9a109014da9e8659e2c4 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 25 Mar 2013 14:45:56 +0100 Subject: fix subscribe --- manifests/host/cgi.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 9980856..8a956bf 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -2,7 +2,7 @@ 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'], + subscribe => Concat::Fragment['munin.conf.header'], } file{'/etc/logrotate.d/munin': -- cgit v1.2.3 From 8a956cc2f1ad97d06e9a267312e55260ecb29eac Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 25 Mar 2013 14:46:25 +0100 Subject: linting --- manifests/host/cgi.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests') diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 8a956bf..a19c432 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,6 +1,7 @@ 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 {} \;', + 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 => Concat::Fragment['munin.conf.header'], } -- cgit v1.2.3 From eb0c5f288815abf49b8a7f28979a2777938648c7 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 25 Mar 2013 19:06:36 +0100 Subject: fix duplicate command introduced by previous merge --- manifests/host/cgi.pp | 1 - 1 file changed, 1 deletion(-) (limited to 'manifests') diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index a19c432..4c0d0c9 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,6 +1,5 @@ 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 {} \;', 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 => Concat::Fragment['munin.conf.header'], -- cgit v1.2.3 From e9f80adaa87d5a6a906e406792629372ad15cc5f Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 6 May 2013 17:31:14 +0200 Subject: Make the CGI owner configurable --- manifests/host.pp | 5 ++++- manifests/host/cgi.pp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/host.pp b/manifests/host.pp index 05dcb5e..0992d2b 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -4,6 +4,7 @@ class munin::host( $cgi_graphing = false, + $cgi_owner = 'apache', $export_tag = 'munin' ) { package {"munin": ensure => installed, } @@ -30,7 +31,9 @@ class munin::host( include munin::plugins::muninhost if $munin::host::cgi_graphing { - include munin::host::cgi + class {'munin::host::cgi': + owner => $cgi_owner, + } } # from time to time we cleanup hanging munin-runs diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 4c0d0c9..6e5efcd 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,6 +1,8 @@ -class munin::host::cgi { +class munin::host::cgi( + $owner = 'apache' +) { 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 {} \;', + command => "chgrp ${owner} /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 ${owner} {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;", refreshonly => true, subscribe => Concat::Fragment['munin.conf.header'], } -- cgit v1.2.3 From aa8da42f01d26e184ec110840723355953c42b00 Mon Sep 17 00:00:00 2001 From: Wouter Schoot Date: Mon, 24 Jun 2013 16:19:19 +0200 Subject: Changed include to ordering to prevent duplicate inclusions --- manifests/plugins/setup.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index 197b657..96891d3 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,7 +1,7 @@ class munin::plugins::setup { # This is required for the munin-node service and package requirements below. - include munin::client + Class['munin::client'] -> Class['munin::plugins::setup'] file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: -- cgit v1.2.3 From aaf55c9ebfa0e34f63b2ca3c2b660e1d164026dd Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 6 May 2013 18:13:12 +0200 Subject: lintify --- manifests/client.pp | 4 ++-- manifests/client/base.pp | 26 ++++++++++++++++---------- manifests/client/centos.pp | 1 + manifests/client/darwin.pp | 29 +++++++++++++++-------------- manifests/client/debian.pp | 9 +++++---- manifests/client/gentoo.pp | 3 ++- manifests/client/openbsd.pp | 2 +- manifests/client/package.pp | 1 + manifests/host.pp | 18 +++++++++++------- manifests/host/cgi.pp | 9 ++++++--- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- manifests/plugin/scriptpaths.pp | 13 +++++++------ manifests/plugins/base.pp | 16 ++++++++++------ manifests/plugins/centos.pp | 5 ++++- manifests/plugins/debian.pp | 1 + manifests/plugins/djbdns.pp | 5 +++-- manifests/plugins/dom0.pp | 1 + manifests/plugins/gentoo.pp | 3 ++- manifests/plugins/interfaces.pp | 30 +++++++++++++----------------- manifests/plugins/kvm.pp | 1 + manifests/plugins/linux.pp | 7 ++++--- manifests/plugins/muninhost.pp | 3 ++- manifests/plugins/openbsd.pp | 5 +++-- manifests/plugins/physical.pp | 6 ++++-- manifests/plugins/selinux.pp | 1 + manifests/plugins/setup.pp | 5 +++-- manifests/plugins/vserver.pp | 4 ++-- manifests/register.pp | 3 ++- manifests/register/snmp.pp | 9 +++++---- manifests/remoteplugin.pp | 15 +++++++++------ manifests/snmp_collector.pp | 23 +++++++++++++---------- 32 files changed, 152 insertions(+), 110 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 2316bc9..4d70cac 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -22,8 +22,8 @@ class munin::client( } if $munin::client::manage_shorewall { class{'shorewall::rules::munin': - munin_port => $port, - munin_collector => delete($allow,'127.0.0.1'), + munin_port => $port, + munin_collector => delete($allow,'127.0.0.1'), collector_source => $shorewall_collector_source, } } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 78398a9..3c0ba89 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,24 +1,30 @@ +# Install a basic munin client class munin::client::base { service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, + ensure => running, + enable => true, + hasstatus => true, hasrestart => true, } file {'/etc/munin': ensure => directory, - mode => 0755, owner => root, group => 0; + 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, + notify => Service['munin-node'], + mode => '0644', + owner => root, + group => 0, + } + $host = $munin::client::host ? { + '*' => $::fqdn, + default => $munin::client::host } munin::register { $::fqdn: - host => $munin::client::host ? { - '*' => $::fqdn, - default => $munin::client::host - }, + host => $host, port => $munin::client::port, use_ssh => $munin::client::use_ssh, config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp index 3a7151b..cd4f2f6 100644 --- a/manifests/client/centos.pp +++ b/manifests/client/centos.pp @@ -1,3 +1,4 @@ +# Install a munin client on centos class munin::client::centos inherits munin::client::package { include munin::plugins::centos } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index 264263d..7639896 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,21 +1,22 @@ +# Install a munin client on darwin class munin::client::darwin { - file { "/usr/share/snmp/snmpd.conf": - mode => 744, - content => template("munin/darwin_snmpd.conf.erb"), - group => 0, - owner => root, + file { '/usr/share/snmp/snmpd.conf': + mode => '0744', + content => template('munin/darwin_snmpd.conf.erb'), + group => 0, + owner => root, } - line{"startsnmpdno": - file => "/etc/hostconfig", - line => "SNMPSERVER=-NO-", - ensure => 'absent', + line{'startsnmpdno': + ensure => absent, + file => '/etc/hostconfig', + line => 'SNMPSERVER=-NO-', } - line { "startsnmpdyes": - file => "/etc/hostconfig", - line => "SNMPSERVER=-YES-", - notify => Exec["/sbin/SystemStarter start SNMP"], + line { 'startsnmpdyes': + file => '/etc/hostconfig', + line => 'SNMPSERVER=-YES-', + notify => Exec['/sbin/SystemStarter start SNMP'], } - 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 e67ac26..3cfc3fc 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,15 +1,16 @@ +# Install the munin client on debian class munin::client::debian inherits munin::client::package { # the plugin will need that - package { "iproute": ensure => installed } + package { 'iproute': ensure => installed } - Service["munin-node"]{ + Service['munin-node']{ # sarge's munin-node init script has no status hasstatus => $::lsbdistcodename ? { sarge => false, default => true } } - File["/etc/munin/munin-node.conf"]{ + 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 } + plugin { 'postfix_mailvolume': ensure => absent } include munin::plugins::debian } diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index e79f6b0..186950b 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,7 +1,8 @@ +# install a munin client on gentoo class munin::client::gentoo inherits munin::client::package { Package['munin-node'] { - name => 'munin', + name => 'munin', category => 'net-analyzer', } diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index cd21abf..e3c18d5 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -4,7 +4,7 @@ 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", + source => 'puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz', owner => root, group => 0, mode => '0600'; diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 206ccc8..0958202 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,3 +1,4 @@ +# Install a munin client using packages class munin::client::package inherits munin::client::base { package { 'munin-node': ensure => installed } Service['munin-node']{ diff --git a/manifests/host.pp b/manifests/host.pp index 007c43a..e666c3d 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -7,7 +7,7 @@ class munin::host( $cgi_owner = 'os_default', $export_tag = 'munin' ) { - package {"munin": ensure => installed, } + package {'munin': ensure => installed, } include concat::setup Concat::Fragment <<| tag == $export_tag |>> @@ -17,15 +17,17 @@ class munin::host( 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/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" ], - order => 05, + 'puppet:///modules/munin/config/host/munin.conf.header' ], + order => 05, } - concat{ "/etc/munin/munin.conf": - owner => root, group => 0, mode => 0644; + concat{ '/etc/munin/munin.conf': + owner => root, + group => 0, + mode => '0644', } include munin::plugins::muninhost @@ -39,7 +41,9 @@ class munin::host( # from time to time we cleanup hanging munin-runs file{'/etc/cron.d/munin_kill': 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; + owner => root, + group => 0, + mode => '0644', } if $munin::host::manage_shorewall { include shorewall::rules::out::munin diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 1c0072d..5b0ecbb 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,3 +1,4 @@ +# Set up a munin host using CGI rendering class munin::host::cgi( $owner = 'os_default' ) { @@ -31,9 +32,11 @@ class munin::host::cgi( 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/site_munin/config/host/logrotate', "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}", - "puppet:///modules/munin/config/host/logrotate" ], - owner => root, group => 0, mode => 0644; + 'puppet:///modules/munin/config/host/logrotate' ], + owner => root, + group => 0, + mode => '0644', } } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index ffe5452..60af877 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -26,7 +26,7 @@ define munin::plugin ( require => $dep, notify => Service['munin-node']; } - if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File[$plugin]{ seltype => 'munin_etc_t', } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index cbf64fb..c514eed 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -23,7 +23,7 @@ define munin::plugin::deploy( mode => '0755'; } - if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File["munin_plugin_${name}"]{ seltype => $seltype, } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index 2cad97b..f31f38d 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,12 +1,13 @@ +# Determine the script path for each OS 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" } + 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/' + '4.3' => '/opt/munin/lib/plugins/', + default => '/usr/local/libexec/munin/plugins/', } } - default: { $script_path = "/usr/share/munin/plugins" } + default: { $script_path = '/usr/share/munin/plugins' } } } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index c6b88ed..33cd84d 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -1,29 +1,33 @@ +# A basic set of plugins class munin::plugins::base { # setup basic plugins munin::plugin { - [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, uptime, users, vmstat ]: + [ 'df', 'cpu', 'interrupts', 'load', 'memory', 'netstat', 'open_files', + 'processes', 'swap', 'uptime', 'users', 'vmstat' ]: ensure => present, } file{'/etc/munin/plugin-conf.d/df': content => "[df*]\nenv.exclude none unknown iso9660 squashfs udf romfs ramfs debugfs binfmt_misc rpc_pipefs fuse.gvfs-fuse-daemon\n", - require => Munin::Plugin[df], - owner => root, group => 0, mode => 0644; + require => Munin::Plugin['df'], + owner => 'root', + group => 0, + mode => '0644', } include munin::plugins::interfaces case $::kernel { openbsd: { include munin::plugins::openbsd } linux: { - case $vserver { + case $::vserver { guest: { include munin::plugins::vserver } default: { include munin::plugins::linux } } } } - + case $::virtual { physical: { include munin::plugins::physical } xen0: { include munin::plugins::dom0 } + default: { } } } diff --git a/manifests/plugins/centos.pp b/manifests/plugins/centos.pp index 60c706c..0bb7697 100644 --- a/manifests/plugins/centos.pp +++ b/manifests/plugins/centos.pp @@ -1,3 +1,6 @@ +# Install munin plugins for centos class munin::plugins::centos inherits munin::plugins::base { - munin::plugin { users: ensure => present; } + munin::plugin { 'users': + ensure => present, + } } diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp index f756150..efa922b 100644 --- a/manifests/plugins/debian.pp +++ b/manifests/plugins/debian.pp @@ -1 +1,2 @@ +# Debian specific plugins class munin::plugins::debian { } diff --git a/manifests/plugins/djbdns.pp b/manifests/plugins/djbdns.pp index c0a5163..de3936b 100644 --- a/manifests/plugins/djbdns.pp +++ b/manifests/plugins/djbdns.pp @@ -1,3 +1,4 @@ -class munin::plugins::djbdns { - munin::plugin::deploy { "tinydns": } +# Set up the djbdns plugin +class munin::plugins::djbdns { + munin::plugin::deploy { 'tinydns': } } diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp index 44995fc..98aee1d 100644 --- a/manifests/plugins/dom0.pp +++ b/manifests/plugins/dom0.pp @@ -1,3 +1,4 @@ +# Set up plugins for a Xen dom0 host class munin::plugins::dom0 { munin::plugin::deploy { [ 'xen', 'xen_cpu', 'xen_memory', 'xen_mem', diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp index 27d4689..36f2370 100644 --- a/manifests/plugins/gentoo.pp +++ b/manifests/plugins/gentoo.pp @@ -1,4 +1,5 @@ -class munin::plugins::gentoo { +# Set up the plugins for a gentoo host +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" } diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index da89ed0..b92802b 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,25 +1,21 @@ # handle if_ and if_err_ plugins -class munin::plugins::interfaces { +class munin::plugins::interfaces { + + $if_err_plugin = $::operatingsystem ? { + 'openbsd' => 'if_errcoll_', + default => 'if_err_', + } # filter out many of the useless interfaces that show up $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') - $ifs = regsubst($real_ifs, '(.+)', "if_\\1") + $ifs = regsubst($real_ifs, '(.+)', 'if_\1') + $if_errs = regsubst($real_ifs, '(.+)', "${if_err_plugin}\1") - munin::plugin { - $ifs: ensure => 'if_'; + munin::plugin { $ifs: + ensure => 'if_', } - case $::operatingsystem { - openbsd: { - $if_errs = regsubst($real_ifs, '(.+)', "if_errcoll_\\1") - munin::plugin{ - $if_errs: ensure => 'if_errcoll_'; - } - } - default: { - $if_errs = regsubst($real_ifs, '(.+)', "if_err_\\1") - munin::plugin{ - $if_errs: ensure => 'if_err_'; - } - } + + munin::plugin { $if_errs: + ensure => $if_err_plugin, } } diff --git a/manifests/plugins/kvm.pp b/manifests/plugins/kvm.pp index 7a1430f..650e5ef 100644 --- a/manifests/plugins/kvm.pp +++ b/manifests/plugins/kvm.pp @@ -1,3 +1,4 @@ +# Set up munin plugins for a KVM host class munin::plugins::kvm { munin::plugin::deploy { [ 'kvm_cpu', 'kvm_mem', 'kvm_net' ]:; diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index a73de63..57f2bba 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,8 +1,9 @@ -class munin::plugins::linux { +# Set up plugins for a linux host +class munin::plugins::linux { munin::plugin { - [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: + [ 'df_abs', 'forks', 'df_inode', 'irqstats', 'entropy', 'open_inodes' ]: ensure => present; - acpi: + 'acpi': ensure => $::acpi_available; } } diff --git a/manifests/plugins/muninhost.pp b/manifests/plugins/muninhost.pp index e4fb87d..644adb6 100644 --- a/manifests/plugins/muninhost.pp +++ b/manifests/plugins/muninhost.pp @@ -1,3 +1,4 @@ -class munin::plugins::muninhost { +# Set up the plugins for a munin host +class munin::plugins::muninhost { munin::plugin { ['munin_update', 'munin_graph']: } } diff --git a/manifests/plugins/openbsd.pp b/manifests/plugins/openbsd.pp index b549994..c195a1d 100644 --- a/manifests/plugins/openbsd.pp +++ b/manifests/plugins/openbsd.pp @@ -1,6 +1,7 @@ -class munin::plugins::openbsd { +# Set up the plugins for an openbsd host +class munin::plugins::openbsd { munin::plugin { - [ memory_pools, memory_types ]: + [ 'memory_pools', 'memory_types' ]: ensure => present, } } diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp index a1c27a7..b04845c 100644 --- a/manifests/plugins/physical.pp +++ b/manifests/plugins/physical.pp @@ -1,5 +1,7 @@ -class munin::plugins::physical { +# Set up the plugins for a physical machine +class munin::plugins::physical { case $::kernel { - linux: { munin::plugin { iostat: } } + linux: { munin::plugin { 'iostat': } } + default: {} } } diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp index d094f35..9e03f0a 100644 --- a/manifests/plugins/selinux.pp +++ b/manifests/plugins/selinux.pp @@ -1,3 +1,4 @@ +# SELinux specific plugins class munin::plugins::selinux { munin::plugin{ [ 'selinux_avcstat' ]: } } diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index 197b657..e6210e9 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,3 +1,4 @@ +# Set up the munin plugins for a node class munin::plugins::setup { # This is required for the munin-node service and package requirements below. @@ -5,10 +6,10 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - ignore => 'snmp_*', ensure => directory, + ignore => 'snmp_*', checksum => mtime, - recurse => true, + recurse => true, purge => true, force => true, notify => Service['munin-node'], diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp index e3eec05..5dc6431 100644 --- a/manifests/plugins/vserver.pp +++ b/manifests/plugins/vserver.pp @@ -1,7 +1,7 @@ +# vserver specific plugins class munin::plugins::vserver { munin::plugin { - [ netstat, processes ]: + [ 'netstat', 'processes' ]: ensure => present; } } - diff --git a/manifests/register.pp b/manifests/register.pp index 309c322..1f6d787 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,3 +1,4 @@ +# Register a munin client define munin::register ( $host = $::fqdn, $port = '4949', @@ -12,7 +13,7 @@ define munin::register ( @@concat::fragment{ "munin_client_${fhost}_${port}": target => '/etc/munin/munin.conf', - content => template("munin/client.erb"), + content => template('munin/client.erb'), tag => $export_tag, } } diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 78c3e91..06bb00b 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,3 +1,4 @@ +# Register a munin node with snmp enabled define munin::register::snmp ( $community = 'public', $description = 'absent', @@ -10,12 +11,12 @@ define munin::register::snmp ( exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", - unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + 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', + target => '/etc/munin/munin.conf', + content => template('munin/client.erb'), + tag => 'munin', } } diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp index 603cb66..a2abf69 100644 --- a/manifests/remoteplugin.pp +++ b/manifests/remoteplugin.pp @@ -1,16 +1,19 @@ -define munin::remoteplugin($ensure = "present", $source, $config = '') { +# Configure a munin remote plugin +define munin::remoteplugin($ensure = 'present', $source, $config = '') { case $ensure { - "absent": { munin::plugin{ $name: ensure => absent } } + 'absent': { munin::plugin{ $name: ensure => absent } } default: { file { "/var/lib/puppet/modules/munin/plugins/${name}": source => $source, - mode => 0755, owner => root, group => 0; + mode => '0755', + owner => root, + group => 0, } munin::plugin { $name: - ensure => $ensure, - config => $config, - script_path_in => "/var/lib/puppet/modules/munin/plugins", + 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 0f8318a..4ff3bf9 100644 --- a/manifests/snmp_collector.pp +++ b/manifests/snmp_collector.pp @@ -1,14 +1,17 @@ +# Set up munin as an SNMP collector class munin::snmp_collector{ - file { - "/var/lib/puppet/modules/munin/create_snmp_links": - source => "puppet:///modules/munin/create_snmp_links.sh", - mode => 755, owner => root, group => 0; - } + file { + '/var/lib/puppet/modules/munin/create_snmp_links': + source => 'puppet:///modules/munin/create_snmp_links.sh', + mode => '0755', + 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 + 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 From 26224742940b06335bca3cb8f5e09d0c0a5cabef Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 20:24:20 +0200 Subject: Class[] -> Class[] requirement replaced by an anchor --- manifests/client.pp | 38 ++++++++++++++++++++++++++++++++------ manifests/plugins/setup.pp | 5 ++--- 2 files changed, 34 insertions(+), 9 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 4d70cac..c33ec0d 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -12,13 +12,39 @@ class munin::client( $shorewall_collector_source = 'net', $export_tag = 'munin' ) { + anchor { 'munin::client::installed': } + 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 } + openbsd: { + class { 'munin::client::openbsd': + before => Anchor['munin::client::installed'] + } + } + darwin: { + class { 'munin::client::darwin': + before => Anchor['munin::client::installed'] + } + } + debian,ubuntu: { + class { 'munin::client::debian': + before => Anchor['munin::client::installed'] + } + } + gentoo: { + class { 'munin::client::gentoo': + before => Anchor['munin::client::installed'] + } + } + centos: { + class { 'munin::client::package': + before => Anchor['munin::client::installed'] + } + } + default: { + class { 'munin::client::base': + before => Anchor['munin::client::installed'] + } + } } if $munin::client::manage_shorewall { class{'shorewall::rules::munin': diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index e0826f0..e1a57d9 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,12 +1,10 @@ # Set up the munin plugins for a node class munin::plugins::setup { - # This is required for the munin-node service and package requirements below. - Class['munin::client'] -> Class['munin::plugins::setup'] - file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: ensure => directory, + require => Anchor['munin::client::installed'], ignore => 'snmp_*', checksum => mtime, recurse => true, @@ -18,6 +16,7 @@ class munin::plugins::setup { mode => '0755'; '/etc/munin/plugin-conf.d/munin-node': ensure => present, + require => Anchor['munin::client::installed'], notify => Service['munin-node'], owner => root, group => 0, -- cgit v1.2.3 From 6856c8bb3f11073a47ab705d0e2012a0c90acae3 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:18:40 +0100 Subject: some doc --- manifests/client.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index c33ec0d..f91436f 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,8 +1,8 @@ -# client.pp - configure a munin node # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. # Adapted and improved by admin(at)immerda.ch +# configure a munin node class munin::client( $allow = [ '127.0.0.1' ], $host = '*', -- cgit v1.2.3 From d2a2cb77b9a9ca5deddecdec3d14ac763388929e Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:46:46 +0100 Subject: cleanup openbsd manual installation + remove unnecessary files The manual OpenBSD installation is now so old and not needed anymore. --- manifests/client.pp | 2 +- manifests/client/base.pp | 15 +++++++++++---- manifests/client/centos.pp | 4 ---- manifests/client/debian.pp | 13 ++++++++++--- manifests/client/gentoo.pp | 2 +- manifests/client/openbsd.pp | 40 +++------------------------------------- manifests/client/package.pp | 13 ------------- manifests/plugins/centos.pp | 6 ------ 8 files changed, 26 insertions(+), 69 deletions(-) delete mode 100644 manifests/client/centos.pp delete mode 100644 manifests/client/package.pp delete mode 100644 manifests/plugins/centos.pp (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index f91436f..b7cd5d4 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -36,7 +36,7 @@ class munin::client( } } centos: { - class { 'munin::client::package': + class { 'munin::client::base': before => Anchor['munin::client::installed'] } } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 3c0ba89..e81028d 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,10 +1,14 @@ # Install a basic munin client class munin::client::base { + package { 'munin-node': + ensure => installed + } service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => Package[munin-node], } file {'/etc/munin': ensure => directory, @@ -14,6 +18,9 @@ class munin::client::base { } file {'/etc/munin/munin-node.conf': content => template("munin/munin-node.conf.${::operatingsystem}"), + # this has to be installed before the package, so the postinst can + # boot the munin-node without failure! + before => Package['munin-node'], notify => Service['munin-node'], mode => '0644', owner => root, diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp deleted file mode 100644 index cd4f2f6..0000000 --- a/manifests/client/centos.pp +++ /dev/null @@ -1,4 +0,0 @@ -# Install a munin client on centos -class munin::client::centos inherits munin::client::package { - include munin::plugins::centos -} diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 3cfc3fc..f94356a 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,11 +1,18 @@ # Install the munin client on debian -class munin::client::debian inherits munin::client::package { +class munin::client::debian inherits munin::client::base { # the plugin will need that - package { 'iproute': ensure => installed } + package { 'iproute': + ensure => installed + } + + $hasstatus = $::lsbdistcodename ? { + sarge => false, + default => true + } Service['munin-node']{ # sarge's munin-node init script has no status - hasstatus => $::lsbdistcodename ? { sarge => false, default => true } + hasstatus => $hasstatus } 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 186950b..fde592f 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,5 +1,5 @@ # install a munin client on gentoo -class munin::client::gentoo inherits munin::client::package { +class munin::client::gentoo inherits munin::client::base { Package['munin-node'] { name => 'munin', diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index e3c18d5..5ced4c4 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,53 +1,19 @@ -# currently we install munin on openbsd by targz -# :( - +# generate a few missing things on openbsd 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, - } - } - 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'; } - $bin_loc = $::operatingsystemrelease ? { - '4.3' => '/opt/munin/sbin/munin-node', - default => '/usr/local/sbin/munin-node' - } openbsd::rc_local{'munin-node': - binary => $bin_loc, + binary => '/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 => $bin_loc, + start => '/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, diff --git a/manifests/client/package.pp b/manifests/client/package.pp deleted file mode 100644 index 0958202..0000000 --- a/manifests/client/package.pp +++ /dev/null @@ -1,13 +0,0 @@ -# Install a munin client using packages -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'], - } -} - diff --git a/manifests/plugins/centos.pp b/manifests/plugins/centos.pp deleted file mode 100644 index 0bb7697..0000000 --- a/manifests/plugins/centos.pp +++ /dev/null @@ -1,6 +0,0 @@ -# Install munin plugins for centos -class munin::plugins::centos inherits munin::plugins::base { - munin::plugin { 'users': - ensure => present, - } -} -- cgit v1.2.3 From 03c50709169ee38cd5d759c461389b2a476fcc64 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:52:36 +0100 Subject: use rather the stdlib prefix function than the good old regsubst hack --- manifests/plugins/interfaces.pp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index b92802b..b795bc0 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,15 +1,16 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces { + # filter out many of the useless interfaces that show up + $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') + + $ifs = prefix($real_ifs, 'if_') + $if_err_plugin = $::operatingsystem ? { 'openbsd' => 'if_errcoll_', default => 'if_err_', } - - # filter out many of the useless interfaces that show up - $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') - $ifs = regsubst($real_ifs, '(.+)', 'if_\1') - $if_errs = regsubst($real_ifs, '(.+)', "${if_err_plugin}\1") + $if_errs = prefix($real_ifs, $if_err_plugin) munin::plugin { $ifs: ensure => 'if_', -- cgit v1.2.3 From ad37140f6123c0e85cfbeb23dee5b3ea3c324701 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:55:54 +0100 Subject: remove anchor dependency - fixed #26 given that all os are using package installation now, we can replace the anchor with the package dependency. It also caused a dependency cycle as the anchor was for the whole class and not only the package installation. --- manifests/client.pp | 37 ++++++------------------------------- manifests/plugins/setup.pp | 4 ++-- 2 files changed, 8 insertions(+), 33 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index b7cd5d4..2d4c82b 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -12,39 +12,14 @@ class munin::client( $shorewall_collector_source = 'net', $export_tag = 'munin' ) { - anchor { 'munin::client::installed': } case $::operatingsystem { - openbsd: { - class { 'munin::client::openbsd': - before => Anchor['munin::client::installed'] - } - } - darwin: { - class { 'munin::client::darwin': - before => Anchor['munin::client::installed'] - } - } - debian,ubuntu: { - class { 'munin::client::debian': - before => Anchor['munin::client::installed'] - } - } - gentoo: { - class { 'munin::client::gentoo': - before => Anchor['munin::client::installed'] - } - } - centos: { - class { 'munin::client::base': - before => Anchor['munin::client::installed'] - } - } - default: { - class { 'munin::client::base': - before => Anchor['munin::client::installed'] - } - } + 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::base } + default: { include munin::client::base } } if $munin::client::manage_shorewall { class{'shorewall::rules::munin': diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index e1a57d9..23222ec 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -4,7 +4,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: ensure => directory, - require => Anchor['munin::client::installed'], + require => Package['munin-node'], ignore => 'snmp_*', checksum => mtime, recurse => true, @@ -16,7 +16,7 @@ class munin::plugins::setup { mode => '0755'; '/etc/munin/plugin-conf.d/munin-node': ensure => present, - require => Anchor['munin::client::installed'], + require => Package['munin-node'], notify => Service['munin-node'], owner => root, group => 0, -- cgit v1.2.3 From 3064a5d5a6251f84cf4d115be1711266faf7ed13 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 18:21:57 +0100 Subject: fix #26 - do not manage files of a plugin if it should be absent The directories are recursively managed and will purge these files anyway and trigger a proper restart. Like that we can safe a few resources in our catalog. --- manifests/plugin.pp | 74 +++++++++++++++++------------------------ manifests/plugin/scriptpaths.pp | 5 +-- 2 files changed, 32 insertions(+), 47 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 60af877..ef82f90 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -1,55 +1,43 @@ # configure a specific munin plugin +# +# We only manage the plugin if it is not set to absent. +# A plugin (or its config) that should be removed should +# be purged by the recursively managed plugins- or +# config-directory. So we can safe a few resources being +# managed. 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" + if $ensure != 'absent' { + include munin::plugin::scriptpaths + include munin::plugins::setup + $real_script_path = $script_path_in ? { + '' => $munin::plugin::scriptpaths::script_path, + default => $script_path_in + } + $plugin_src = $ensure ? { + 'present' => $name, + default => $ensure + } - include munin::plugins::setup - case $ensure { - 'absent': { - file { $plugin: ensure => absent, } + file { "/etc/munin/plugins/${name}": + ensure => link, + target =>"${real_script_path}/${plugin_src}", + notify => Service['munin-node']; } - default: { - $dep = $::kernel ? { - OpenBSD => File['/var/run/munin'], - default => Package['munin-node'] - } - file { $plugin: - ensure => "${real_script_path}/${plugin_src}", - require => $dep, - notify => Service['munin-node']; + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + File["/etc/munin/plugins/${name}"]{ + seltype => 'munin_etc_t', } - if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ - File[$plugin]{ - seltype => 'munin_etc_t', - } - } - } - } - 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", - owner => root, - group => 0, - mode => '0640', - } - } + if $config != '' { + file { "/etc/munin/plugin-conf.d/${name}.conf": + content => "[${name}]\n${config}\n", + owner => root, + group => 0, + mode => '0640', } } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index f31f38d..62dd77b 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -4,10 +4,7 @@ class munin::plugin::scriptpaths { 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/', - } } + openbsd: { $script_path = '/usr/local/libexec/munin/plugins/' } default: { $script_path = '/usr/share/munin/plugins' } } } -- cgit v1.2.3 From d92912ba27c1234e6f6072a3b922beabbd28dd98 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 18:28:30 +0100 Subject: remove unnecessary dependencies --- manifests/plugins/setup.pp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'manifests') diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index 23222ec..a3f3b22 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -16,22 +16,9 @@ class munin::plugins::setup { mode => '0755'; '/etc/munin/plugin-conf.d/munin-node': ensure => present, - require => Package['munin-node'], notify => Service['munin-node'], owner => root, group => 0, mode => '0640'; } - 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'], - } - } - } } -- cgit v1.2.3 From a161f0cd19a4e099bc8bb4bb3e01898c9c5f2ee7 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 18:43:23 +0100 Subject: add a few more intelligent plugins for linux hosts --- manifests/plugins/linux.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index 57f2bba..354d23c 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,7 +1,8 @@ # Set up plugins for a linux host class munin::plugins::linux { munin::plugin { - [ 'df_abs', 'forks', 'df_inode', 'irqstats', 'entropy', 'open_inodes' ]: + [ 'df_abs', 'forks', 'df_inode', 'irqstats', 'entropy', 'open_inodes', + 'diskstats', 'proc_pri', 'threads', ]: ensure => present; 'acpi': ensure => $::acpi_available; -- cgit v1.2.3 From 161e5cb4722ec22dff7f367fcf5460364e598497 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Mon, 18 Nov 2013 22:27:46 +0100 Subject: use rather ensure_packages --- manifests/client/debian.pp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index f94356a..63a0e14 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,9 +1,7 @@ # Install the munin client on debian class munin::client::debian inherits munin::client::base { # the plugin will need that - package { 'iproute': - ensure => installed - } + ensure_packages(['iproute']) $hasstatus = $::lsbdistcodename ? { sarge => false, -- cgit v1.2.3 From 057658ba93e2562c596dfa5607836679631be916 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 22:49:02 +0200 Subject: Unify OS specific munin-conf.conf In essence all munin-node.conf files contained the same template, besides a few values. By moving all to a single template, maintenance burden is reduced. To ensure all values are still present in the templates, tests are added. --- manifests/client/base.pp | 4 ++-- manifests/client/debian.pp | 3 --- manifests/client/params.pp | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 manifests/client/params.pp (limited to 'manifests') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index e81028d..71531fa 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,5 +1,5 @@ # Install a basic munin client -class munin::client::base { +class munin::client::base inherits munin::client::params { package { 'munin-node': ensure => installed } @@ -17,7 +17,7 @@ class munin::client::base { group => 0, } file {'/etc/munin/munin-node.conf': - content => template("munin/munin-node.conf.${::operatingsystem}"), + content => template("${module_name}/munin-node.conf.erb"), # this has to be installed before the package, so the postinst can # boot the munin-node without failure! before => Package['munin-node'], diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 63a0e14..f1bbb3c 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -12,9 +12,6 @@ class munin::client::debian inherits munin::client::base { # sarge's munin-node init script has no status hasstatus => $hasstatus } - 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 diff --git a/manifests/client/params.pp b/manifests/client/params.pp new file mode 100644 index 0000000..14d3749 --- /dev/null +++ b/manifests/client/params.pp @@ -0,0 +1,19 @@ +# Set the parameters for the munin client +class munin::client::params { + $user = 'root' + + case $::operatingsystem { + 'OpenBSD': { + $group = '0' + $log_file = '/var/log/munin-node/munin-node.log' + } + 'Debian': { + $group = 'root' + $log_file = '/var/log/munin/munin-node.log' + } + default: { + $group = 'root' + $log_file = '/var/log/munin-node/munin-node.log' + } + } +} -- cgit v1.2.3 From 9bee8a31f2305dda884aeab3caf3bf91cd8603ba Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 23:07:00 +0200 Subject: Unify logrotate files into templates --- manifests/host/cgi.pp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'manifests') diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 5b0ecbb..9951a48 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -30,13 +30,9 @@ class munin::host::cgi( } 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', + content => template("${module_name}/logrotate.conf.erb"), + owner => root, + group => 0, + mode => '0644', } } -- cgit v1.2.3 From 99e32a12d401828e71c13309bf21460086f77e0e Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 29 Jan 2014 23:32:52 +0100 Subject: unify logdir --- manifests/client/openbsd.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 5ced4c4..64ea588 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,6 +1,6 @@ # generate a few missing things on openbsd class munin::client::openbsd inherits munin::client::base { - file{[ '/var/run/munin', '/var/log/munin' ]: + file{[ '/var/run/munin', '/var/log/munin-node' ]: ensure => directory, owner => root, group => 0, @@ -17,10 +17,10 @@ class munin::client::openbsd inherits munin::client::base { 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'] ], + require => [ File['/var/run/munin'], File['/var/log/munin-munin'] ], } cron{'clean_munin_logfile': - command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', + command => 'rm /var/log/munin-node/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', minute => 0, hour => 2, weekday => 0, -- cgit v1.2.3 From 0ebbe54879941e886dc1519b7dfdc69f614975ad Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 29 Jan 2014 23:37:11 +0100 Subject: correct dependency --- manifests/client/openbsd.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 64ea588..09fb24f 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -17,7 +17,7 @@ class munin::client::openbsd inherits munin::client::base { 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-munin'] ], + require => [ File['/var/run/munin'], File['/var/log/munin-node'] ], } cron{'clean_munin_logfile': command => 'rm /var/log/munin-node/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', -- cgit v1.2.3 From 695d81c81cd152b5dd7333d0eae2bd6df108a41e Mon Sep 17 00:00:00 2001 From: Arjen Heidinga Date: Fri, 31 Jan 2014 09:52:10 +0100 Subject: Add support for setting the descryption and group support --- manifests/client.pp | 14 ++++++++------ manifests/client/base.pp | 12 +++++++----- manifests/client/params.pp | 2 +- manifests/register.pp | 3 ++- 4 files changed, 18 insertions(+), 13 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 2d4c82b..6614709 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -4,13 +4,15 @@ # configure a munin node class munin::client( - $allow = [ '127.0.0.1' ], - $host = '*', - $port = '4949', - $use_ssh = false, - $manage_shorewall = false, + $allow = [ '127.0.0.1' ], + $host = '*', + $port = '4949', + $use_ssh = false, + $manage_shorewall = false, $shorewall_collector_source = 'net', - $export_tag = 'munin' + $export_tag = 'munin', + $description = 'absent', + $munin_group = 'absent', ) { case $::operatingsystem { diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 71531fa..d35d742 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -31,11 +31,13 @@ class munin::client::base inherits munin::client::params { default => $munin::client::host } munin::register { $::fqdn: - host => $host, - port => $munin::client::port, - use_ssh => $munin::client::use_ssh, - config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], - export_tag => $munin::client::export_tag, + host => $host, + port => $munin::client::port, + use_ssh => $munin::client::use_ssh, + description => $munin::client::description, + group => $munin::client::munin_group, + config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + export_tag => $munin::client::export_tag, } include munin::plugins::base } diff --git a/manifests/client/params.pp b/manifests/client/params.pp index 14d3749..4473912 100644 --- a/manifests/client/params.pp +++ b/manifests/client/params.pp @@ -2,7 +2,7 @@ class munin::client::params { $user = 'root' - case $::operatingsystem { + case $::osfamily { 'OpenBSD': { $group = '0' $log_file = '/var/log/munin-node/munin-node.log' diff --git a/manifests/register.pp b/manifests/register.pp index 1f6d787..f0567d7 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -5,7 +5,8 @@ define munin::register ( $use_ssh = false, $description = 'absent', $config = [], - $export_tag = 'munin' + $export_tag = 'munin', + $group ='absent', ) { $fhost = $name -- cgit v1.2.3 From b5cc9427aeca48689913b7462e58dd905c4a788b Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 3 Feb 2014 14:57:03 +0100 Subject: cleanup some of the missing parts --- manifests/register.pp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'manifests') diff --git a/manifests/register.pp b/manifests/register.pp index f0567d7..8c1ec61 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,12 +1,12 @@ # Register a munin client define munin::register ( - $host = $::fqdn, - $port = '4949', - $use_ssh = false, - $description = 'absent', - $config = [], - $export_tag = 'munin', - $group ='absent', + $host = $::fqdn, + $port = '4949', + $use_ssh = false, + $description = 'absent', + $config = [], + $export_tag = 'munin', + $group = 'absent', ) { $fhost = $name -- cgit v1.2.3 From 47c5d323099b341a785b44f9d05ff0b535ce12e6 Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Fri, 14 Feb 2014 16:08:40 +0100 Subject: Allow to deploy a plugin without registering it --- manifests/plugin/deploy.pp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index c514eed..2cee966 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -3,7 +3,8 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', $config = '', - $seltype = 'munin_exec_t' + $seltype = 'munin_exec_t', + $register = true, ) { $plugin_src = $ensure ? { 'present' => $name, @@ -36,9 +37,12 @@ define munin::plugin::deploy( File["munin_plugin_${name}"]{ require => $basic_require, } - # register the plugin - munin::plugin{$name: - ensure => $ensure, - config => $config + + # register the plugin if required + if ($register) { + munin::plugin{$name: + ensure => $ensure, + config => $config + } } } -- cgit v1.2.3 From d09774c635ea72932727d6724ee847942ddafb77 Mon Sep 17 00:00:00 2001 From: antonio Date: Wed, 9 Apr 2014 15:45:37 +0200 Subject: Configurable host_name variable --- manifests/client.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 6614709..7a96233 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -6,6 +6,7 @@ class munin::client( $allow = [ '127.0.0.1' ], $host = '*', + $host_name = '::fqdn', $port = '4949', $use_ssh = false, $manage_shorewall = false, -- cgit v1.2.3 From bab6dff342ef3288f647edf3bc59580a1fdcc8c4 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Apr 2014 14:04:32 +0200 Subject: the default selinux type should be unconfined --- manifests/plugin/deploy.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 2cee966..6a8d052 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -3,7 +3,7 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', $config = '', - $seltype = 'munin_exec_t', + $seltype = 'munin_unconfined_exec_t', $register = true, ) { $plugin_src = $ensure ? { @@ -24,7 +24,7 @@ define munin::plugin::deploy( mode => '0755'; } - if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease > '5')){ File["munin_plugin_${name}"]{ seltype => $seltype, } -- cgit v1.2.3 From 0bbf3ce96c049cdcbc59dfdcef860f09d515f618 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Apr 2014 17:11:58 +0200 Subject: correct seltype --- manifests/plugin/deploy.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 6a8d052..461a218 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -3,7 +3,7 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', $config = '', - $seltype = 'munin_unconfined_exec_t', + $seltype = 'munin_unconfined_plugin_exec_t', $register = true, ) { $plugin_src = $ensure ? { -- cgit v1.2.3 From 29919e02a8b3f27d9d516be586e92704b806a48e Mon Sep 17 00:00:00 2001 From: antonio Date: Thu, 12 Jun 2014 00:41:18 +0200 Subject: changed host_name default to ::fqdn --- manifests/client.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 7a96233..724ff05 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -6,7 +6,7 @@ class munin::client( $allow = [ '127.0.0.1' ], $host = '*', - $host_name = '::fqdn', + $host_name = $::fqdn, $port = '4949', $use_ssh = false, $manage_shorewall = false, -- cgit v1.2.3 From 88d197da8cedd5d711db043995f725ebe66b6ed6 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 12:25:48 +0200 Subject: implement #38 - allow config to be an array --- manifests/plugin.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index ef82f90..37d0077 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -32,9 +32,9 @@ define munin::plugin ( seltype => 'munin_etc_t', } } - if $config != '' { + if !empty($config) { file { "/etc/munin/plugin-conf.d/${name}.conf": - content => "[${name}]\n${config}\n", + content => inline_template("[<%= @name %>]\n<%= Array(@config).join(\"\n\") %>\n"), owner => root, group => 0, mode => '0640', -- cgit v1.2.3 From 3cf822dfee3e56e2461c2a5d96dca448c008cd34 Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Sat, 28 Jun 2014 12:02:08 +0200 Subject: Rename the package to avoid naming conflicts --- manifests/client/gentoo.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index fde592f..263fecd 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -2,8 +2,7 @@ class munin::client::gentoo inherits munin::client::base { Package['munin-node'] { - name => 'munin', - category => 'net-analyzer', + name => 'net-analyzer/munin', } include munin::plugins::gentoo -- cgit v1.2.3 From 39eb7ac31ad7f1fc16c37c42823fb1860c1f09ba Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 9 Jul 2014 23:12:27 +0200 Subject: get rid off lsb facts - who runs sarge? --- manifests/client/debian.pp | 9 --------- manifests/host.pp | 4 ++-- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) (limited to 'manifests') diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index f1bbb3c..49ee567 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -3,15 +3,6 @@ class munin::client::debian inherits munin::client::base { # the plugin will need that ensure_packages(['iproute']) - $hasstatus = $::lsbdistcodename ? { - sarge => false, - default => true - } - - Service['munin-node']{ - # sarge's munin-node init script has no status - hasstatus => $hasstatus - } # workaround bug in munin_node_configure plugin { 'postfix_mailvolume': ensure => absent } include munin::plugins::debian diff --git a/manifests/host.pp b/manifests/host.pp index e666c3d..55e28bf 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -15,10 +15,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}.${::operatingsystemmajrelease}", "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}.${::operatingsystemmajrelease}", "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}", 'puppet:///modules/munin/config/host/munin.conf.header' ], order => 05, diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 37d0077..50b861b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -27,7 +27,7 @@ define munin::plugin ( target =>"${real_script_path}/${plugin_src}", notify => Service['munin-node']; } - if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::operatingsystemmajrelease != '5')){ File["/etc/munin/plugins/${name}"]{ seltype => 'munin_etc_t', } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 461a218..2ffd92e 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -24,7 +24,7 @@ define munin::plugin::deploy( mode => '0755'; } - if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease > '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::operatingsystemmajrelease > '5')){ File["munin_plugin_${name}"]{ seltype => $seltype, } -- cgit v1.2.3 From 37fef292f1c61cb5ca20b60d625310f3150175b0 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:18:04 +0200 Subject: Bump concat dependency to get rid of deprecation warning when including concat::setup --- manifests/host.pp | 1 - 1 file changed, 1 deletion(-) (limited to 'manifests') diff --git a/manifests/host.pp b/manifests/host.pp index e666c3d..70d7116 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -8,7 +8,6 @@ class munin::host( $export_tag = 'munin' ) { package {'munin': ensure => installed, } - include concat::setup Concat::Fragment <<| tag == $export_tag |>> -- cgit v1.2.3 From 77bc6cefe5a4781cb9b7eae13d607348d3352cdd Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:31:26 +0200 Subject: Fix an error on system without full UTF-8: invalid byte sequence in US-ASCII --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index b015521..54b489b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,7 +4,7 @@ # Copyright (C) 2007 David Schmitt # # Copyright 2008, Puzzle ITC GmbH -# Marcel Härry haerry+puppet(at)puzzle.ch +# Marcel Haerry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # # This program is free software; you can redistribute -- cgit v1.2.3 From 145f35c188b088890049557be6f203272f0d266c Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:34:21 +0200 Subject: Unbreak registring snmp hosts; Exec{} needs a path --- manifests/register/snmp.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 06bb00b..1c375ec 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -12,6 +12,7 @@ define munin::register::snmp ( exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + path => ['/bin','/sbin','/usr/bin','/usr/sbin','/usr/local/bin','/usr/local/sbin'], } @@concat::fragment{ "munin_snmp_${fhost}": -- cgit v1.2.3 From 68e5a30c917a9275868e609fe986e6424ab1c1eb Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:35:18 +0200 Subject: Unbreak registering new snmp nodes into munin.conf As $group would be undefined, a ';' would be written into the host definition which in turn causes munin to be unable to parse the file. --- manifests/register/snmp.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 1c375ec..5fab221 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -3,7 +3,8 @@ define munin::register::snmp ( $community = 'public', $description = 'absent', $port = '4949', - $host = $::fqdn + $host = $::fqdn, + $group = 'absent', ) { $fhost = $name $client_type = 'snmp' -- cgit v1.2.3 From 5d5a542c58fc6218af6d210cf9f454da54622d1e Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:38:14 +0200 Subject: spacing --- manifests/register/snmp.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 5fab221..f84785a 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,10 +1,10 @@ # Register a munin node with snmp enabled define munin::register::snmp ( - $community = 'public', + $community = 'public', $description = 'absent', - $port = '4949', - $host = $::fqdn, - $group = 'absent', + $port = '4949', + $host = $::fqdn, + $group = 'absent', ) { $fhost = $name $client_type = 'snmp' -- cgit v1.2.3 From c39907a4b3acb1413a290b78b3dd3b49b898e210 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:40:45 +0200 Subject: Use cron resource instead of a cron.d file --- manifests/host.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/host.pp b/manifests/host.pp index e666c3d..f231691 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -39,12 +39,12 @@ class munin::host( } # from time to time we cleanup hanging munin-runs - file{'/etc/cron.d/munin_kill': - 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', + cron { 'munin_kill': + command => 'if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi', + minute => ['4', '34'], + user => 'root', } + if $munin::host::manage_shorewall { include shorewall::rules::out::munin } -- cgit v1.2.3 From 043502d650e76ea604ef4f2e23ce2f0112f5706f Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 22:42:47 +0200 Subject: Allow setting an snmpversion for plugin discovery --- manifests/register/snmp.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index f84785a..d3761ae 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -5,13 +5,14 @@ define munin::register::snmp ( $port = '4949', $host = $::fqdn, $group = 'absent', + $version = '2', ) { $fhost = $name $client_type = 'snmp' $config = [ 'use_node_name no' ] exec { "munin_register_snmp_${fhost}": - command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --snmpversion ${version} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", path => ['/bin','/sbin','/usr/bin','/usr/sbin','/usr/local/bin','/usr/local/sbin'], } -- cgit v1.2.3 From 3b113bd7f8be9f766f5a15933ff5574f6b124163 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 13 Sep 2014 05:17:52 +0200 Subject: Revert "Unbreak registring snmp hosts; Exec{} needs a path" http://www.puppetcookbook.com/posts/set-global-exec-path.html This reverts commit 145f35c188b088890049557be6f203272f0d266c. --- manifests/register/snmp.pp | 1 - 1 file changed, 1 deletion(-) (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index d3761ae..8d7ea56 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -14,7 +14,6 @@ define munin::register::snmp ( exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --snmpversion ${version} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", - path => ['/bin','/sbin','/usr/bin','/usr/sbin','/usr/local/bin','/usr/local/sbin'], } @@concat::fragment{ "munin_snmp_${fhost}": -- cgit v1.2.3 From 27c9a5dbc2083dcc20d059008702dd3f75382bcc Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Oct 2014 11:54:10 +0200 Subject: more linting and latest puppet-lint support --- manifests/client/base.pp | 13 +++++++------ manifests/remoteplugin.pp | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'manifests') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index d35d742..6ed0f71 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -4,11 +4,11 @@ class munin::client::base inherits munin::client::params { ensure => installed } service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, - require => Package[munin-node], + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => Package[munin-node], } file {'/etc/munin': ensure => directory, @@ -36,7 +36,8 @@ class munin::client::base inherits munin::client::params { use_ssh => $munin::client::use_ssh, description => $munin::client::description, group => $munin::client::munin_group, - config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + config => [ 'use_node_name yes', 'load.load.warning 5', + 'load.load.critical 10'], export_tag => $munin::client::export_tag, } include munin::plugins::base diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp index a2abf69..dc03c76 100644 --- a/manifests/remoteplugin.pp +++ b/manifests/remoteplugin.pp @@ -1,5 +1,9 @@ # Configure a munin remote plugin -define munin::remoteplugin($ensure = 'present', $source, $config = '') { +define munin::remoteplugin( + $source, + $ensure = 'present', + $config = '' +) { case $ensure { 'absent': { munin::plugin{ $name: ensure => absent } } default: { -- cgit v1.2.3