diff options
-rw-r--r-- | README | 24 | ||||
-rw-r--r-- | files/config/host/logrotate.Debian | 35 | ||||
-rw-r--r-- | manifests/client/base.pp | 1 | ||||
-rw-r--r-- | manifests/client/darwin.pp | 1 | ||||
-rw-r--r-- | manifests/client/debian.pp | 1 | ||||
-rw-r--r-- | manifests/client/gentoo.pp | 1 | ||||
-rw-r--r-- | manifests/client/openbsd.pp | 2 | ||||
-rw-r--r-- | manifests/client/package.pp | 20 | ||||
-rw-r--r-- | manifests/host.pp | 60 | ||||
-rw-r--r-- | manifests/host/cgi.pp | 34 | ||||
-rw-r--r-- | manifests/plugin.pp | 3 | ||||
-rw-r--r-- | manifests/plugin/deploy.pp | 70 | ||||
-rw-r--r-- | manifests/plugins/centos.pp | 3 | ||||
-rw-r--r--[l---------] | templates/munin-node.conf.Debian.lenny | 40 | ||||
l--------- | templates/munin-node.conf.Debian.sid | 2 | ||||
l--------- | templates/munin-node.conf.Debian.squeeze | 1 | ||||
-rw-r--r-- | templates/site.conf | 9 |
17 files changed, 220 insertions, 87 deletions
@@ -45,21 +45,35 @@ To use this module, follow these directions: d. Add to the top of your site.pp a variable which indicates what IP should be allowed to connect to your individual munin-nodes (this is typically your main munin host's IP): - $munin_allow = '192.168.0.1' - - If you want to define more than one host, you can seperate them by colon: + $munin_cidr_allow = '192.168.0.1/32' + + You can also put an array there. - $munin_allow = '127.0.0.1:192.168.0.1' + On pre-lenny systems, you have to use the older Regexp-variant: + + $munin_allow = '^192\.168\.0\.1$' e. In the node definition in your site.pp for your main munin host, add the following: include munin::host + + If you want to specify a particular package version for the main munin + host, you can set the $munin_ensure_version variable _before_ the above + include, like this + + $munin_ensure_version = "1.2.6-17" f. On each node that will gather munin statistics, add this line to that node's entry in site.pp (you may want to also add this to your main munin host): include munin::client + If you want to specify a particular package version for the munin + client, you can set the $munin_node_ensure_version variable _before_ the + above include, like this + + $munin_node_ensure_version = "1.2.6-17" + g. If there are particular munin plugins you want to enable or configure, you define them in the node definition, like follows: @@ -69,7 +83,7 @@ To use this module, follow these directions: # Use a non-standard plugin path to use custom plugins munin::plugin { "spamassassin": ensure => "spamassassin", - script_path => "/usr/local/share/munin-plugins", + script_path_in => "/usr/local/share/munin-plugins", } # Use a special config to pass parameters to the plugin diff --git a/files/config/host/logrotate.Debian b/files/config/host/logrotate.Debian new file mode 100644 index 0000000..732c871 --- /dev/null +++ b/files/config/host/logrotate.Debian @@ -0,0 +1,35 @@ +/var/log/munin/munin-update.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-graph.log { + daily + missingok + rotate 7 + compress + notifempty + create 660 munin www-data +} + +/var/log/munin/munin-html.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 17387e8..7c2adc2 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,4 +1,5 @@ class munin::client::base { + service { 'munin-node': ensure => running, enable => true, diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index 369a605..9cfe7e9 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,4 +1,5 @@ class munin::client::darwin { + file { "/usr/share/snmp/snmpd.conf": mode => 744, content => template("munin/darwin_snmpd.conf.erb"), diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 97f5fbf..7c56788 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,4 +1,5 @@ class munin::client::debian inherits munin::client::package { + # the plugin will need that package { "iproute": ensure => installed } diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index c24d317..d4fe71e 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,4 +1,5 @@ class munin::client::gentoo inherits munin::client::package { + Package['munin-node'] { name => 'munin', category => 'net-analyzer', diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 7012c00..89b5752 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,6 +1,8 @@ # 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", diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 18566b8..0ee7443 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,11 +1,21 @@ class munin::client::package inherits munin::client::base { - package { 'munin-node': ensure => installed } + + if $munin_node_ensure_version == '' { $munin_node_ensure_version = 'installed' } + + if $operatingsystem == "Debian" and $lsbdistcodename != "lenny" { + package { 'munin-common': + before => Package['munin-node'], + ensure => $munin_node_ensure_version; + } + + package { 'munin-node': ensure => $munin_node_ensure_version } Service['munin-node']{ - require => Package[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'], + # 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 e038fd7..cf445ce 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -4,42 +4,44 @@ class munin::host inherits munin { - package {"munin": ensure => installed, } - File <<| 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; - } - - concatenated_file { "/etc/munin/munin.conf": - dir => '/var/lib/puppet/modules/munin/nodes', - 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 { - centos: { include munin::host::cgi } - } + if $munin_ensure_version == '' { $munin_ensure_version = 'installed' } + + package {"munin": ensure => $munin_ensure_version, } + + File <<| 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'], + + concatenated_file { "/etc/munin/munin.conf": + dir => '/var/lib/puppet/modules/munin/nodes', + 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 { + centos: { include munin::host::cgi } + } # from time to time we cleanup hanging munin-runs file{'/etc/cron.d/munin_kill': content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n", owner => root, group => 0, mode => 0644; } + if $use_shorewall { include shorewall::rules::out::munin } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 6fd50df..cbf1052 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,16 +1,28 @@ -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 {} \;', +class munin::host::cgi inherits munin::host { + + case $operatingsystem { + debian: { + exec { 'set_modes_for_cgi': + command => 'chgrp www-data /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/munin/* -maxdepth 1 -type d -exec chgrp -R www-data {} \; && find /var/www/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', refreshonly => true, subscribe => File['/etc/munin/munin.conf.header'], + } } - - 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; + default: { + 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; + } } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 52c77c2..a0989a8 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -8,7 +8,7 @@ define munin::plugin ( $ensure = "present", $script_path_in = '', - $config = '') + $config = '' ) { include munin::plugin::scriptpaths $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in } @@ -64,3 +64,4 @@ define munin::plugin ( } } } + diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 67cbfb8..0ab4e9f 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,37 +1,39 @@ -define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { - $plugin_src = $ensure ? { - 'present' => $name, - 'absent' => $name, - default => $ensure - } - $real_source = $source ? { - '' => "munin/plugins/$plugin_src", - default => $source - } - include munin::plugin::scriptpaths - file { "munin_plugin_${name}": - path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet:///modules/$real_source", - mode => 0755, owner => root, group => 0; - } +define munin::plugin::deploy( $source = '', $ensure = 'present', $config = '' ) +{ + $plugin_src = $ensure ? { + 'present' => $name, + 'absent' => $name, + default => $ensure + } + + $real_source = $source ? { + '' => "munin/plugins/$plugin_src", + default => $source + } + + include munin::plugin::scriptpaths + + file { "munin_plugin_${name}": + path => "$munin::plugin::scriptpaths::script_path/${name}", + source => "puppet://$server/modules/$real_source", + mode => 0755, owner => root, group => 0; + } - case $kernel { - openbsd: { $basic_require = File['/var/run/munin'] } - default: { $basic_require = Package['munin-node'] } - } - if $require { - File["munin_plugin_${name}"]{ - require => [ $basic_require, $require ], - } - } else { - File["munin_plugin_${name}"]{ - require => $basic_require, - } - } - # register the plugin - if $require { - munin::plugin{$name: ensure => $ensure, config => $config, require => $require } - } else { - munin::plugin{$name: ensure => $ensure, config => $config } + case $kernel { + openbsd: { $basic_require = File['/var/run/munin'] } + default: { $basic_require = Package['munin-node'] } + } + + if $require { File["munin_plugin_${name}"]{ require => [ $basic_require, $require ] } } + else { + File["munin_plugin_${name}"]{ + require => $basic_require, } + } + + # register the plugin + if $require { munin::plugin{$name: ensure => $ensure, config => $config, require => $require } } + else { + munin::plugin{$name: ensure => $ensure, config => $config } + } } diff --git a/manifests/plugins/centos.pp b/manifests/plugins/centos.pp new file mode 100644 index 0000000..60c706c --- /dev/null +++ b/manifests/plugins/centos.pp @@ -0,0 +1,3 @@ +class munin::plugins::centos inherits munin::plugins::base { + munin::plugin { users: ensure => present; } +} diff --git a/templates/munin-node.conf.Debian.lenny b/templates/munin-node.conf.Debian.lenny index e0646b9..56da89d 120000..100644 --- a/templates/munin-node.conf.Debian.lenny +++ b/templates/munin-node.conf.Debian.lenny @@ -1 +1,39 @@ -munin-node.conf.Debian.etch
\ No newline at end of file +########## +########## Managed by puppet +########## + +log_level 4 +log_file /var/log/munin/munin-node.log +pid_file /var/run/munin/munin-node.pid +background 1 +setseid 1 + +# Which host/port to bind to; +host <%= munin_host_real %> +port <%= munin_port_real %> +user root +group root +setsid yes + +# Regexps for files to ignore + +ignore_file ~$ +ignore_file \.bak$ +ignore_file %$ +ignore_file \.dpkg-(tmp|new|old|dist)$ +ignore_file \.rpm(save|new)$ + +# Set this if the client doesn't report the correct hostname when +# telnetting to localhost, port 4949 +# +#host_name localhost.localdomain +host_name <%= fqdn %> + +# A list of addresses that are allowed to connect. This must be a +# regular expression, due to brain damage in Net::Server, which +# doesn't understand CIDR-style network notation. You may repeat +# the allow line as many times as you'd like +<% real_munin_allow.split(':').each do |val| -%> +allow <%= '^'+val.gsub(/\./, '\.')+'$' %> +<% end -%> + diff --git a/templates/munin-node.conf.Debian.sid b/templates/munin-node.conf.Debian.sid index e0646b9..6b8d690 120000 --- a/templates/munin-node.conf.Debian.sid +++ b/templates/munin-node.conf.Debian.sid @@ -1 +1 @@ -munin-node.conf.Debian.etch
\ No newline at end of file +munin-node.conf.Debian.lenny
\ No newline at end of file diff --git a/templates/munin-node.conf.Debian.squeeze b/templates/munin-node.conf.Debian.squeeze new file mode 120000 index 0000000..6b8d690 --- /dev/null +++ b/templates/munin-node.conf.Debian.squeeze @@ -0,0 +1 @@ +munin-node.conf.Debian.lenny
\ No newline at end of file diff --git a/templates/site.conf b/templates/site.conf new file mode 100644 index 0000000..549437c --- /dev/null +++ b/templates/site.conf @@ -0,0 +1,9 @@ +<VirtualHost *> + ServerName <%= name %> + DocumentRoot /var/www/munin/ + <Location /> + order allow,deny + Allow from all + </Location> +</VirtualHost> + |