From f34ff5e44d61edef9c7a5e243c623b4524012121 Mon Sep 17 00:00:00 2001 From: Simon Josi Date: Wed, 27 Jan 2010 17:07:42 +0100 Subject: upgrade to 0.25 --- manifests/plugins/interfaces.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 99b85ba..0062678 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,19 +1,19 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces inherits munin::plugins::base { - $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") + $ifs = regsubst(split($interfaces, " |,"), "(.+)", "if_\\1") munin::plugin { $ifs: ensure => "if_"; } case $operatingsystem { openbsd: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") + $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") munin::plugin{ $if_errs: ensure => "if_errcoll_"; } } default: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1") + $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_err_\\1") munin::plugin{ $if_errs: ensure => "if_err_"; } -- cgit v1.2.3 From 87b7e02eaa1ee305d1ea2192873446ba479546b5 Mon Sep 17 00:00:00 2001 From: Matthias Imsand Date: Tue, 2 Feb 2010 11:29:09 +0100 Subject: replaced legace gsub method --- manifests/plugins/interfaces.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 0062678..35ef648 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,6 +1,7 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces inherits munin::plugins::base { + # replaced gsub with regsubst $ifs = regsubst(split($interfaces, " |,"), "(.+)", "if_\\1") munin::plugin { $ifs: ensure => "if_"; -- cgit v1.2.3 From 286859e3957f1c64ec583d274903b1ca2a47ea67 Mon Sep 17 00:00:00 2001 From: Simon Josi Date: Thu, 4 Feb 2010 11:04:13 +0100 Subject: syntax --- manifests/plugin.pp | 2 -- 1 file changed, 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 1fa4651..e688a39 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -3,8 +3,6 @@ # See LICENSE for the full license granted to you. # adapted and improved by admin(at)immerda.ch -### defines - define munin::plugin ( $ensure = "present", $script_path_in = '', -- cgit v1.2.3 From 015b7262e4b0bedad9500e982350197160a4ad1d Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Tue, 21 Sep 2010 17:25:49 +0200 Subject: refactor module to the new standard --- manifests/client/openbsd.pp | 2 +- manifests/host.pp | 10 +++++----- manifests/host/cgi.pp | 10 +++++----- manifests/plugin/deploy.pp | 2 +- manifests/plugins/base.pp | 2 +- manifests/snmp_collector.pp | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'manifests') diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 17abdbf..4c2807c 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -2,7 +2,7 @@ # :( class munin::client::openbsd inherits munin::client::base { file{'/usr/src/munin_openbsd.tar.gz': - source => "puppet://$server/munin/openbsd/package/munin_openbsd.tar.gz", + source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz", owner => root, group => 0, mode => 0600; } package{ [ 'p5-Compress-Zlib', 'p5-Crypt-SSLeay', 'p5-HTML-Parser', diff --git a/manifests/host.pp b/manifests/host.pp index 9251516..734eea6 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -9,11 +9,11 @@ class munin::host File <<| tag == 'munin' |>> file{'/etc/munin/munin.conf.header': - source => [ "puppet://$server/files/munin/config/host/${fqdn}/munin.conf.header", - "puppet://$server/files/munin/config/host/munin.conf.header.$operatingsystem", - "puppet://$server/files/munin/config/host/munin.conf.header", - "puppet://$server/munin/config/host/munin.conf.header.$operatingsystem", - "puppet://$server/munin/config/host/munin.conf.header" ], + source => [ "puppet:///modules/site-munin/config/host/${fqdn}/munin.conf.header", + "puppet:///modules/site-munin/config/host/munin.conf.header.$operatingsystem", + "puppet:///modules/site-munin/config/host/munin.conf.header", + "puppet:///modules/munin/config/host/munin.conf.header.$operatingsystem", + "puppet:///modules/munin/config/host/munin.conf.header" ], notify => Exec['concat_/etc/munin/munin.conf'], owner => root, group => 0, mode => 0644; } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 7fdb281..6fd50df 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -6,11 +6,11 @@ class munin::host::cgi { } file{'/etc/logrotate.d/munin': - source => [ "puppet://$server/files/munin/config/host/${fqdn}/logrotate", - "puppet://$server/files/munin/config/host/logrotate.$operatingsystem", - "puppet://$server/files/munin/config/host/logrotate", - "puppet://$server/munin/config/host/logrotate.$operatingsystem", - "puppet://$server/munin/config/host/logrotate" ], + 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; } } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 47bf796..eb4e3da 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -11,7 +11,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { include munin::plugin::scriptpaths file { "munin_plugin_${name}": path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet://$server/$real_source", + source => "puppet:///$real_source", mode => 0755, owner => root, group => 0; } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 1bfed48..80a957e 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -1,7 +1,7 @@ class munin::plugins::base { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - source => "puppet://$server/common/empty", + source => "puppet:///modules/common/empty", ignore => [ '\.ignore', 'snmp_*' ], ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp index 53a860f..60fd573 100644 --- a/manifests/snmp_collector.pp +++ b/manifests/snmp_collector.pp @@ -1,7 +1,7 @@ class munin::snmp_collector{ file { "/var/lib/puppet/modules/munin/create_snmp_links": - source => "puppet://$server/munin/create_snmp_links.sh", + source => "puppet:///modules/munin/create_snmp_links.sh", mode => 755, owner => root, group => 0; } -- cgit v1.2.3 From 334b4a3ba627ddf481d68f8f29c925895470de62 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 12:10:02 +0200 Subject: use better snmp register define --- manifests/register/snmp.pp | 22 ++++++++++++++++++++++ manifests/register_snmp.pp | 21 --------------------- 2 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 manifests/register/snmp.pp delete mode 100644 manifests/register_snmp.pp (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp new file mode 100644 index 0000000..c0d9279 --- /dev/null +++ b/manifests/register/snmp.pp @@ -0,0 +1,22 @@ +define munin::register::snmp ( + $community = 'public', + $description = 'absent' +) +{ + $fhost = $name + $munin_host_real = $fqdn + $client_type = 'snmp' + $config = [ 'use_node_name no' ] + + exec { "munin_register_snmp_${fhost}": + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh", + unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + } + + @@file { "munin_snmp_${fhost}": + ensure => present, + path => "/var/lib/puppet/modules/munin/nodes/${fhost}", + content => template("munin/client.erb"), + tag => 'munin', + } +} diff --git a/manifests/register_snmp.pp b/manifests/register_snmp.pp deleted file mode 100644 index e74ba44..0000000 --- a/manifests/register_snmp.pp +++ /dev/null @@ -1,21 +0,0 @@ -# snmp_testplugin: the plugin we use to test if it's set -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', - } -} -- cgit v1.2.3 From e27e74f81274d35d3873c6b5b5fa8816138212ed Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 12:13:10 +0200 Subject: code style for darwin class --- manifests/client/darwin.pp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'manifests') diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index f6fc95f..4004f74 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,21 +1,21 @@ 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: } } -- cgit v1.2.3 From 88fec38166f51bf8edabba6769a198016b799f1e Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 12:19:21 +0200 Subject: update templates to the new way --- manifests/register.pp | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'manifests') diff --git a/manifests/register.pp b/manifests/register.pp index e1271e1..21f1d35 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,17 +1,34 @@ -define munin::register() +define munin::register ( + $host = 'absent', + $port = 'absent', + $description = 'absent', + $config = [] +) { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => $fqdn, - 'fqdn' => $fqdn, - default => $munin_host - } + $fhost = $name + $client_type = 'client' - @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": - ensure => present, - content => template("munin/defaultclient.erb"), - tag => 'munin', - } -} + $munin_port_real = $port ? { + 'absent' => $munin_port ? { + '' => 4949, + default => $munin_port + }, + default => $port + } + $munin_host_real = $host ? { + 'absent' => $munin_host ? { + '' => $fqdn, + 'fqdn' => $fqdn, + default => $munin_host + }, + default => $host + } + @@file { "munin_client_${fhost}_${munin_port_real}": + ensure => present, + path => "/var/lib/puppet/modules/munin/nodes/${fhost}_${munin_port_real}", + content => template("munin/client.erb"), + tag => 'munin', + } +} -- cgit v1.2.3 From f3acecb57d7fde7760f2b74506589b9f4565947a Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 12:30:08 +0200 Subject: use shell so we can actually pipe that command --- manifests/register/snmp.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index c0d9279..0c3ac5c 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -9,7 +9,7 @@ define munin::register::snmp ( $config = [ 'use_node_name no' ] exec { "munin_register_snmp_${fhost}": - command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh", + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", } -- cgit v1.2.3 From 25e557a7b67b9836ead75b70e6415d8e3f925cfc Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 15:48:13 +0200 Subject: now we use the new modules path everywhere --- 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 eb4e3da..67cbfb8 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -11,7 +11,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { include munin::plugin::scriptpaths file { "munin_plugin_${name}": path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet:///$real_source", + source => "puppet:///modules/$real_source", mode => 0755, owner => root, group => 0; } -- cgit v1.2.3 From 7a13b36953cc4e359a37c0e7fa80a6ee3b452766 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 31 May 2011 19:30:04 +0200 Subject: no need to manage logfiles, this should be done by the package --- manifests/host.pp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'manifests') diff --git a/manifests/host.pp b/manifests/host.pp index e038fd7..69cc7da 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -23,12 +23,6 @@ class munin::host inherits munin header => "/etc/munin/munin.conf.header", } - file { ["/var/log/munin-update.log", "/var/log/munin-limits.log", - "/var/log/munin-graph.log", "/var/log/munin-html.log"]: - ensure => present, - mode => 640, owner => munin, group => 0; - } - include munin::plugins::muninhost case $operatingsystem { -- cgit v1.2.3 From c88a6c4879e13b95e4fff00ec956557dd5be5689 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 31 May 2011 19:39:20 +0200 Subject: make cgi graphing optional --- manifests/host.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/host.pp b/manifests/host.pp index 69cc7da..3e4f5ea 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -25,8 +25,8 @@ class munin::host inherits munin include munin::plugins::muninhost - case $operatingsystem { - centos: { include munin::host::cgi } + if $munin_do_cgi_graphing { + include munin::host::cgi } # from time to time we cleanup hanging munin-runs -- cgit v1.2.3 From 5049ee5adee3642bf1ccae40ade1c79e6e301832 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 15 Jul 2011 17:40:31 +0200 Subject: it is not anymore necessary to add an empty source to purge directories --- manifests/plugins/setup.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index c2c5ed3..c88f9e0 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,8 +1,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - source => "puppet:///modules/common/empty", - ignore => [ '.ignore', 'snmp_*' ], + ignore => 'snmp_*', ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0, -- cgit v1.2.3 From eb953716cd545f86972e85d983b5862c194f5aed Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 22 Jul 2011 13:04:38 +0200 Subject: fix typo --- manifests/plugins/apache.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp index b3e7634..dca3cea 100644 --- a/manifests/plugins/apache.pp +++ b/manifests/plugins/apache.pp @@ -1,4 +1,4 @@ class munin::plugins::apache { - munin::plugin{ [ 'apache_accesses', 'apache_processes',' apache_volume' ]: } - munin::plugin::deploy { "apache_activity": } + munin::plugin{ [ 'apache_accesses', 'apache_processes', 'apache_volume' ]: } + munin::plugin::deploy { 'apache_activity': } } -- cgit v1.2.3 From 9b0b698523987b7631478bcf7dc84acf5e0e719c Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Thu, 4 Aug 2011 10:48:57 +0200 Subject: move from concatenated_file to concat --- manifests/client.pp | 2 +- manifests/host.pp | 40 +++++++++++++++++++--------------------- manifests/init.pp | 5 ----- manifests/register.pp | 5 ++--- manifests/register/snmp.pp | 5 ++--- 5 files changed, 24 insertions(+), 33 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 273070d..141c916 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -3,7 +3,7 @@ # See LICENSE for the full license granted to you. # Adapted and improved by admin(at)immerda.ch -class munin::client inherits munin { +class munin::client { $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } $munin_host_real = $munin_host ? { diff --git a/manifests/host.pp b/manifests/host.pp index 3e4f5ea..107cd39 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -2,32 +2,30 @@ # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. -class munin::host inherits munin -{ - package {"munin": ensure => installed, } +class munin::host { + package {"munin": ensure => installed, } - File <<| tag == 'munin' |>> + Concat::Fragment <<| tag == 'munin' |>> - file{'/etc/munin/munin.conf.header': - source => [ "puppet:///modules/site-munin/config/host/${fqdn}/munin.conf.header", - "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", - "puppet:///modules/munin/config/host/munin.conf.header" ], - notify => Exec['concat_/etc/munin/munin.conf'], - owner => root, group => 0, mode => 0644; - } + 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", + "puppet:///modules/site-munin/config/host/munin.conf.header", + "puppet:///modules/munin/config/host/munin.conf.header.$operatingsystem", + "puppet:///modules/munin/config/host/munin.conf.header" ], + order => 05, + } - concatenated_file { "/etc/munin/munin.conf": - dir => '/var/lib/puppet/modules/munin/nodes', - header => "/etc/munin/munin.conf.header", - } + concat{ "/etc/munin/munin.conf": + owner => root, group => 0, mode => 0644; + } - include munin::plugins::muninhost + include munin::plugins::muninhost - if $munin_do_cgi_graphing { - include munin::host::cgi - } + if $munin_do_cgi_graphing { + include munin::host::cgi + } # from time to time we cleanup hanging munin-runs file{'/etc/cron.d/munin_kill': diff --git a/manifests/init.pp b/manifests/init.pp index bae83a4..b015521 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -14,8 +14,3 @@ # # the port is a parameter so vservers can share # IP addresses and still be happy - -class munin { - include common::moduledir - module_dir { [ "munin", "munin/nodes", "munin/plugins" ]: } -} diff --git a/manifests/register.pp b/manifests/register.pp index 21f1d35..78d13d3 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -25,9 +25,8 @@ define munin::register ( default => $host } - @@file { "munin_client_${fhost}_${munin_port_real}": - ensure => present, - path => "/var/lib/puppet/modules/munin/nodes/${fhost}_${munin_port_real}", + @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}": + target => '/etc/munin/munin.conf', content => template("munin/client.erb"), tag => 'munin', } diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 0c3ac5c..5a1f42d 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -13,9 +13,8 @@ define munin::register::snmp ( unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", } - @@file { "munin_snmp_${fhost}": - ensure => present, - path => "/var/lib/puppet/modules/munin/nodes/${fhost}", + @@concat::fragment{ "munin_snmp_${fhost}": + target => '/etc/munin/munin.conf', content => template("munin/client.erb"), tag => 'munin', } -- cgit v1.2.3 From 8e874720bf878a09a425d3323095202b1ca36846 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Thu, 4 Aug 2011 14:19:39 +0200 Subject: Also provide port for snmp nodes --- manifests/register/snmp.pp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 5a1f42d..c45adb0 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,6 +1,7 @@ define munin::register::snmp ( $community = 'public', - $description = 'absent' + $description = 'absent', + $port = 'absent' ) { $fhost = $name @@ -8,6 +9,14 @@ define munin::register::snmp ( $client_type = 'snmp' $config = [ 'use_node_name no' ] + $munin_port_real = $port ? { + 'absent' => $munin_port ? { + '' => 4949, + default => $munin_port + }, + default => $port + } + exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", -- cgit v1.2.3 From 33380e238f3ac37ac79f30485fdebbc5dd10170b Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 5 Aug 2011 10:59:04 +0200 Subject: use correct define --- manifests/client/darwin.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index 4004f74..92787ec 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -5,9 +5,10 @@ class munin::client::darwin { group => 0, owner => root, } - delete_matching_line{"startsnmpdno": + line{"startsnmpdno": file => "/etc/hostconfig", - pattern => "SNMPSERVER=-NO-", + line => "SNMPSERVER=-NO-", + ensure => 'absent', } line { "startsnmpdyes": file => "/etc/hostconfig", -- cgit v1.2.3 From 9b161f0c61bbd30960e663eceef8f1b35f633507 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 5 Nov 2011 14:14:32 +0100 Subject: use hiera to configure munin node specific things --- manifests/client.pp | 7 ------- manifests/client/base.pp | 8 +++----- manifests/register.pp | 10 ++++------ manifests/register/snmp.pp | 5 +---- 4 files changed, 8 insertions(+), 22 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 141c916..99480f1 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -5,13 +5,6 @@ class munin::client { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => '*', - 'fqdn' => '*', - default => $munin_host - } - case $operatingsystem { openbsd: { include munin::client::openbsd } darwin: { include munin::client::darwin } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 17387e8..6b4bef9 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,4 +1,6 @@ -class munin::client::base { +class munin::client::base( + $munin_allow = hiera('munin_allow','127.0.0.1') +) { service { 'munin-node': ensure => running, enable => true, @@ -9,10 +11,6 @@ class munin::client::base { 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': content => template("munin/munin-node.conf.$operatingsystem"), notify => Service['munin-node'], diff --git a/manifests/register.pp b/manifests/register.pp index 78d13d3..3c542ff 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -9,18 +9,16 @@ define munin::register ( $client_type = 'client' $munin_port_real = $port ? { - 'absent' => $munin_port ? { - '' => 4949, - default => $munin_port - }, + 'absent' => hiera('munin_port','4949'), default => $port } + $hiera_munin_host = hiera('munin_host','') $munin_host_real = $host ? { - 'absent' => $munin_host ? { + 'absent' => $hiera_munin_host ? { '' => $fqdn, 'fqdn' => $fqdn, - default => $munin_host + default => $hiera_munin_host }, default => $host } diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index c45adb0..a4d0d88 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -10,10 +10,7 @@ define munin::register::snmp ( $config = [ 'use_node_name no' ] $munin_port_real = $port ? { - 'absent' => $munin_port ? { - '' => 4949, - default => $munin_port - }, + 'absent' => hiera('munin_port','4949'), default => $port } -- cgit v1.2.3 From e2dfae5852ecdf3695a6af8ec48092ea24698390 Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Thu, 2 Feb 2012 18:10:14 -0800 Subject: Fully qualify facter variables --- manifests/client.pp | 2 +- manifests/client/base.pp | 4 ++-- manifests/client/darwin.pp | 2 +- manifests/client/debian.pp | 4 ++-- manifests/client/openbsd.pp | 6 +++--- manifests/host.pp | 6 +++--- manifests/host/cgi.pp | 6 +++--- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- manifests/plugin/scriptpaths.pp | 4 ++-- manifests/plugins/base.pp | 2 +- manifests/plugins/interfaces.pp | 2 +- manifests/plugins/physical.pp | 2 +- manifests/plugins/setup.pp | 2 +- manifests/register.pp | 4 ++-- manifests/register/snmp.pp | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 99480f1..0ff5b79 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -5,7 +5,7 @@ class munin::client { - case $operatingsystem { + case $::operatingsystem { openbsd: { include munin::client::openbsd } darwin: { include munin::client::darwin } debian,ubuntu: { include munin::client::debian } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 6b4bef9..0c7a62a 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -12,11 +12,11 @@ class munin::client::base( mode => 0755, owner => root, group => 0; } file {'/etc/munin/munin-node.conf': - content => template("munin/munin-node.conf.$operatingsystem"), + content => template("munin/munin-node.conf.${::operatingsystem}"), notify => Service['munin-node'], mode => 0644, owner => root, group => 0, } - munin::register { $fqdn: + munin::register { $::fqdn: config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], } include munin::plugins::base diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index 92787ec..264263d 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -18,5 +18,5 @@ class munin::client::darwin { exec{"/sbin/SystemStarter start SNMP": noop => false, } - munin::register::snmp { $fqdn: } + munin::register::snmp { $::fqdn: } } diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 97f5fbf..903fb2d 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -4,10 +4,10 @@ class munin::client::debian inherits munin::client::package { Service["munin-node"]{ # sarge's munin-node init script has no status - hasstatus => $lsbdistcodename ? { sarge => false, default => true } + hasstatus => $::lsbdistcodename ? { sarge => false, default => true } } File["/etc/munin/munin-node.conf"]{ - content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"), + content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"), } # workaround bug in munin_node_configure plugin { "postfix_mailvolume": ensure => absent } diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 7012c00..e1742d2 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,7 +1,7 @@ # currently we install munin on openbsd by targz # :( class munin::client::openbsd inherits munin::client::base { - if $operatingsystemrelease == '4.3' { + 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; @@ -32,7 +32,7 @@ class munin::client::openbsd inherits munin::client::base { owner => root, group => 0, mode => 0755; } openbsd::rc_local{'munin-node': - binary => $operatingsystemrelease ? { + binary => $::operatingsystemrelease ? { '4.3' => '/opt/munin/sbin/munin-node', default => '/usr/local/sbin/munin-node' }, @@ -41,7 +41,7 @@ class munin::client::openbsd inherits munin::client::base { Service['munin-node']{ restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`', stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`', - start => $operatingsystemrelease ? { + start => $::operatingsystemrelease ? { '4.3' => '/opt/munin/sbin/munin-node', default => '/usr/local/sbin/munin-node' }, diff --git a/manifests/host.pp b/manifests/host.pp index 107cd39..c424e94 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -9,10 +9,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", + source => [ "puppet:///modules/site-munin/config/host/${::fqdn}/munin.conf.header", + "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", + "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}", "puppet:///modules/munin/config/host/munin.conf.header" ], order => 05, } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 6fd50df..283a243 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -6,10 +6,10 @@ 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", + 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.${::operatingsystem}", "puppet:///modules/munin/config/host/logrotate" ], owner => root, group => 0, mode => 0644; } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 69b7322..51de48a 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -21,7 +21,7 @@ define munin::plugin ( file { $plugin: ensure => absent, } } default: { - case $kernel { + case $::kernel { openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 67cbfb8..7de8d45 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -15,7 +15,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { mode => 0755, owner => root, group => 0; } - case $kernel { + case $::kernel { openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index 164a17e..f4bd39b 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,9 +1,9 @@ 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" } - openbsd: { $script_path = $operatingsystemrelease ? { + openbsd: { $script_path = $::operatingsystemrelease ? { '4.3' => '/opt/munin/lib/plugins/', default => '/usr/local/libexec/munin/plugins/' } } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 007579c..972a674 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -7,7 +7,7 @@ class munin::plugins::base { } include munin::plugins::interfaces - case $kernel { + case $::kernel { openbsd: { include munin::plugins::openbsd } linux: { case $vserver { diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 18a713b..b2c448b 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -5,7 +5,7 @@ class munin::plugins::interfaces { munin::plugin { $ifs: ensure => "if_"; } - case $operatingsystem { + case $::operatingsystem { openbsd: { $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") munin::plugin{ diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp index ac050a5..a1c27a7 100644 --- a/manifests/plugins/physical.pp +++ b/manifests/plugins/physical.pp @@ -1,5 +1,5 @@ class munin::plugins::physical { - case $kernel { + case $::kernel { linux: { munin::plugin { iostat: } } } } diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index c88f9e0..caf2e28 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -11,7 +11,7 @@ class munin::plugins::setup { mode => 0644, owner => root, group => 0, notify => Service['munin-node'], } - case $kernel { + case $::kernel { openbsd: { File['/etc/munin/plugin-conf.d/munin-node']{ before => File['/var/run/munin'], diff --git a/manifests/register.pp b/manifests/register.pp index 3c542ff..254eaaf 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -16,8 +16,8 @@ define munin::register ( $hiera_munin_host = hiera('munin_host','') $munin_host_real = $host ? { 'absent' => $hiera_munin_host ? { - '' => $fqdn, - 'fqdn' => $fqdn, + '' => $::fqdn, + 'fqdn' => $::fqdn, default => $hiera_munin_host }, default => $host diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index a4d0d88..acd1e03 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -5,7 +5,7 @@ define munin::register::snmp ( ) { $fhost = $name - $munin_host_real = $fqdn + $munin_host_real = $::fqdn $client_type = 'snmp' $config = [ 'use_node_name no' ] -- cgit v1.2.3 From 8a2e868c67013f6dcebe722cc1f0c7cbf599b8fc Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Thu, 2 Feb 2012 18:14:56 -0800 Subject: Make sure concat::setup is declared Make sure concat::setup is declared for /etc/munin/munin.conf. --- manifests/host.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests') diff --git a/manifests/host.pp b/manifests/host.pp index 107cd39..22ffbe2 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -4,6 +4,7 @@ class munin::host { package {"munin": ensure => installed, } + include concat::setup Concat::Fragment <<| tag == 'munin' |>> -- cgit v1.2.3 From c91621a0953d97a83f62205519524708c279a24e Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Thu, 2 Feb 2012 18:19:33 -0800 Subject: Fix munin.conf for squeeze and later Debian releases Add support for lsbdistcodename-specific munin.conf.header files. Create squeeze munin.conf.header file which contains the new htmldir setting, /var/cache/munin/www, and symlink wheezy and sid to it. --- manifests/host.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/host.pp b/manifests/host.pp index 107cd39..a26c013 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -9,10 +9,12 @@ 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", + source => [ "puppet:///modules/site-munin/config/host/${::fqdn}/munin.conf.header", + "puppet:///modules/site-munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", + "puppet:///modules/site-munin/config/host/munin.conf.header.${::operatingsystem}", "puppet:///modules/site-munin/config/host/munin.conf.header", - "puppet:///modules/munin/config/host/munin.conf.header.$operatingsystem", + "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, } -- cgit v1.2.3 From d459255da087bda68627dc5c228056b6ebf7036b Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 15 Feb 2012 18:17:14 +0100 Subject: manage selinux if enabled of plugins we manage --- manifests/plugin.pp | 8 ++++++-- manifests/plugin/deploy.pp | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 69b7322..b76a5da 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -21,7 +21,7 @@ define munin::plugin ( file { $plugin: ensure => absent, } } default: { - case $kernel { + case $::kernel { openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } } @@ -35,7 +35,11 @@ define munin::plugin ( require => $real_require, notify => Service['munin-node']; } - + if $::selinux == 'true' { + File[$plugin]{ + setype => 'munin_services_plugin_exec_t', + } + } } } case $config { diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 67cbfb8..be7748b 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -15,7 +15,14 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { mode => 0755, owner => root, group => 0; } - case $kernel { + + if $::selinux == 'true' { + File["munin_plugin_${name}"]{ + setype => 'munin_services_plugin_exec_t', + } + } + + case $::kernel { openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } } -- cgit v1.2.3 From 71d458239f7e8f175c3180d95f0b7770aea91ff0 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 15 Feb 2012 18:25:11 +0100 Subject: correct param --- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index b76a5da..30139ea 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -37,7 +37,7 @@ define munin::plugin ( } if $::selinux == 'true' { File[$plugin]{ - setype => 'munin_services_plugin_exec_t', + seltype => 'munin_services_plugin_exec_t', } } } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index be7748b..a76bc6e 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -18,7 +18,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { if $::selinux == 'true' { File["munin_plugin_${name}"]{ - setype => 'munin_services_plugin_exec_t', + seltype => 'munin_services_plugin_exec_t', } } -- cgit v1.2.3 From df6d136c29b035616ba5bbf5efd9b16f3a22338e Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 16 Feb 2012 15:57:22 +0100 Subject: set correct labels for munin plugins --- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 30139ea..c1f488b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -37,7 +37,7 @@ define munin::plugin ( } if $::selinux == 'true' { File[$plugin]{ - seltype => 'munin_services_plugin_exec_t', + seltype => 'munin_etc_t', } } } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index a76bc6e..86ca7f5 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -18,7 +18,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { if $::selinux == 'true' { File["munin_plugin_${name}"]{ - seltype => 'munin_services_plugin_exec_t', + seltype => 'munin_exec_t', } } -- cgit v1.2.3 From f2a0d2623b36e6105f31e51d99cbd349adaa30d7 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 25 Feb 2012 13:54:48 +0100 Subject: CentOS 5 does not yet have a munin policy --- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index c1f488b..9f799aa 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -35,7 +35,7 @@ define munin::plugin ( require => $real_require, notify => Service['munin-node']; } - if $::selinux == 'true' { + if ($::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 86ca7f5..094b490 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -16,7 +16,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { } - if $::selinux == 'true' { + if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File["munin_plugin_${name}"]{ seltype => 'munin_exec_t', } -- cgit v1.2.3 From 9fd1de5acd9064a0d67ca9d2c13a829a3f628f39 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 19:39:49 -0300 Subject: new style for 2.7 --- manifests/client.pp | 23 +++++---- manifests/client/base.pp | 38 +++++++-------- manifests/client/centos.pp | 2 +- manifests/client/debian.pp | 24 +++++----- manifests/client/gentoo.pp | 2 +- manifests/client/openbsd.pp | 102 +++++++++++++++++++-------------------- manifests/client/package.pp | 18 +++---- manifests/host.pp | 16 ++++--- manifests/host/cgi.pp | 26 +++++----- manifests/plugin.pp | 104 ++++++++++++++++++++-------------------- manifests/plugin/deploy.pp | 72 ++++++++++++++-------------- manifests/plugin/scriptpaths.pp | 20 ++++---- manifests/plugins/base.pp | 2 +- manifests/plugins/gentoo.pp | 6 +-- manifests/plugins/interfaces.pp | 6 +-- manifests/plugins/linux.pp | 2 +- manifests/register.pp | 40 ++++++++-------- manifests/register/snmp.pp | 37 +++++++------- manifests/remoteplugin.pp | 28 +++++------ 19 files changed, 284 insertions(+), 284 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 0ff5b79..5080f99 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -4,16 +4,15 @@ # Adapted and improved by admin(at)immerda.ch class munin::client { - - case $::operatingsystem { - openbsd: { include munin::client::openbsd } - darwin: { include munin::client::darwin } - debian,ubuntu: { include munin::client::debian } - gentoo: { include munin::client::gentoo } - centos: { include munin::client::package } - default: { include munin::client::base } - } - if $use_shorewall { - include shorewall::rules::munin - } + case $::operatingsystem { + openbsd: { include munin::client::openbsd } + darwin: { include munin::client::darwin } + debian,ubuntu: { include munin::client::debian } + gentoo: { include munin::client::gentoo } + centos: { include munin::client::package } + default: { include munin::client::base } + } + if hiera('use_shorewall',false) { + include shorewall::rules::munin + } } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 0c7a62a..80a25c5 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,23 +1,23 @@ class munin::client::base( $munin_allow = hiera('munin_allow','127.0.0.1') ) { - service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, - } - file {'/etc/munin': - ensure => directory, - mode => 0755, owner => root, group => 0; - } - file {'/etc/munin/munin-node.conf': - content => template("munin/munin-node.conf.${::operatingsystem}"), - notify => Service['munin-node'], - mode => 0644, owner => root, group => 0, - } - munin::register { $::fqdn: - config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], - } - include munin::plugins::base + service { 'munin-node': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + } + file {'/etc/munin': + ensure => directory, + mode => 0755, owner => root, group => 0; + } + file {'/etc/munin/munin-node.conf': + content => template("munin/munin-node.conf.${::operatingsystem}"), + notify => Service['munin-node'], + mode => 0644, owner => root, group => 0, + } + munin::register { $::fqdn: + config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + } + include munin::plugins::base } diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp index 42e8c59..3a7151b 100644 --- a/manifests/client/centos.pp +++ b/manifests/client/centos.pp @@ -1,3 +1,3 @@ class munin::client::centos inherits munin::client::package { - include munin::plugins::centos + include munin::plugins::centos } diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 903fb2d..e67ac26 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,15 +1,15 @@ class munin::client::debian inherits munin::client::package { - # the plugin will need that - package { "iproute": ensure => installed } + # the plugin will need that + package { "iproute": ensure => installed } - Service["munin-node"]{ - # sarge's munin-node init script has no status - hasstatus => $::lsbdistcodename ? { sarge => false, default => true } - } - File["/etc/munin/munin-node.conf"]{ - content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"), - } - # workaround bug in munin_node_configure - plugin { "postfix_mailvolume": ensure => absent } - include munin::plugins::debian + Service["munin-node"]{ + # sarge's munin-node init script has no status + hasstatus => $::lsbdistcodename ? { sarge => false, default => true } + } + File["/etc/munin/munin-node.conf"]{ + content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"), + } + # workaround bug in munin_node_configure + plugin { "postfix_mailvolume": ensure => absent } + include munin::plugins::debian } diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index c24d317..6a01050 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -4,5 +4,5 @@ class munin::client::gentoo inherits munin::client::package { category => 'net-analyzer', } - include munin::plugins::gentoo + include munin::plugins::gentoo } diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index e1742d2..88d0640 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,59 +1,59 @@ # currently we install munin on openbsd by targz # :( class munin::client::openbsd inherits munin::client::base { - if $::operatingsystemrelease == '4.3' { - file{'/usr/src/munin_openbsd.tar.gz': - source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz", - owner => root, group => 0, mode => 0600; - } - exec{'extract_openbsd': - command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz', - unless => 'test -d /opt/munin', - require => File['/usr/src/munin_openbsd.tar.gz'], - before => File['/var/run/munin'], - } - package{'p5-Compress-Zlib': - ensure => installed, - before => File['/var/run/munin'], - } - } else { - package{'munin-node': - ensure => installed, - } + if $::operatingsystemrelease == '4.3' { + file{'/usr/src/munin_openbsd.tar.gz': + source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz", + owner => root, group => 0, mode => 0600; } - package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP', - 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server', - 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]: - ensure => installed, - before => File['/var/run/munin'], + exec{'extract_openbsd': + command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz', + unless => 'test -d /opt/munin', + require => File['/usr/src/munin_openbsd.tar.gz'], + before => File['/var/run/munin'], } - file{[ '/var/run/munin', '/var/log/munin' ]: - ensure => directory, - owner => root, group => 0, mode => 0755; + package{'p5-Compress-Zlib': + ensure => installed, + before => File['/var/run/munin'], } - openbsd::rc_local{'munin-node': - binary => $::operatingsystemrelease ? { - '4.3' => '/opt/munin/sbin/munin-node', - default => '/usr/local/sbin/munin-node' - }, - require => File['/var/run/munin'], - } - Service['munin-node']{ - restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`', - stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`', - start => $::operatingsystemrelease ? { - '4.3' => '/opt/munin/sbin/munin-node', - default => '/usr/local/sbin/munin-node' - }, - status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^$(cat /var/run/munin/munin-node.pid).*munin-node")', - hasstatus => true, - hasrestart => true, - require => [ File['/var/run/munin'], File['/var/log/munin'] ], - } - cron{'clean_munin_logfile': - command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', - minute => 0, - hour => 2, - weekday => 0, + } else { + package{'munin-node': + ensure => installed, } + } + package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP', + 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server', + 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]: + ensure => installed, + before => File['/var/run/munin'], + } + file{[ '/var/run/munin', '/var/log/munin' ]: + ensure => directory, + owner => root, group => 0, mode => 0755; + } + openbsd::rc_local{'munin-node': + binary => $::operatingsystemrelease ? { + '4.3' => '/opt/munin/sbin/munin-node', + default => '/usr/local/sbin/munin-node' + }, + require => File['/var/run/munin'], + } + Service['munin-node']{ + restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`', + stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`', + start => $::operatingsystemrelease ? { + '4.3' => '/opt/munin/sbin/munin-node', + default => '/usr/local/sbin/munin-node' + }, + status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^$(cat /var/run/munin/munin-node.pid).*munin-node")', + hasstatus => true, + hasrestart => true, + require => [ File['/var/run/munin'], File['/var/log/munin'] ], + } + cron{'clean_munin_logfile': + command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', + minute => 0, + hour => 2, + weekday => 0, + } } diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 18566b8..58f40da 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,11 +1,11 @@ class munin::client::package inherits munin::client::base { - package { 'munin-node': ensure => installed } - Service['munin-node']{ - require => Package[munin-node], - } - File['/etc/munin/munin-node.conf']{ - # this has to be installed before the package, so the postinst can - # boot the munin-node without failure! - before => Package['munin-node'], - } + package { 'munin-node': ensure => installed } + Service['munin-node']{ + require => Package[munin-node], + } + File['/etc/munin/munin-node.conf']{ + # this has to be installed before the package, so the postinst can + # boot the munin-node without failure! + before => Package['munin-node'], + } } diff --git a/manifests/host.pp b/manifests/host.pp index e81f08f..524cddf 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -2,7 +2,9 @@ # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. -class munin::host { +class munin::host( + $cgi_graphing = false +) { package {"munin": ensure => installed, } include concat::setup @@ -10,10 +12,10 @@ class munin::host { concat::fragment{'munin.conf.header': target => '/etc/munin/munin.conf', - source => [ "puppet:///modules/site-munin/config/host/${::fqdn}/munin.conf.header", - "puppet:///modules/site-munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", - "puppet:///modules/site-munin/config/host/munin.conf.header.${::operatingsystem}", - "puppet:///modules/site-munin/config/host/munin.conf.header", + source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/munin.conf.header", + "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", + "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}", + "puppet:///modules/site_munin/config/host/munin.conf.header", "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}", "puppet:///modules/munin/config/host/munin.conf.header" ], @@ -26,7 +28,7 @@ class munin::host { include munin::plugins::muninhost - if $munin_do_cgi_graphing { + if $munin::host::cgi_graphing { include munin::host::cgi } @@ -35,7 +37,7 @@ class munin::host { content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n", owner => root, group => 0, mode => 0644; } - if $use_shorewall { + if hiera('use_shorewall',false) { include shorewall::rules::out::munin } } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 283a243..9980856 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,16 +1,16 @@ class munin::host::cgi { - exec{'set_modes_for_cgi': - command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', - refreshonly => true, - subscribe => File['/etc/munin/munin.conf.header'], - } + exec{'set_modes_for_cgi': + command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', + refreshonly => true, + subscribe => File['/etc/munin/munin.conf.header'], + } - file{'/etc/logrotate.d/munin': - source => [ "puppet:///modules/site-munin/config/host/${::fqdn}/logrotate", - "puppet:///modules/site-munin/config/host/logrotate.${::operatingsystem}", - "puppet:///modules/site-munin/config/host/logrotate", - "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}", - "puppet:///modules/munin/config/host/logrotate" ], - owner => root, group => 0, mode => 0644; - } + file{'/etc/logrotate.d/munin': + source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/logrotate", + "puppet:///modules/site_munin/config/host/logrotate.${::operatingsystem}", + "puppet:///modules/site_munin/config/host/logrotate", + "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}", + "puppet:///modules/munin/config/host/logrotate" ], + owner => root, group => 0, mode => 0644; + } } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 9f799aa..fec7b6b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -4,65 +4,65 @@ # adapted and improved by admin(at)immerda.ch define munin::plugin ( - $ensure = "present", - $script_path_in = '', - $config = '') -{ - include munin::plugin::scriptpaths - $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in } + $ensure = "present", + $script_path_in = '', + $config = '' +) { + include munin::plugin::scriptpaths + $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in } - $plugin_src = $ensure ? { "present" => $name, default => $ensure } - $plugin = "/etc/munin/plugins/$name" - $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf" + $plugin_src = $ensure ? { "present" => $name, default => $ensure } + $plugin = "/etc/munin/plugins/${name}" + $plugin_conf = "/etc/munin/plugin-conf.d/${name}.conf" - include munin::plugins::setup - case $ensure { - "absent": { - file { $plugin: ensure => absent, } - } - default: { - case $::kernel { - openbsd: { $basic_require = File['/var/run/munin'] } - default: { $basic_require = Package['munin-node'] } - } - if $require { - $real_require = [ $require, $basic_require ] - } else { - $real_require = $basic_require - } - file { $plugin: - ensure => "${real_script_path}/${plugin_src}", - require => $real_require, - notify => Service['munin-node']; - } - if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ - File[$plugin]{ - seltype => 'munin_etc_t', - } - } + include munin::plugins::setup + case $ensure { + "absent": { + file { $plugin: ensure => absent, } + } + default: { + case $::kernel { + openbsd: { $basic_require = File['/var/run/munin'] } + default: { $basic_require = Package['munin-node'] } + } + if $require { + $real_require = [ $require, $basic_require ] + } else { + $real_require = $basic_require + } + file { $plugin: + ensure => "${real_script_path}/${plugin_src}", + require => $real_require, + notify => Service['munin-node']; + } + if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + File[$plugin]{ + seltype => 'munin_etc_t', } + } + } + } + case $config { + '': { + file { $plugin_conf: ensure => absent } } - case $config { - '': { - file { $plugin_conf: ensure => absent } + default: { + case $ensure { + absent: { + file { $plugin_conf: ensure => absent } } default: { - case $ensure { - absent: { - file { $plugin_conf: ensure => absent } - } - default: { - file { $plugin_conf: - content => "[${name}]\n$config\n", - mode => 0644, owner => root, group => 0, - } - if $require { - File[$plugin_conf]{ - require +> $require, - } - } - } + file { $plugin_conf: + content => "[${name}]\n$config\n", + mode => 0644, owner => root, group => 0, + } + if $require { + File[$plugin_conf]{ + require +> $require, } + } } + } } + } } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 5003153..9e74afb 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,43 +1,43 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { - $plugin_src = $ensure ? { - 'present' => $name, - 'absent' => $name, - default => $ensure - } - $real_source = $source ? { - '' => "munin/plugins/$plugin_src", - default => $source - } - include munin::plugin::scriptpaths - file { "munin_plugin_${name}": - path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet:///modules/$real_source", - mode => 0755, owner => root, group => 0; - } + $plugin_src = $ensure ? { + 'present' => $name, + 'absent' => $name, + default => $ensure + } + $real_source = $source ? { + '' => "munin/plugins/$plugin_src", + default => $source + } + include munin::plugin::scriptpaths + file { "munin_plugin_${name}": + path => "${munin::plugin::scriptpaths::script_path}/${name}", + source => "puppet:///modules/${real_source}", + mode => 0755, owner => root, group => 0; + } - if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ - File["munin_plugin_${name}"]{ - seltype => 'munin_exec_t', - } + if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + File["munin_plugin_${name}"]{ + seltype => 'munin_exec_t', } + } - case $::kernel { - openbsd: { $basic_require = File['/var/run/munin'] } - default: { $basic_require = Package['munin-node'] } - } - if $require { - File["munin_plugin_${name}"]{ - require => [ $basic_require, $require ], - } - } else { - File["munin_plugin_${name}"]{ - require => $basic_require, - } + case $::kernel { + openbsd: { $basic_require = File['/var/run/munin'] } + default: { $basic_require = Package['munin-node'] } + } + if $require { + File["munin_plugin_${name}"]{ + require => [ $basic_require, $require ], } - # register the plugin - if $require { - munin::plugin{$name: ensure => $ensure, config => $config, require => $require } - } else { - munin::plugin{$name: ensure => $ensure, config => $config } + } else { + File["munin_plugin_${name}"]{ + require => $basic_require, } + } + # register the plugin + if $require { + munin::plugin{$name: ensure => $ensure, config => $config, require => $require } + } else { + munin::plugin{$name: ensure => $ensure, config => $config } + } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index f4bd39b..2cad97b 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,12 +1,12 @@ class munin::plugin::scriptpaths { - case $::operatingsystem { - gentoo: { $script_path = "/usr/libexec/munin/plugins" } - debian: { $script_path = "/usr/share/munin/plugins" } - centos: { $script_path = "/usr/share/munin/plugins" } - openbsd: { $script_path = $::operatingsystemrelease ? { - '4.3' => '/opt/munin/lib/plugins/', - default => '/usr/local/libexec/munin/plugins/' - } } - default: { $script_path = "/usr/share/munin/plugins" } - } + case $::operatingsystem { + gentoo: { $script_path = "/usr/libexec/munin/plugins" } + debian: { $script_path = "/usr/share/munin/plugins" } + centos: { $script_path = "/usr/share/munin/plugins" } + openbsd: { $script_path = $::operatingsystemrelease ? { + '4.3' => '/opt/munin/lib/plugins/', + default => '/usr/local/libexec/munin/plugins/' + } } + default: { $script_path = "/usr/share/munin/plugins" } + } } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 972a674..d26aaeb 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -17,7 +17,7 @@ class munin::plugins::base { } } - case $virtual { + case $::virtual { physical: { include munin::plugins::physical } xen0: { include munin::plugins::dom0 } } diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp index 25c1626..27d4689 100644 --- a/manifests/plugins/gentoo.pp +++ b/manifests/plugins/gentoo.pp @@ -1,5 +1,5 @@ class munin::plugins::gentoo { - munin::plugin::deploy { 'gentoo_lastupdated': - config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep" - } + munin::plugin::deploy { 'gentoo_lastupdated': + config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep" + } } diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index b2c448b..cc79259 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,19 +1,19 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces { - $ifs = regsubst(split($interfaces, " |,"), "(.+)", "if_\\1") + $ifs = regsubst(split($::interfaces, " |,"), "(.+)", "if_\\1") munin::plugin { $ifs: ensure => "if_"; } case $::operatingsystem { openbsd: { - $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") + $if_errs = regsubst(split($::interfaces, " |,"), "(.+)", "if_errcoll_\\1") munin::plugin{ $if_errs: ensure => "if_errcoll_"; } } default: { - $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_err_\\1") + $if_errs = regsubst(split($::interfaces, " |,"), "(.+)", "if_err_\\1") munin::plugin{ $if_errs: ensure => "if_err_"; } diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index 30e0af6..a73de63 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -3,6 +3,6 @@ class munin::plugins::linux { [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: ensure => present; acpi: - ensure => $acpi_available; + ensure => $::acpi_available; } } diff --git a/manifests/register.pp b/manifests/register.pp index 254eaaf..14019d0 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -5,27 +5,27 @@ define munin::register ( $config = [] ) { - $fhost = $name - $client_type = 'client' + $fhost = $name + $client_type = 'client' - $munin_port_real = $port ? { - 'absent' => hiera('munin_port','4949'), - default => $port - } + $munin_port_real = $port ? { + 'absent' => hiera('munin_port','4949'), + default => $port + } - $hiera_munin_host = hiera('munin_host','') - $munin_host_real = $host ? { - 'absent' => $hiera_munin_host ? { - '' => $::fqdn, - 'fqdn' => $::fqdn, - default => $hiera_munin_host - }, - default => $host - } + $hiera_munin_host = hiera('munin_host','') + $munin_host_real = $host ? { + 'absent' => $hiera_munin_host ? { + '' => $::fqdn, + 'fqdn' => $::fqdn, + default => $hiera_munin_host + }, + default => $host + } - @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}": - target => '/etc/munin/munin.conf', - content => template("munin/client.erb"), - tag => 'munin', - } + @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}": + target => '/etc/munin/munin.conf', + content => template("munin/client.erb"), + tag => 'munin', + } } diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index acd1e03..3007b67 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -2,26 +2,25 @@ define munin::register::snmp ( $community = 'public', $description = 'absent', $port = 'absent' -) -{ - $fhost = $name - $munin_host_real = $::fqdn - $client_type = 'snmp' - $config = [ 'use_node_name no' ] +) { + $fhost = $name + $munin_host_real = $::fqdn + $client_type = 'snmp' + $config = [ 'use_node_name no' ] - $munin_port_real = $port ? { - 'absent' => hiera('munin_port','4949'), - default => $port - } + $munin_port_real = $port ? { + 'absent' => hiera('munin_port','4949'), + default => $port + } - exec { "munin_register_snmp_${fhost}": - command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", - unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", - } + exec { "munin_register_snmp_${fhost}": + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", + unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + } - @@concat::fragment{ "munin_snmp_${fhost}": - target => '/etc/munin/munin.conf', - content => template("munin/client.erb"), - tag => 'munin', - } + @@concat::fragment{ "munin_snmp_${fhost}": + target => '/etc/munin/munin.conf', + content => template("munin/client.erb"), + tag => 'munin', + } } diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp index ce87492..603cb66 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", - } - } + 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", + } } + } } -- cgit v1.2.3 From b7228e65b66b72709f59709618a7c7be1ce795ef Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 8 Jun 2012 13:03:50 -0300 Subject: refactor things for >2.7 --- manifests/plugin.pp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index fec7b6b..af8b44a 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -21,18 +21,12 @@ define munin::plugin ( 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, + require => $::kernel ? { + OpenBSD => File['/var/run/munin'], + default => Package['munin-node'] + }, notify => Service['munin-node']; } if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ @@ -56,11 +50,6 @@ define munin::plugin ( content => "[${name}]\n$config\n", mode => 0644, owner => root, group => 0, } - if $require { - File[$plugin_conf]{ - require +> $require, - } - } } } } -- cgit v1.2.3 From 64a6aa3cf73bdc9d75d34b6fbcd04f5e7f34e923 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 9 Jun 2012 21:17:47 -0300 Subject: use class parameters --- manifests/client.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 5080f99..79d275e 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -3,7 +3,11 @@ # See LICENSE for the full license granted to you. # Adapted and improved by admin(at)immerda.ch -class munin::client { +class munin::client( + $allow = hiera('munin_client_allow',['127.0.0.1']), + $host = hiera('munin_host','*'), + $port = hiera('munin_port','4949') +) { case $::operatingsystem { openbsd: { include munin::client::openbsd } darwin: { include munin::client::darwin } -- cgit v1.2.3 From b4a30b6255ca495b98803317ad691fa1a26a4987 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 19:25:32 -0300 Subject: config for df --- manifests/plugins/base.pp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'manifests') diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index d26aaeb..c6b88ed 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -5,6 +5,11 @@ class munin::plugins::base { 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; + } include munin::plugins::interfaces case $::kernel { -- cgit v1.2.3 From c95f0b2fcf4f35b1a7ae3ad9c04600a32ab2bb43 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 13 Jun 2012 20:40:57 -0300 Subject: migrate away from hiera stuff --- manifests/client.pp | 16 +++++++++++----- manifests/client/base.pp | 6 +++--- manifests/host.pp | 2 +- manifests/register.pp | 19 ++----------------- manifests/register/snmp.pp | 9 ++------- 5 files changed, 19 insertions(+), 33 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 79d275e..934d23a 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -4,9 +4,11 @@ # Adapted and improved by admin(at)immerda.ch class munin::client( - $allow = hiera('munin_client_allow',['127.0.0.1']), - $host = hiera('munin_host','*'), - $port = hiera('munin_port','4949') + $allow = [ '127.0.0.1' ], + $host = '*', + $port = '4949', + $manage_shorewall = false, + $shorewall_collector_source = 'net' ) { case $::operatingsystem { openbsd: { include munin::client::openbsd } @@ -16,7 +18,11 @@ class munin::client( centos: { include munin::client::package } default: { include munin::client::base } } - if hiera('use_shorewall',false) { - include shorewall::rules::munin + if $munin::client::manage_shorewall { + class{'shorewall::rules::munin': + 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 80a25c5..1cba47b 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,6 +1,4 @@ -class munin::client::base( - $munin_allow = hiera('munin_allow','127.0.0.1') -) { +class munin::client::base { service { 'munin-node': ensure => running, enable => true, @@ -17,6 +15,8 @@ class munin::client::base( mode => 0644, owner => root, group => 0, } munin::register { $::fqdn: + host => $munin::client::host, + port => $munin::client::port, config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], } include munin::plugins::base diff --git a/manifests/host.pp b/manifests/host.pp index 524cddf..b828e35 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -37,7 +37,7 @@ class munin::host( content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n", owner => root, group => 0, mode => 0644; } - if hiera('use_shorewall',false) { + if $munin::host::manage_shorewall { include shorewall::rules::out::munin } } diff --git a/manifests/register.pp b/manifests/register.pp index 14019d0..2645542 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,6 +1,6 @@ define munin::register ( - $host = 'absent', - $port = 'absent', + $host = $::fqdn, + $port = '4949', $description = 'absent', $config = [] ) @@ -8,21 +8,6 @@ define munin::register ( $fhost = $name $client_type = 'client' - $munin_port_real = $port ? { - 'absent' => hiera('munin_port','4949'), - default => $port - } - - $hiera_munin_host = hiera('munin_host','') - $munin_host_real = $host ? { - 'absent' => $hiera_munin_host ? { - '' => $::fqdn, - 'fqdn' => $::fqdn, - default => $hiera_munin_host - }, - default => $host - } - @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}": target => '/etc/munin/munin.conf', content => template("munin/client.erb"), diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 3007b67..78c3e91 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,18 +1,13 @@ define munin::register::snmp ( $community = 'public', $description = 'absent', - $port = 'absent' + $port = '4949', + $host = $::fqdn ) { $fhost = $name - $munin_host_real = $::fqdn $client_type = 'snmp' $config = [ 'use_node_name no' ] - $munin_port_real = $port ? { - 'absent' => hiera('munin_port','4949'), - default => $port - } - exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", -- cgit v1.2.3 From 1ca3978ff3094c01a56feaee6c37fc82e3224d15 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 18 Jun 2012 15:40:22 -0300 Subject: if it's * it should be collected by fqdn otherwise directly by what is given to be listened on --- manifests/client/base.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 1cba47b..84ba9b2 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -15,7 +15,10 @@ class munin::client::base { mode => 0644, owner => root, group => 0, } munin::register { $::fqdn: - host => $munin::client::host, + host => $munin::client::host ? { + '*' => $::fqdn, + default => $munin::client::host + }, port => $munin::client::port, config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], } -- cgit v1.2.3 From a3e8f8ed1861d0a253b1605557e195f2530c2ae8 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 24 Jun 2012 19:21:41 -0400 Subject: correct naming --- manifests/register.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/register.pp b/manifests/register.pp index 2645542..9257ca1 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -8,7 +8,7 @@ define munin::register ( $fhost = $name $client_type = 'client' - @@concat::fragment{ "munin_client_${fhost}_${munin_port_real}": + @@concat::fragment{ "munin_client_${fhost}_${port}": target => '/etc/munin/munin.conf', content => template("munin/client.erb"), tag => 'munin', -- cgit v1.2.3 From 405cd4fcc4639e4c9f204bcebf852aeaf6a1b129 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 12 Sep 2012 13:04:33 +0200 Subject: add kvm plugins --- manifests/plugins/kvm.pp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 manifests/plugins/kvm.pp (limited to 'manifests') diff --git a/manifests/plugins/kvm.pp b/manifests/plugins/kvm.pp new file mode 100644 index 0000000..7a1430f --- /dev/null +++ b/manifests/plugins/kvm.pp @@ -0,0 +1,7 @@ +class munin::plugins::kvm { + munin::plugin::deploy { + [ 'kvm_cpu', 'kvm_mem', 'kvm_net' ]:; + 'kvm_io': + config => 'user root'; + } +} -- cgit v1.2.3 From d43c6ae0fcf45411524d093d21f5cb5c01f7c830 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 27 Nov 2012 15:43:21 +0100 Subject: there are now official selinux plugins --- manifests/plugins/selinux.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp index faf610a..d094f35 100644 --- a/manifests/plugins/selinux.pp +++ b/manifests/plugins/selinux.pp @@ -1,3 +1,3 @@ class munin::plugins::selinux { - munin::plugin::deploy { [ 'selinuxenforced', 'selinux_avcstats' ]: } + munin::plugin{ [ 'selinux_avcstat' ]: } } -- cgit v1.2.3 From adbfc508abf5bda607795f7bf02f9581e78b17a5 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 27 Nov 2012 21:54:19 +0100 Subject: filter out many of the useless interfaces that show up --- manifests/plugins/interfaces.pp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'manifests') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index cc79259..33fef33 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,21 +1,23 @@ # handle if_ and if_err_ plugins -class munin::plugins::interfaces { +class munin::plugins::interfaces { + + # filter out many of the useless interfaces that show up + $ifs = regsubst(reject(split($::interfaces, ' |,'), 'eth\d+:\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+'), '(.+)', 'if_\\1') - $ifs = regsubst(split($::interfaces, " |,"), "(.+)", "if_\\1") munin::plugin { - $ifs: ensure => "if_"; + $ifs: ensure => 'if_'; } case $::operatingsystem { openbsd: { - $if_errs = regsubst(split($::interfaces, " |,"), "(.+)", "if_errcoll_\\1") + $if_errs = regsubst(split($::interfaces, ' |,'), '(.+)', 'if_errcoll_\\1') munin::plugin{ - $if_errs: ensure => "if_errcoll_"; + $if_errs: ensure => 'if_errcoll_'; } } default: { - $if_errs = regsubst(split($::interfaces, " |,"), "(.+)", "if_err_\\1") + $if_errs = regsubst(split($::interfaces, ' |,'), '(.+)', 'if_err_\\1') munin::plugin{ - $if_errs: ensure => "if_err_"; + $if_errs: ensure => 'if_err_'; } } } -- cgit v1.2.3 From bc23eb26287c343358a6bfbb9a776a67db39d02e Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 27 Nov 2012 22:08:14 +0100 Subject: improve regexp --- manifests/plugins/interfaces.pp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 33fef33..7e9819c 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -2,20 +2,21 @@ class munin::plugins::interfaces { # filter out many of the useless interfaces that show up - $ifs = regsubst(reject(split($::interfaces, ' |,'), 'eth\d+:\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+'), '(.+)', 'if_\\1') + $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+:\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+') + $ifs = regsubst($real_ifs, '(.+)', "if_\\1") munin::plugin { $ifs: ensure => 'if_'; } case $::operatingsystem { openbsd: { - $if_errs = regsubst(split($::interfaces, ' |,'), '(.+)', 'if_errcoll_\\1') + $if_errs = regsubst($real_ifs, '(.+)', "if_errcoll_\\1") munin::plugin{ $if_errs: ensure => 'if_errcoll_'; } } default: { - $if_errs = regsubst(split($::interfaces, ' |,'), '(.+)', 'if_err_\\1') + $if_errs = regsubst($real_ifs, '(.+)', "if_err_\\1") munin::plugin{ $if_errs: ensure => 'if_err_'; } -- cgit v1.2.3 From 005c89cfbd924e204e87a11248b0efe42d5cc8d6 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 27 Nov 2012 23:36:25 +0100 Subject: exclude more weird interfaces --- manifests/plugins/interfaces.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 7e9819c..a7e8ce6 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -2,7 +2,7 @@ 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+') + $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+:\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__temp\d+') $ifs = regsubst($real_ifs, '(.+)', "if_\\1") munin::plugin { -- cgit v1.2.3 From 6a440c04ee381ff184a7b7c9f3a98ca61337df92 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 29 Nov 2012 00:24:20 +0100 Subject: filter correct unwanted interfaces --- manifests/plugins/interfaces.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index a7e8ce6..da89ed0 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -2,7 +2,7 @@ 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+|__temp\d+') + $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") munin::plugin { -- cgit v1.2.3 From 630f4d609e1e58a74abb04963ce68c9fc4bab4a1 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 6 Dec 2012 22:11:10 +0100 Subject: replace xen-cpu plugin with a better plugin --- manifests/plugins/dom0.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp index ed4f62c..44995fc 100644 --- a/manifests/plugins/dom0.pp +++ b/manifests/plugins/dom0.pp @@ -1,6 +1,6 @@ class munin::plugins::dom0 { munin::plugin::deploy { - [ 'xen', 'xen-cpu', 'xen_memory', 'xen_mem', + [ 'xen', 'xen_cpu', 'xen_memory', 'xen_mem', 'xen_vm', 'xen_vbd', 'xen_traffic_all' ]: config => 'user root'; } -- cgit v1.2.3 From 864587e318adf0aa7d4a191b596f5b8337faf521 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 7 Dec 2012 16:05:41 +0100 Subject: fix issue if pid is not at the beginning + linting --- manifests/client/openbsd.pp | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'manifests') diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 88d0640..1852962 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -3,14 +3,16 @@ 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; + 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', + unless => 'test -d /opt/munin', require => File['/usr/src/munin_openbsd.tar.gz'], - before => File['/var/run/munin'], + before => File['/var/run/munin'], } package{'p5-Compress-Zlib': ensure => installed, @@ -28,32 +30,32 @@ class munin::client::openbsd inherits munin::client::base { before => File['/var/run/munin'], } file{[ '/var/run/munin', '/var/log/munin' ]: - ensure => directory, - owner => root, group => 0, mode => 0755; + 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 => $::operatingsystemrelease ? { - '4.3' => '/opt/munin/sbin/munin-node', - default => '/usr/local/sbin/munin-node' - }, + binary => $bin_loc, require => File['/var/run/munin'], } Service['munin-node']{ - restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`', - stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`', - start => $::operatingsystemrelease ? { - '4.3' => '/opt/munin/sbin/munin-node', - default => '/usr/local/sbin/munin-node' - }, - status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^$(cat /var/run/munin/munin-node.pid).*munin-node")', - hasstatus => true, - hasrestart => true, - require => [ File['/var/run/munin'], File['/var/log/munin'] ], + 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, + status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^ *$(cat /var/run/munin/munin-node.pid).*munin-node")', + hasstatus => true, + hasrestart => true, + require => [ File['/var/run/munin'], File['/var/log/munin'] ], } cron{'clean_munin_logfile': command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', - minute => 0, - hour => 2, + minute => 0, + hour => 2, weekday => 0, } } -- cgit v1.2.3 From a2004f577c2e15d9b6cf482f0693601f43c43fad Mon Sep 17 00:00:00 2001 From: Markus Heberling Date: Wed, 23 Jan 2013 20:15:52 +0100 Subject: added support for use_ssh for munin 2.0 --- manifests/client.pp | 1 + manifests/client/base.pp | 1 + manifests/register.pp | 1 + 3 files changed, 3 insertions(+) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 934d23a..6726836 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -7,6 +7,7 @@ class munin::client( $allow = [ '127.0.0.1' ], $host = '*', $port = '4949', + $use_ssh = false, $manage_shorewall = false, $shorewall_collector_source = 'net' ) { diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 84ba9b2..441198e 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -20,6 +20,7 @@ class munin::client::base { default => $munin::client::host }, port => $munin::client::port, + use_ssh => $munin::client::use_ssh, config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], } include munin::plugins::base diff --git a/manifests/register.pp b/manifests/register.pp index 9257ca1..6c154e5 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,6 +1,7 @@ define munin::register ( $host = $::fqdn, $port = '4949', + $use_ssh = false, $description = 'absent', $config = [] ) -- cgit v1.2.3 From d3dae3c834c37f689af3d1b08bc0c1fd4762bd91 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 19:14:56 +0100 Subject: linting --- manifests/plugin.pp | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index af8b44a..e9e5dba 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -1,33 +1,30 @@ -# plugin.pp - configure a specific munin plugin -# Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. -# adapted and improved by admin(at)immerda.ch - +# configure a specific munin plugin define munin::plugin ( - $ensure = "present", + $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_src = $ensure ? { 'present' => $name, default => $ensure } $plugin = "/etc/munin/plugins/${name}" $plugin_conf = "/etc/munin/plugin-conf.d/${name}.conf" include munin::plugins::setup case $ensure { - "absent": { + 'absent': { file { $plugin: ensure => absent, } } default: { + $dep = $::kernel ? { + OpenBSD => File['/var/run/munin'], + default => Package['munin-node'] + } file { $plugin: - ensure => "${real_script_path}/${plugin_src}", - require => $::kernel ? { - OpenBSD => File['/var/run/munin'], - default => Package['munin-node'] - }, - notify => Service['munin-node']; + ensure => "${real_script_path}/${plugin_src}", + require => $dep, + notify => Service['munin-node']; } if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File[$plugin]{ @@ -47,8 +44,10 @@ define munin::plugin ( } default: { file { $plugin_conf: - content => "[${name}]\n$config\n", - mode => 0644, owner => root, group => 0, + content => "[${name}]\n${config}\n", + owner => root, + group => 0, + mode => '0644', } } } -- cgit v1.2.3 From 61cfbbf42268045b0d4f0dc0481b962e9aad9f8f Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 20:21:53 +0100 Subject: linting --- manifests/plugin/deploy.pp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 9e74afb..2928a3a 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,18 +1,25 @@ -define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { +# deploy and register a munin plugin +define munin::plugin::deploy( + $ensure = 'present', + $source = '', + $config = '', +) { $plugin_src = $ensure ? { 'present' => $name, - 'absent' => $name, - default => $ensure + 'absent' => $name, + default => $ensure } $real_source = $source ? { - '' => "munin/plugins/$plugin_src", + '' => "munin/plugins/${plugin_src}", default => $source } include munin::plugin::scriptpaths file { "munin_plugin_${name}": - path => "${munin::plugin::scriptpaths::script_path}/${name}", - source => "puppet:///modules/${real_source}", - mode => 0755, owner => root, group => 0; + path => "${munin::plugin::scriptpaths::script_path}/${name}", + source => "puppet:///modules/${real_source}", + owner => root, + group => 0, + mode => '0755'; } if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ @@ -35,9 +42,13 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { } } # register the plugin + munin::plugin{$name: + ensure => $ensure, + config => $config + } if $require { - munin::plugin{$name: ensure => $ensure, config => $config, require => $require } - } else { - munin::plugin{$name: ensure => $ensure, config => $config } + Munin::Plugin[$name]{ + require => $require + } } } -- cgit v1.2.3 From f047c5c38310c25a4f5483cd33caba6d73a42ab0 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 20:23:10 +0100 Subject: this require is pretty useless, as if we have a require on the define, we do not need to pass it down --- manifests/plugin/deploy.pp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 2928a3a..53f6481 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -2,7 +2,7 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', - $config = '', + $config = '' ) { $plugin_src = $ensure ? { 'present' => $name, @@ -32,23 +32,12 @@ define munin::plugin::deploy( 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, - } + File["munin_plugin_${name}"]{ + require => $basic_require, } # register the plugin munin::plugin{$name: ensure => $ensure, config => $config } - if $require { - Munin::Plugin[$name]{ - require => $require - } - } } -- cgit v1.2.3 From 77e0a70999a8c4c20ee8d9eb521b927c525ac653 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 20:24:02 +0100 Subject: make it possible to manage the seltype --- manifests/plugin/deploy.pp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 53f6481..cbf64fb 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,8 +1,9 @@ # deploy and register a munin plugin define munin::plugin::deploy( - $ensure = 'present', - $source = '', - $config = '' + $ensure = 'present', + $source = '', + $config = '', + $seltype = 'munin_exec_t' ) { $plugin_src = $ensure ? { 'present' => $name, @@ -24,7 +25,7 @@ define munin::plugin::deploy( if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File["munin_plugin_${name}"]{ - seltype => 'munin_exec_t', + seltype => $seltype, } } -- cgit v1.2.3 From 68a4cb4ae4dc5aeeece00a1e40e41edcda82a8ff Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Feb 2013 20:29:55 +0100 Subject: move this to the apache module --- manifests/plugins/apache.pp | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 manifests/plugins/apache.pp (limited to 'manifests') diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp deleted file mode 100644 index dca3cea..0000000 --- a/manifests/plugins/apache.pp +++ /dev/null @@ -1,4 +0,0 @@ -class munin::plugins::apache { - munin::plugin{ [ 'apache_accesses', 'apache_processes', 'apache_volume' ]: } - munin::plugin::deploy { 'apache_activity': } -} -- cgit v1.2.3 From 3b10e0eb3fabb19cc0fa9d66f5a8379ae96aeb6f Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 18 Mar 2013 14:56:44 +0100 Subject: Add support for specifying tags for exported resources This enables you to specify different servers for different clients. --- manifests/client.pp | 3 ++- manifests/client/base.pp | 13 +++++++------ manifests/host.pp | 5 +++-- manifests/register.pp | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) (limited to 'manifests') diff --git a/manifests/client.pp b/manifests/client.pp index 6726836..2316bc9 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -9,7 +9,8 @@ class munin::client( $port = '4949', $use_ssh = false, $manage_shorewall = false, - $shorewall_collector_source = 'net' + $shorewall_collector_source = 'net', + $export_tag = 'munin' ) { case $::operatingsystem { openbsd: { include munin::client::openbsd } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 441198e..78398a9 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -15,13 +15,14 @@ class munin::client::base { mode => 0644, owner => root, group => 0, } munin::register { $::fqdn: - host => $munin::client::host ? { - '*' => $::fqdn, - default => $munin::client::host + host => $munin::client::host ? { + '*' => $::fqdn, + default => $munin::client::host }, - port => $munin::client::port, - use_ssh => $munin::client::use_ssh, - config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + 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, } include munin::plugins::base } diff --git a/manifests/host.pp b/manifests/host.pp index b828e35..05dcb5e 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -3,12 +3,13 @@ # See LICENSE for the full license granted to you. class munin::host( - $cgi_graphing = false + $cgi_graphing = false, + $export_tag = 'munin' ) { package {"munin": ensure => installed, } include concat::setup - Concat::Fragment <<| tag == 'munin' |>> + Concat::Fragment <<| tag == $export_tag |>> concat::fragment{'munin.conf.header': target => '/etc/munin/munin.conf', diff --git a/manifests/register.pp b/manifests/register.pp index 6c154e5..309c322 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -3,15 +3,16 @@ define munin::register ( $port = '4949', $use_ssh = false, $description = 'absent', - $config = [] + $config = [], + $export_tag = 'munin' ) { $fhost = $name $client_type = 'client' @@concat::fragment{ "munin_client_${fhost}_${port}": - target => '/etc/munin/munin.conf', + target => '/etc/munin/munin.conf', content => template("munin/client.erb"), - tag => 'munin', + tag => $export_tag, } } -- cgit v1.2.3 From e822d6140b1ffea7d85546062376a7e464a3cb61 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 20 Mar 2013 12:01:14 +0100 Subject: Security: plugin-config should not me world readable as it might contain passwords --- manifests/plugin.pp | 2 +- manifests/plugins/setup.pp | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'manifests') diff --git a/manifests/plugin.pp b/manifests/plugin.pp index e9e5dba..36fc81b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -47,7 +47,7 @@ define munin::plugin ( content => "[${name}]\n${config}\n", owner => root, group => 0, - mode => '0644', + mode => '0640', } } } diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index caf2e28..5c56099 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,15 +1,22 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - ignore => 'snmp_*', - ensure => directory, checksum => mtime, - recurse => true, purge => true, force => true, - mode => 0755, owner => root, group => 0, - notify => Service['munin-node']; + ignore => 'snmp_*', + ensure => directory, + checksum => mtime, + recurse => true, + purge => true, + force => true, + notify => Service['munin-node'], + owner => root, + group => 0, + mode => '0755'; '/etc/munin/plugin-conf.d/munin-node': - ensure => present, - mode => 0644, owner => root, group => 0, - notify => Service['munin-node'], + ensure => present, + notify => Service['munin-node'], + owner => root, + group => 0, + mode => '0640'; } case $::kernel { openbsd: { -- cgit v1.2.3