summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--.rspec2
-rw-r--r--.travis.yml13
-rw-r--r--Gemfile21
-rw-r--r--Puppetfile5
-rw-r--r--README83
-rw-r--r--README.md140
-rw-r--r--Rakefile27
-rw-r--r--files/config/host/logrotate.Debian35
-rw-r--r--files/config/host/munin.conf.header.Debian.squeeze75
-rw-r--r--files/config/host/munin.conf.header.Debian.wheezy75
-rw-r--r--files/config/host/munin.conf.header.Gentoo145
-rw-r--r--files/config/host/munin.conf.header.RedHat143
-rw-r--r--files/config/host/munin.conf.header.Ubuntu (renamed from files/config/host/munin.conf.header.Debian.sid)0
-rw-r--r--files/empty/.ignore1
-rw-r--r--files/modules_dir/.ignore0
-rw-r--r--files/openbsd/package/munin_openbsd.tar.gzbin116174 -> 0 bytes
-rw-r--r--lib/facter/acpi_available.rb2
-rw-r--r--manifests/client.pp23
-rw-r--r--manifests/client/base.pp48
-rw-r--r--manifests/client/centos.pp3
-rw-r--r--manifests/client/darwin.pp29
-rw-r--r--manifests/client/debian.pp14
-rw-r--r--manifests/client/gentoo.pp6
-rw-r--r--manifests/client/openbsd.pp46
-rw-r--r--manifests/client/package.pp12
-rw-r--r--manifests/client/params.pp19
-rw-r--r--manifests/host.pp41
-rw-r--r--manifests/host/cgi.pp30
-rw-r--r--manifests/init.pp40
-rw-r--r--manifests/plugin.pp74
-rw-r--r--manifests/plugin/deploy.pp16
-rw-r--r--manifests/plugin/scriptpaths.pp14
-rw-r--r--manifests/plugins/base.pp16
-rw-r--r--manifests/plugins/centos.pp3
-rw-r--r--manifests/plugins/debian.pp1
-rw-r--r--manifests/plugins/djbdns.pp5
-rw-r--r--manifests/plugins/dom0.pp1
-rw-r--r--manifests/plugins/gentoo.pp3
-rw-r--r--manifests/plugins/interfaces.pp30
-rw-r--r--manifests/plugins/kvm.pp1
-rw-r--r--manifests/plugins/linux.pp8
-rw-r--r--manifests/plugins/muninhost.pp3
-rw-r--r--manifests/plugins/openbsd.pp5
-rw-r--r--manifests/plugins/physical.pp6
-rw-r--r--manifests/plugins/selinux.pp1
-rw-r--r--manifests/plugins/setup.pp21
-rw-r--r--manifests/plugins/vserver.pp4
-rw-r--r--manifests/register.pp16
-rw-r--r--manifests/register/snmp.pp19
-rw-r--r--manifests/remoteplugin.pp19
-rw-r--r--manifests/snmp_collector.pp23
-rw-r--r--metadata.json16
-rw-r--r--spec/classes/munin_client_base_spec.rb86
-rw-r--r--spec/classes/munin_client_spec.rb50
-rw-r--r--spec/classes/munin_host_cgi_spec.rb57
-rw-r--r--spec/classes/munin_host_spec.rb47
-rw-r--r--spec/classes/munin_plugins_interfaces_spec.rb44
-rw-r--r--spec/defines/munin_plugin_spec.rb57
-rw-r--r--spec/spec_helper.rb11
-rw-r--r--spec/spec_helper_system.rb27
-rw-r--r--templates/client.erb26
-rw-r--r--templates/logrotate.conf.erb (renamed from files/config/host/logrotate.CentOS)2
l---------templates/munin-node.conf.CentOS1
l---------templates/munin-node.conf.CentOS.1
l---------templates/munin-node.conf.CentOS.51
l---------templates/munin-node.conf.Debian1
-rw-r--r--templates/munin-node.conf.Debian.etch39
l---------templates/munin-node.conf.Debian.feisty1
l---------templates/munin-node.conf.Debian.gutsy1
l---------templates/munin-node.conf.Debian.hardy1
-rw-r--r--templates/munin-node.conf.Debian.lenny39
l---------templates/munin-node.conf.Debian.lucid1
l---------templates/munin-node.conf.Debian.sarge1
l---------templates/munin-node.conf.Debian.sid1
l---------templates/munin-node.conf.Debian.squeeze1
-rw-r--r--templates/munin-node.conf.Debian.wheezy57
l---------templates/munin-node.conf.Gentoo1
l---------templates/munin-node.conf.Gentoo.1
-rw-r--r--templates/munin-node.conf.OpenBSD59
-rw-r--r--templates/munin-node.conf.Ubuntu39
l---------templates/munin-node.conf.Ubuntu.precise1
l---------templates/munin-node.conf.Ubuntu.quantal1
-rw-r--r--templates/munin-node.conf.erb (renamed from templates/munin-node.conf.default)33
-rw-r--r--templates/site.conf9
85 files changed, 1241 insertions, 845 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7df6248
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+spec/fixtures/
+vendor/
+.tmp/*
+.librarian/*
+*.lock
+pkg/
diff --git a/.rspec b/.rspec
new file mode 100644
index 0000000..8c18f1a
--- /dev/null
+++ b/.rspec
@@ -0,0 +1,2 @@
+--format documentation
+--color
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..4b26c23
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,13 @@
+rvm:
+ - 1.8.7
+ - 1.9.3
+ - 2.0.0
+script: 'bundle exec rake spec'
+env:
+ - PUPPET_VERSION=2.7.25
+ - PUPPET_VERSION=3.4.2
+matrix:
+ exclude:
+ # No support for Ruby 2.0 before Puppet 3.2
+ - rvm: 2.0.0
+ env: PUPPET_VERSION=2.7.25
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..a6b52f0
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,21 @@
+source 'https://rubygems.org'
+
+if ENV.key?('PUPPET_VERSION')
+ puppetversion = "~> #{ENV['PUPPET_VERSION']}"
+else
+ puppetversion = ['>= 2.6']
+end
+
+if RUBY_VERSION == '1.8.7'
+ gem 'activesupport', '~> 3.2'
+ gem 'librarian-puppet', '~> 1.0.0'
+else
+ gem 'librarian-puppet', '>=0.9.10'
+end
+gem 'puppet', puppetversion
+gem 'puppet-lint', '>=0.3.2'
+gem 'puppetlabs_spec_helper', '>=0.2.0'
+gem 'rake', '>=0.9.2.2'
+gem 'rspec-system-puppet', :require => false
+gem 'serverspec', :require => false
+gem 'rspec-system-serverspec', :require => false
diff --git a/Puppetfile b/Puppetfile
new file mode 100644
index 0000000..3e03b30
--- /dev/null
+++ b/Puppetfile
@@ -0,0 +1,5 @@
+forge 'https://forge.puppetlabs.com'
+
+mod 'puppetlabs/stdlib', '>=3.2.0'
+mod 'puppetlabs/concat', '>=1.0.0'
+mod 'duritong/openbsd', '>=0.0.1'
diff --git a/README b/README
deleted file mode 100644
index ef3c2fd..0000000
--- a/README
+++ /dev/null
@@ -1,83 +0,0 @@
-== Munin ==
-
-Munin is a performance monitoring system which creates nice RRD graphs and has
-a very easy plugin interface. The munin homepage is http://munin.projects.linpro.no/
-
-To use this module, follow these directions:
-
-0. This module requires puppet 2.7 or newer.
-
-1. Install the "common", "concat" and "stdlib" modules -- the munin module
- depends on functions that are defined and installed via these modules.
-
-2. You will need storedconfigs enabled in your puppet setup, to do that you need to
- add a line to your puppet.conf in your [puppetmasterd] section which says:
-
- storeconfigs=true
-
- You may wish to immediately setup a mysql/pgsql database for your storedconfigs, as
- the default method uses sqlite, and is not very efficient, to do that you need lines
- such as the following below the storeconfigs=true line (adjust as needed):
-
- dbadapter=mysql
- dbserver=localhost
- dbuser=puppet
- dbpassword=puppetspasswd
-
-3. Install the "munin" module:
-
- a. Your modules directory will need all the files included in this repository placed
- under a directory called "munin"
-
- b. For every host you wish to gather munin statistics, add the class munin::client to that
- node. You will want to set the class parameter 'allow' to be the IP(s) of the munin
- collector, this defines what IP is permitted to connect to the node, for example:
-
- node foo {
- class { 'munin::client': allow => '192.168.0.1'}
- }
-
- for multiple munin nodes, you can pass an array:
-
- class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] }
-
- c. In the node definition in your site.pp for your main munin host, add the following:
-
- class { 'munin::host': }
-
- If you want cgi graphing you can pass cgi_graphing => true.
- (For CentOS this is enabled in the default header config)
- for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto
-
- d. If there are particular munin plugins you want to enable or configure, you define them
- in the node definition, like follows:
-
- # Enable monitoring of disk stats in bytes
- munin::plugin { 'df_abs': }
-
- # Use a non-standard plugin path to use custom plugins
- munin::plugin { 'spamassassin':
- ensure => present,
- script_path => '/usr/local/share/munin-plugins',
- }
-
- # For wildcard plugins (eg. ip_, snmp_, etc.), use the name variable to
- # configure the plugin name, and the ensure parameter to indicate the base
- # plugin name to which you want a symlink, for example:
- munin::plugin { [ 'ip_192.168.0.1', 'ip_10.0.0.1' ]:
- ensure => 'ip_'
- }
-
- # Use a special config to pass parameters to the plugin
- munin::plugin {
- [ 'apache_accesses', 'apache_processes', 'apache_volume' ]:
- ensure => present,
- config => 'env.url http://127.0.0.1:80/server-status?auto'
- }
-
- e. If you have Linux-Vservers configured, you will likely have multiple munin-node processes
- competing for the default port 4949, for those nodes, set an alternate port for munin-node
- to run on by putting something similar to the following class parameter:
-
- class { 'munin::client': allow => '192.168.0.1', port => '4948' }
-
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..db6af95
--- /dev/null
+++ b/README.md
@@ -0,0 +1,140 @@
+# Puppet-Munin
+
+[![Build Status](https://travis-ci.org/duritong/puppet-munin.png?branch=master)](https://travis-ci.org/duritong/puppet-munin)
+
+Munin is a performance monitoring system which creates nice RRD graphs and has
+a very easy plugin interface. The munin homepage is http://munin.projects.linpro.no/
+
+## Requirements
+
+ * puppet 2.7 or newer
+ * install the `concat` and `stdlib` modules - the munin module depends on functions that are defined and installed via these modules
+ * you will need storedconfigs enabled in your puppet setup, to do that you need to add a line to your `puppet.conf` in your `[puppetmasterd]` section which says:
+
+ storeconfigs=true
+
+ * You may wish to immediately setup a `mysql`/ `pgsql` database for your storedconfigs, as
+ the default method uses sqlite, and is not very efficient, to do that you need lines
+ such as the following below the `storeconfigs=true` line (adjust as needed):
+
+ dbadapter=mysql
+ dbserver=localhost
+ dbuser=puppet
+ dbpassword=puppetspasswd
+
+## Usage
+
+Your modules directory will need all the files included in this repository placed under a directory called `munin`.
+
+### Master configuration
+
+To install a master (or server) you need to flip one argument to true in the main class:
+
+ class { 'munin': is_server => true }
+
+If you want cgi graphing you can pass `cgi_graphing => true`. (For CentOS this is enabled in the default header config) for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto
+
+### Client configuration
+
+For every host you wish to gather munin statistics, add the class `munin` to that
+node. You will want to set the class parameter `allow` to be the IP(s) of the munin
+collector, this defines what IP is permitted to connect to the node, for example:
+
+ node foo {
+ class { 'munin': allow => '192.168.0.1'}
+ }
+
+for multiple munin collectors, you can pass an array:
+
+ class { 'munin': allow => [ '192.168.0.1', '10.0.0.1' ] }
+
+### Local plugins
+
+If there are particular munin plugins you want to enable or configure, you define them
+in the node definition, like follows:
+
+ # Enable monitoring of disk stats in bytes
+ munin::plugin { 'df_abs': }
+
+ # Use a non-standard plugin path to use custom plugins
+ munin::plugin { 'spamassassin':
+ ensure => present,
+ script_path_in => '/usr/local/share/munin-plugins',
+ }
+
+ # For wildcard plugins (eg. ip_, snmp_, etc.), use the name variable to
+ # configure the plugin name, and the ensure parameter to indicate the base
+ # plugin name to which you want a symlink, for example:
+ munin::plugin { [ 'ip_192.168.0.1', 'ip_10.0.0.1' ]:
+ ensure => 'ip_'
+ }
+
+ # Use a special config to pass parameters to the plugin
+ munin::plugin {
+ [ 'apache_accesses', 'apache_processes', 'apache_volume' ]:
+ ensure => present,
+ config => 'env.url http://127.0.0.1:80/server-status?auto'
+ }
+
+Note: The plugin must be installed at the client. For listing available plugins run as root `munin-node-configure --suggest`
+
+### External plugins
+
+For deploying plugins which are not available at client, you can fetch them from puppet
+master using `munin::plugin::deploy`.
+
+ munin::plugin::deploy { 'redis':
+ source => 'munin/plugins/redis/redis_',
+ config => '' # pass parameters to plugin
+ }
+
+In this example the file on master would be located in:
+
+ {modulepath}/munin/files/plugins/redis/redis_
+
+Module path is specified in `puppet.conf`, you can find out your `{modulepath}` easily by tying
+in console `puppet config print modulepath`.
+
+
+### Multiple munin collectors
+
+If some part of your infrastructure should be graphed by one munin collector,
+and another part by a second collector, you can use the parameter $export_tag
+to the main class to differentiate which clients and collectors are associated.
+
+For example, here are four nodes: two collectors and two clients. Each
+collector is associated with one client:
+
+ node coll1 {
+ class { 'munin':
+ $is_server => true,
+ $export_tag => 'coll1',
+ }
+ }
+
+ node client1 {
+ class { 'munin':
+ $export_tag => 'coll1',
+ }
+ }
+
+ node coll2 {
+ class { 'munin':
+ $is_server => true,
+ $export_tag => 'coll2',
+ }
+ }
+
+ node client2 {
+ class { 'munin':
+ $export_tag => 'coll2',
+ }
+ }
+
+### Multiple munin-node instances with Linux-VServer
+
+If you have Linux-Vservers configured, you will likely have multiple munin-node processes
+competing for the default port 4949, for those nodes, set an alternate port for munin-node
+to run on by putting something similar to the following class parameter:
+
+ class { 'munin': allow => '192.168.0.1', port => '4948' }
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..f3c7f29
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,27 @@
+require 'bundler'
+Bundler.require(:rake)
+
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
+require 'rspec-system/rake_task'
+
+Rake::Task[:lint].clear
+PuppetLint::RakeTask.new :lint do |config|
+ config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
+ config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
+ config.disable_checks = [ "class_inherits_from_params_class", "80chars" ]
+end
+
+# use librarian-puppet to manage fixtures instead of .fixtures.yml
+# offers more possibilities like explicit version management, forge downloads,...
+task :librarian_spec_prep do
+ sh "librarian-puppet install --path=spec/fixtures/modules/"
+ pwd = `pwd`.strip
+ unless File.directory?("#{pwd}/spec/fixtures/modules/munin")
+ sh "ln -s #{pwd} #{pwd}/spec/fixtures/modules/munin"
+ end
+end
+task :spec_prep => :librarian_spec_prep
+
+
+task :default => [:spec, :lint]
diff --git a/files/config/host/logrotate.Debian b/files/config/host/logrotate.Debian
deleted file mode 100644
index 732c871..0000000
--- a/files/config/host/logrotate.Debian
+++ /dev/null
@@ -1,35 +0,0 @@
-/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/files/config/host/munin.conf.header.Debian.squeeze b/files/config/host/munin.conf.header.Debian.squeeze
deleted file mode 100644
index 771d50d..0000000
--- a/files/config/host/munin.conf.header.Debian.squeeze
+++ /dev/null
@@ -1,75 +0,0 @@
-# Example configuration file for Munin, generated by 'make build'
-
-# The next three variables specifies where the location of the RRD
-# databases, the HTML output, and the logs, severally. They all
-# must be writable by the user running munin-cron.
-dbdir /var/lib/munin
-htmldir /var/cache/munin/www
-logdir /var/log/munin
-rundir /var/run/munin
-
-# Where to look for the HTML templates
-tmpldir /etc/munin/templates
-
-# Make graphs show values per minute instead of per second
-#graph_period minute
-
-# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
-# something changes (OK -> WARNING, CRITICAL -> OK, etc)
-#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
-#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
-#
-# For those with Nagios, the following might come in handy. In addition,
-# the services must be defined in the Nagios server as well.
-#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
-
-#contacts me
-#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root
-#contact.me.always_send warning critical
-
-# a simple host tree
-#[localhost]
-# address 127.0.0.1
-# use_node_name yes
-
-#
-# A more complex example of a host tree
-#
-## First our "normal" host.
-# [fii.foo.com]
-# address foo
-#
-## Then our other host...
-# [fay.foo.com]
-# address fay
-#
-## Then we want totals...
-# [foo.com;Totals] #Force it into the "foo.com"-domain...
-# update no # Turn off data-fetching for this "host".
-#
-# # The graph "load1". We want to see the loads of both machines...
-# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
-# load1.graph_title Loads side by side
-# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
-#
-# # The graph "load2". Now we want them stacked on top of each other.
-# load2.graph_title Loads on top of each other
-# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
-# load2.dummy_field.draw AREA # We want area instead the default LINE2.
-# load2.dummy_field.label dummy # This is needed. Silly, really.
-#
-# # The graph "load3". Now we want them summarised into one field
-# load3.graph_title Loads summarised
-# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
-# load3.combined_loads.label Combined loads # Must be set, as this is
-# # not a dummy field!
-#
-## ...and on a side note, I want them listen in another order (default is
-## alphabetically)
-#
-# # Since [foo.com] would be interpreted as a host in the domain "com", we
-# # specify that this is a domain by adding a semicolon.
-# [foo.com;]
-# node_order Totals fii.foo.com fay.foo.com
-#
-
diff --git a/files/config/host/munin.conf.header.Debian.wheezy b/files/config/host/munin.conf.header.Debian.wheezy
deleted file mode 100644
index 771d50d..0000000
--- a/files/config/host/munin.conf.header.Debian.wheezy
+++ /dev/null
@@ -1,75 +0,0 @@
-# Example configuration file for Munin, generated by 'make build'
-
-# The next three variables specifies where the location of the RRD
-# databases, the HTML output, and the logs, severally. They all
-# must be writable by the user running munin-cron.
-dbdir /var/lib/munin
-htmldir /var/cache/munin/www
-logdir /var/log/munin
-rundir /var/run/munin
-
-# Where to look for the HTML templates
-tmpldir /etc/munin/templates
-
-# Make graphs show values per minute instead of per second
-#graph_period minute
-
-# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
-# something changes (OK -> WARNING, CRITICAL -> OK, etc)
-#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
-#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
-#
-# For those with Nagios, the following might come in handy. In addition,
-# the services must be defined in the Nagios server as well.
-#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
-
-#contacts me
-#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root
-#contact.me.always_send warning critical
-
-# a simple host tree
-#[localhost]
-# address 127.0.0.1
-# use_node_name yes
-
-#
-# A more complex example of a host tree
-#
-## First our "normal" host.
-# [fii.foo.com]
-# address foo
-#
-## Then our other host...
-# [fay.foo.com]
-# address fay
-#
-## Then we want totals...
-# [foo.com;Totals] #Force it into the "foo.com"-domain...
-# update no # Turn off data-fetching for this "host".
-#
-# # The graph "load1". We want to see the loads of both machines...
-# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
-# load1.graph_title Loads side by side
-# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
-#
-# # The graph "load2". Now we want them stacked on top of each other.
-# load2.graph_title Loads on top of each other
-# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
-# load2.dummy_field.draw AREA # We want area instead the default LINE2.
-# load2.dummy_field.label dummy # This is needed. Silly, really.
-#
-# # The graph "load3". Now we want them summarised into one field
-# load3.graph_title Loads summarised
-# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
-# load3.combined_loads.label Combined loads # Must be set, as this is
-# # not a dummy field!
-#
-## ...and on a side note, I want them listen in another order (default is
-## alphabetically)
-#
-# # Since [foo.com] would be interpreted as a host in the domain "com", we
-# # specify that this is a domain by adding a semicolon.
-# [foo.com;]
-# node_order Totals fii.foo.com fay.foo.com
-#
-
diff --git a/files/config/host/munin.conf.header.Gentoo b/files/config/host/munin.conf.header.Gentoo
new file mode 100644
index 0000000..d2523df
--- /dev/null
+++ b/files/config/host/munin.conf.header.Gentoo
@@ -0,0 +1,145 @@
+# Example configuration file for Munin, generated by 'make build'
+
+# The next three variables specifies where the location of the RRD
+# databases, the HTML output, logs and the lock/pid files. They all
+# must be writable by the user running munin-cron. They are all
+# defaulted to the values you see here.
+#
+#dbdir /var/lib/munin
+#htmldir /var/www/localhost/htdocs/munin
+#logdir /var/log/munin
+#rundir /run/munin
+
+# Where to look for the HTML templates
+#
+#tmpldir /etc/munin/templates
+
+# Where to look for the static www files
+#
+#staticdir /etc/munin/static
+
+# temporary cgi files are here. note that it has to be writable by
+# the cgi user (usually nobody or httpd).
+#
+# cgitmpdir @@CGITMPDIR@@
+
+# (Exactly one) directory to include all files from.
+includedir /etc/munin/munin-conf.d
+
+# You can choose the time reference for "DERIVE" like graphs, and show
+# "per minute", "per hour" values instead of the default "per second"
+#
+#graph_period second
+
+# Graphics files are generated either via cron or by a CGI process.
+# See http://munin-monitoring.org/wiki/CgiHowto2 for more
+# documentation.
+# Since 2.0, munin-graph has been rewritten to use the cgi code.
+# It is single threaded *by design* now.
+#
+#graph_strategy cron
+
+# munin-cgi-graph is invoked by the web server up to very many times at the
+# same time. This is not optimal since it results in high CPU and memory
+# consumption to the degree that the system can thrash. Again the default is
+# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as
+# max_graph_jobs.
+#
+#munin_cgi_graph_jobs 6
+
+# If the automatic CGI url is wrong for your system override it here:
+#
+#cgiurl_graph /munin-cgi/munin-cgi-graph
+
+# max_size_x and max_size_y are the max size of images in pixel.
+# Default is 4000. Do not make it too large otherwise RRD might use all
+# RAM to generate the images.
+#
+#max_size_x 4000
+#max_size_y 4000
+
+# HTML files are normally generated by munin-html, no matter if the
+# files are used or not. You can change this to on-demand generation
+# by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2
+#
+# Notes:
+# - moving to CGI for HTML means you cannot have graph generated by cron.
+# - cgi html has some bugs, mostly you still have to launch munin-html by hand
+#
+#html_strategy cron
+
+# munin-update runs in parallel.
+#
+# The default max number of processes is 16, and is probably ok for you.
+#
+# If set too high, it might hit some process/ram/filedesc limits.
+# If set too low, munin-update might take more than 5 min.
+#
+# If you want munin-update to not be parallel set it to 0.
+#
+#max_processes 16
+
+# RRD updates are per default, performed directly on the rrd files.
+# To reduce IO and enable the use of the rrdcached, uncomment it and set it to
+# the location of the socket that rrdcached uses.
+#
+#rrdcached_socket /var/run/rrdcached.sock
+
+# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
+# something changes (OK -> WARNING, CRITICAL -> OK, etc)
+#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
+#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
+#
+# For those with Nagios, the following might come in handy. In addition,
+# the services must be defined in the Nagios server as well.
+#contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf
+
+# a simple host tree
+#[localhost]
+# address 127.0.0.1
+# use_node_name yes
+
+#
+# A more complex example of a host tree
+#
+## First our "normal" host.
+# [fii.foo.com]
+# address foo
+#
+## Then our other host...
+# [fay.foo.com]
+# address fay
+#
+## IPv6 host. note that the ip adress has to be in brackets
+# [ip6.foo.com]
+# address [2001::1234:1]
+#
+## Then we want totals...
+# [foo.com;Totals] #Force it into the "foo.com"-domain...
+# update no # Turn off data-fetching for this "host".
+#
+# # The graph "load1". We want to see the loads of both machines...
+# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
+# load1.graph_title Loads side by side
+# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+#
+# # The graph "load2". Now we want them stacked on top of each other.
+# load2.graph_title Loads on top of each other
+# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+# load2.dummy_field.draw AREA # We want area instead the default LINE2.
+# load2.dummy_field.label dummy # This is needed. Silly, really.
+#
+# # The graph "load3". Now we want them summarised into one field
+# load3.graph_title Loads summarised
+# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
+# load3.combined_loads.label Combined loads # Must be set, as this is
+# # not a dummy field!
+#
+## ...and on a side note, I want them listen in another order (default is
+## alphabetically)
+#
+# # Since [foo.com] would be interpreted as a host in the domain "com", we
+# # specify that this is a domain by adding a semicolon.
+# [foo.com;]
+# node_order Totals fii.foo.com fay.foo.com
+#
diff --git a/files/config/host/munin.conf.header.RedHat b/files/config/host/munin.conf.header.RedHat
new file mode 100644
index 0000000..f212ce0
--- /dev/null
+++ b/files/config/host/munin.conf.header.RedHat
@@ -0,0 +1,143 @@
+# Example configuration file for Munin, generated by 'make build'
+
+# The next three variables specifies where the location of the RRD
+# databases, the HTML output, logs and the lock/pid files. They all
+# must be writable by the user running munin-cron. They are all
+# defaulted to the values you see here.
+#
+#dbdir /var/lib/munin
+#htmldir /var/www/html/munin
+htmldir /var/www/html/munin
+#logdir /var/log/munin
+#rundir /var/run/munin
+
+# Where to look for the HTML templates
+#
+#tmpldir /etc/munin/templates
+
+# Where to look for the static www files
+#
+#staticdir /etc/munin/static
+
+# temporary cgi files are here. note that it has to be writable by
+# the cgi user (usually nobody or httpd).
+#
+# cgitmpdir /var/lib/munin/cgi-tmp
+
+# (Exactly one) directory to include all files from.
+includedir /etc/munin/conf.d
+
+# You can choose the time reference for "DERIVE" like graphs, and show
+# "per minute", "per hour" values instead of the default "per second"
+#
+#graph_period second
+
+# Graphics files are generated either via cron or by a CGI process.
+# See http://munin-monitoring.org/wiki/CgiHowto2 for more
+# documentation.
+# Since 2.0, munin-graph has been rewritten to use the cgi code.
+# It is single threaded *by design* now.
+#
+#graph_strategy cgi
+
+# munin-cgi-graph is invoked by the web server up to very many times at the
+# same time. This is not optimal since it results in high CPU and memory
+# consumption to the degree that the system can thrash. Again the default is
+# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as
+# max_graph_jobs.
+#
+#munin_cgi_graph_jobs 6
+
+# If the automatic CGI url is wrong for your system override it here:
+#
+#cgiurl_graph /munin-cgi/munin-cgi-graph
+
+# max_size_x and max_size_y are the max size of images in pixel.
+# Default is 4000. Do not make it too large otherwise RRD might use all
+# RAM to generate the images.
+#
+#max_size_x 4000
+#max_size_y 4000
+
+# HTML files are normally generated by munin-html, no matter if the
+# files are used or not. You can change this to on-demand generation
+# by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2
+#
+# Notes:
+# - moving to CGI for HTML means you cannot have graph generated by cron.
+# - cgi html has some bugs, mostly you still have to launch munin-html by hand
+#
+html_strategy cron
+
+# munin-update runs in parallel.
+#
+# The default max number of processes is 16, and is probably ok for you.
+#
+# If set too high, it might hit some process/ram/filedesc limits.
+# If set too low, munin-update might take more than 5 min.
+#
+# If you want munin-update to not be parallel set it to 0.
+#
+#max_processes 16
+
+# RRD updates are per default, performed directly on the rrd files.
+# To reduce IO and enable the use of the rrdcached, uncomment it and set it to
+# the location of the socket that rrdcached uses.
+#
+#rrdcached_socket /var/run/rrdcached.sock
+
+# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
+# something changes (OK -> WARNING, CRITICAL -> OK, etc)
+#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
+#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
+#
+# For those with Nagios, the following might come in handy. In addition,
+# the services must be defined in the Nagios server as well.
+#contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf
+
+# a simple host tree
+#[localhost]
+# address 127.0.0.1
+# use_node_name yes
+
+#
+# A more complex example of a host tree
+#
+## First our "normal" host.
+# [fii.foo.com]
+# address foo
+#
+## Then our other host...
+# [fay.foo.com]
+# address fay
+#
+## Then we want totals...
+# [foo.com;Totals] #Force it into the "foo.com"-domain...
+# update no # Turn off data-fetching for this "host".
+#
+# # The graph "load1". We want to see the loads of both machines...
+# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
+# load1.graph_title Loads side by side
+# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+#
+# # The graph "load2". Now we want them stacked on top of each other.
+# load2.graph_title Loads on top of each other
+# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+# load2.dummy_field.draw AREA # We want area instead the default LINE2.
+# load2.dummy_field.label dummy # This is needed. Silly, really.
+#
+# # The graph "load3". Now we want them summarised into one field
+# load3.graph_title Loads summarised
+# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
+# load3.combined_loads.label Combined loads # Must be set, as this is
+# # not a dummy field!
+#
+## ...and on a side note, I want them listen in another order (default is
+## alphabetically)
+#
+# # Since [foo.com] would be interpreted as a host in the domain "com", we
+# # specify that this is a domain by adding a semicolon.
+# [foo.com;]
+# node_order Totals fii.foo.com fay.foo.com
+#
+
diff --git a/files/config/host/munin.conf.header.Debian.sid b/files/config/host/munin.conf.header.Ubuntu
index 771d50d..771d50d 100644
--- a/files/config/host/munin.conf.header.Debian.sid
+++ b/files/config/host/munin.conf.header.Ubuntu
diff --git a/files/empty/.ignore b/files/empty/.ignore
deleted file mode 100644
index 91162ec..0000000
--- a/files/empty/.ignore
+++ /dev/null
@@ -1 +0,0 @@
-# just used for git
diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore
deleted file mode 100644
index e69de29..0000000
--- a/files/modules_dir/.ignore
+++ /dev/null
diff --git a/files/openbsd/package/munin_openbsd.tar.gz b/files/openbsd/package/munin_openbsd.tar.gz
deleted file mode 100644
index 17ace1d..0000000
--- a/files/openbsd/package/munin_openbsd.tar.gz
+++ /dev/null
Binary files differ
diff --git a/lib/facter/acpi_available.rb b/lib/facter/acpi_available.rb
index 9a0474f..dae057f 100644
--- a/lib/facter/acpi_available.rb
+++ b/lib/facter/acpi_available.rb
@@ -1,7 +1,7 @@
# return whether acpi is available -- used for deciding whether to install the munin plugin
Facter.add("acpi_available") do
setcode do
- if not File.exist? `which acpi 2>/dev/null`.chomp or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil?
+ if not Facter::Util::Resolution.which('acpi') or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil?
"absent"
else
"present"
diff --git a/manifests/client.pp b/manifests/client.pp
index 2316bc9..aca899a 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -1,30 +1,23 @@
-# client.pp - configure a munin node
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Adapted and improved by admin(at)immerda.ch
-class munin::client(
- $allow = [ '127.0.0.1' ],
- $host = '*',
- $port = '4949',
- $use_ssh = false,
- $manage_shorewall = false,
- $shorewall_collector_source = 'net',
- $export_tag = 'munin'
-) {
+# configure a munin node
+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 }
+ centos: { include munin::client::base }
default: { include munin::client::base }
}
- if $munin::client::manage_shorewall {
+ if $munin::manage_shorewall {
class{'shorewall::rules::munin':
- munin_port => $port,
- munin_collector => delete($allow,'127.0.0.1'),
- collector_source => $shorewall_collector_source,
+ munin_port => $munin::port,
+ munin_collector => delete($munin::allow,'127.0.0.1'),
+ collector_source => $munin::shorewall_collector_source,
}
}
}
diff --git a/manifests/client/base.pp b/manifests/client/base.pp
index 78398a9..8ee8b95 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -1,28 +1,44 @@
-class munin::client::base {
+# Install a basic munin client
+class munin::client::base inherits munin::client::params {
+ package { 'munin-node':
+ ensure => installed
+ }
service { 'munin-node':
- ensure => running,
- enable => true,
- hasstatus => true,
+ ensure => running,
+ enable => true,
+ hasstatus => true,
hasrestart => true,
+ require => Package[munin-node],
}
file {'/etc/munin':
ensure => directory,
- mode => 0755, owner => root, group => 0;
+ mode => '0755',
+ owner => root,
+ group => 0,
}
file {'/etc/munin/munin-node.conf':
- content => template("munin/munin-node.conf.${::operatingsystem}"),
- notify => Service['munin-node'],
- mode => 0644, owner => root, group => 0,
+ content => template("${module_name}/munin-node.conf.erb"),
+ # this has to be installed before the package, so the postinst can
+ # boot the munin-node without failure!
+ before => Package['munin-node'],
+ notify => Service['munin-node'],
+ mode => '0644',
+ owner => root,
+ group => 0,
+ }
+ $host = $munin::host ? {
+ '*' => $::fqdn,
+ default => $munin::host
}
munin::register { $::fqdn:
- 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'],
- export_tag => $munin::client::export_tag,
+ host => $host,
+ port => $munin::port,
+ use_ssh => $munin::use_ssh,
+ description => $munin::description,
+ group => $munin::munin_group,
+ config => [ 'use_node_name yes', 'load.load.warning 5',
+ 'load.load.critical 10'],
+ export_tag => $munin::export_tag,
}
include munin::plugins::base
}
diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp
deleted file mode 100644
index 3a7151b..0000000
--- a/manifests/client/centos.pp
+++ /dev/null
@@ -1,3 +0,0 @@
-class munin::client::centos inherits munin::client::package {
- include munin::plugins::centos
-}
diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp
index 264263d..7639896 100644
--- a/manifests/client/darwin.pp
+++ b/manifests/client/darwin.pp
@@ -1,21 +1,22 @@
+# Install a munin client on darwin
class munin::client::darwin {
- file { "/usr/share/snmp/snmpd.conf":
- mode => 744,
- content => template("munin/darwin_snmpd.conf.erb"),
- group => 0,
- owner => root,
+ file { '/usr/share/snmp/snmpd.conf':
+ mode => '0744',
+ content => template('munin/darwin_snmpd.conf.erb'),
+ group => 0,
+ owner => root,
}
- line{"startsnmpdno":
- file => "/etc/hostconfig",
- line => "SNMPSERVER=-NO-",
- ensure => 'absent',
+ line{'startsnmpdno':
+ ensure => absent,
+ file => '/etc/hostconfig',
+ line => 'SNMPSERVER=-NO-',
}
- line { "startsnmpdyes":
- file => "/etc/hostconfig",
- line => "SNMPSERVER=-YES-",
- notify => Exec["/sbin/SystemStarter start SNMP"],
+ line { 'startsnmpdyes':
+ file => '/etc/hostconfig',
+ line => 'SNMPSERVER=-YES-',
+ notify => Exec['/sbin/SystemStarter start SNMP'],
}
- exec{"/sbin/SystemStarter start SNMP":
+ exec{'/sbin/SystemStarter start SNMP':
noop => false,
}
munin::register::snmp { $::fqdn: }
diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp
index e67ac26..49ee567 100644
--- a/manifests/client/debian.pp
+++ b/manifests/client/debian.pp
@@ -1,15 +1,9 @@
-class munin::client::debian inherits munin::client::package {
+# Install the munin client on debian
+class munin::client::debian inherits munin::client::base {
# the plugin will need that
- package { "iproute": ensure => installed }
+ ensure_packages(['iproute'])
- 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 }
+ plugin { 'postfix_mailvolume': ensure => absent }
include munin::plugins::debian
}
diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp
index e79f6b0..263fecd 100644
--- a/manifests/client/gentoo.pp
+++ b/manifests/client/gentoo.pp
@@ -1,8 +1,8 @@
-class munin::client::gentoo inherits munin::client::package {
+# install a munin client on gentoo
+class munin::client::gentoo inherits munin::client::base {
Package['munin-node'] {
- name => 'munin',
- category => 'net-analyzer',
+ name => 'net-analyzer/munin',
}
include munin::plugins::gentoo
diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp
index cd21abf..09fb24f 100644
--- a/manifests/client/openbsd.pp
+++ b/manifests/client/openbsd.pp
@@ -1,60 +1,26 @@
-# currently we install munin on openbsd by targz
-# :(
-
+# generate a few missing things on openbsd
class munin::client::openbsd inherits munin::client::base {
- if $::operatingsystemrelease == '4.3' {
- file{'/usr/src/munin_openbsd.tar.gz':
- source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz",
- owner => root,
- group => 0,
- mode => '0600';
- }
- exec{'extract_openbsd':
- command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz',
- unless => 'test -d /opt/munin',
- require => File['/usr/src/munin_openbsd.tar.gz'],
- before => File['/var/run/munin'],
- }
- package{'p5-Compress-Zlib':
- ensure => installed,
- before => File['/var/run/munin'],
- }
- } else {
- package{'munin-node':
- ensure => installed,
- }
- }
- package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP',
- 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server',
- 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
- ensure => installed,
- before => File['/var/run/munin'],
- }
- file{[ '/var/run/munin', '/var/log/munin' ]:
+ file{[ '/var/run/munin', '/var/log/munin-node' ]:
ensure => directory,
owner => root,
group => 0,
mode => '0755';
}
- $bin_loc = $::operatingsystemrelease ? {
- '4.3' => '/opt/munin/sbin/munin-node',
- default => '/usr/local/sbin/munin-node'
- }
openbsd::rc_local{'munin-node':
- binary => $bin_loc,
+ binary => '/usr/local/sbin/munin-node',
require => File['/var/run/munin'],
}
Service['munin-node']{
restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
- start => $bin_loc,
+ start => '/usr/local/sbin/munin-node',
status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^ *$(cat /var/run/munin/munin-node.pid).*munin-node")',
hasstatus => true,
hasrestart => true,
- require => [ File['/var/run/munin'], File['/var/log/munin'] ],
+ require => [ File['/var/run/munin'], File['/var/log/munin-node'] ],
}
cron{'clean_munin_logfile':
- command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
+ command => 'rm /var/log/munin-node/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
minute => 0,
hour => 2,
weekday => 0,
diff --git a/manifests/client/package.pp b/manifests/client/package.pp
deleted file mode 100644
index 206ccc8..0000000
--- a/manifests/client/package.pp
+++ /dev/null
@@ -1,12 +0,0 @@
-class munin::client::package inherits munin::client::base {
- package { 'munin-node': ensure => installed }
- Service['munin-node']{
- require => Package[munin-node],
- }
- File['/etc/munin/munin-node.conf']{
- # this has to be installed before the package, so the postinst can
- # boot the munin-node without failure!
- before => Package['munin-node'],
- }
-}
-
diff --git a/manifests/client/params.pp b/manifests/client/params.pp
new file mode 100644
index 0000000..4473912
--- /dev/null
+++ b/manifests/client/params.pp
@@ -0,0 +1,19 @@
+# Set the parameters for the munin client
+class munin::client::params {
+ $user = 'root'
+
+ case $::osfamily {
+ 'OpenBSD': {
+ $group = '0'
+ $log_file = '/var/log/munin-node/munin-node.log'
+ }
+ 'Debian': {
+ $group = 'root'
+ $log_file = '/var/log/munin/munin-node.log'
+ }
+ default: {
+ $group = 'root'
+ $log_file = '/var/log/munin-node/munin-node.log'
+ }
+ }
+}
diff --git a/manifests/host.pp b/manifests/host.pp
index 05dcb5e..9831052 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -2,43 +2,46 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-class munin::host(
- $cgi_graphing = false,
- $export_tag = 'munin'
-) {
- package {"munin": ensure => installed, }
- include concat::setup
+class munin::host {
+
+ package {'munin': ensure => installed, }
Concat::Fragment <<| tag == $export_tag |>>
concat::fragment{'munin.conf.header':
target => '/etc/munin/munin.conf',
source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/munin.conf.header",
- "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}",
+ "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::operatingsystemmajrelease}",
"puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}",
- "puppet:///modules/site_munin/config/host/munin.conf.header",
- "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}",
+ 'puppet:///modules/site_munin/config/host/munin.conf.header',
+ "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::operatingsystemmajrelease}",
"puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}",
- "puppet:///modules/munin/config/host/munin.conf.header" ],
- order => 05,
+ 'puppet:///modules/munin/config/host/munin.conf.header' ],
+ order => 05,
}
- concat{ "/etc/munin/munin.conf":
- owner => root, group => 0, mode => 0644;
+ concat{ '/etc/munin/munin.conf':
+ owner => root,
+ group => 0,
+ mode => '0644',
}
include munin::plugins::muninhost
- if $munin::host::cgi_graphing {
- include munin::host::cgi
+ if $munin::cgi_graphing {
+ class {'munin::host::cgi':
+ owner => $munin::cgi_owner,
+ }
}
# from time to time we cleanup hanging munin-runs
- file{'/etc/cron.d/munin_kill':
- content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n",
- owner => root, group => 0, mode => 0644;
+ cron { 'munin_kill':
+ command => 'if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi',
+ minute => ['4', '34'],
+ user => 'root',
}
- if $munin::host::manage_shorewall {
+
+ if $munin::manage_shorewall {
include shorewall::rules::out::munin
}
}
diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp
index 0c11d32..9951a48 100644
--- a/manifests/host/cgi.pp
+++ b/manifests/host/cgi.pp
@@ -1,15 +1,27 @@
-class munin::host::cgi {
-
+# Set up a munin host using CGI rendering
+class munin::host::cgi(
+ $owner = 'os_default'
+) {
case $::operatingsystem {
debian,ubuntu: {
- $apache_user = 'www-data'
$document_root = '/var/www/munin'
}
default: {
- $apache_user = 'apache'
$document_root = '/var/www/html/munin'
}
}
+ if $owner == 'os_default' {
+ case $::operatingsystem {
+ debian,ubuntu: {
+ $apache_user = 'www-data'
+ }
+ default: {
+ $apache_user = 'apache'
+ }
+ }
+ } else {
+ $apache_user = $owner
+ }
exec{'set_modes_for_cgi':
command => "chgrp ${apache_user} /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find ${document_root}/* -maxdepth 1 -type d -exec chgrp -R ${apache_user} {} \; && find ${document_root}/* -maxdepth 1 -type d -exec chmod -R g+w {} \;",
@@ -18,11 +30,9 @@ class munin::host::cgi {
}
file{'/etc/logrotate.d/munin':
- source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/logrotate",
- "puppet:///modules/site_munin/config/host/logrotate.${::operatingsystem}",
- "puppet:///modules/site_munin/config/host/logrotate",
- "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}",
- "puppet:///modules/munin/config/host/logrotate" ],
- owner => root, group => 0, mode => 0644;
+ content => template("${module_name}/logrotate.conf.erb"),
+ owner => root,
+ group => 0,
+ mode => '0644',
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index b015521..bbabf2e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -4,7 +4,7 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
#
# Copyright 2008, Puzzle ITC GmbH
-# Marcel Härry haerry+puppet(at)puzzle.ch
+# Marcel Haerry haerry+puppet(at)puzzle.ch
# Simon Josi josi+puppet(at)puzzle.ch
#
# This program is free software; you can redistribute
@@ -12,5 +12,39 @@
# General Public License version 3 as published by
# the Free Software Foundation.
#
-# the port is a parameter so vservers can share
-# IP addresses and still be happy
+# Parameters:
+# $is_server - determines whether or not to install munin server. munin-node is
+# required for the server so it is always installed.
+# $export_tag - tag exported resources so that only the server targeted by that
+# tag will collect them. This can let you install multiple munin
+# servers.
+#
+# Client-specific parameters:
+# $allow, $host, $host_name, $port, $use_ssh, $manage_shorewall,
+# $shorewall_collector_source, $description, $munin_group
+#
+# Server-specific parameters:
+# $cgi_graphing, cgi_owner
+
+class munin (
+ $is_server = false,
+ $export_tag = 'munin',
+ $allow = [ '127.0.0.1' ],
+ $host = '*',
+ $host_name = $::fqdn,
+ $port = '4949',
+ $use_ssh = false,
+ $manage_shorewall = false,
+ $shorewall_collector_source = 'net',
+ $description = 'absent',
+ $munin_group = 'absent',
+ $cgi_graphing = false,
+ $cgi_owner = 'os_default',
+) {
+
+ include munin::client
+
+ if $is_server {
+ include munin::host
+ }
+}
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index ffe5452..50b861b 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -1,55 +1,43 @@
# configure a specific munin plugin
+#
+# We only manage the plugin if it is not set to absent.
+# A plugin (or its config) that should be removed should
+# be purged by the recursively managed plugins- or
+# config-directory. So we can safe a few resources being
+# managed.
define munin::plugin (
$ensure = 'present',
$script_path_in = '',
- $config = ''
+ $config = '',
) {
- include munin::plugin::scriptpaths
- $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
-
- $plugin_src = $ensure ? { 'present' => $name, default => $ensure }
- $plugin = "/etc/munin/plugins/${name}"
- $plugin_conf = "/etc/munin/plugin-conf.d/${name}.conf"
+ if $ensure != 'absent' {
+ include munin::plugin::scriptpaths
+ include munin::plugins::setup
+ $real_script_path = $script_path_in ? {
+ '' => $munin::plugin::scriptpaths::script_path,
+ default => $script_path_in
+ }
+ $plugin_src = $ensure ? {
+ 'present' => $name,
+ default => $ensure
+ }
- include munin::plugins::setup
- case $ensure {
- 'absent': {
- file { $plugin: ensure => absent, }
+ file { "/etc/munin/plugins/${name}":
+ ensure => link,
+ target =>"${real_script_path}/${plugin_src}",
+ notify => Service['munin-node'];
}
- default: {
- $dep = $::kernel ? {
- OpenBSD => File['/var/run/munin'],
- default => Package['munin-node']
- }
- file { $plugin:
- ensure => "${real_script_path}/${plugin_src}",
- require => $dep,
- notify => Service['munin-node'];
+ if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::operatingsystemmajrelease != '5')){
+ File["/etc/munin/plugins/${name}"]{
+ seltype => 'munin_etc_t',
}
- 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 }
}
- default: {
- case $ensure {
- absent: {
- file { $plugin_conf: ensure => absent }
- }
- default: {
- file { $plugin_conf:
- content => "[${name}]\n${config}\n",
- owner => root,
- group => 0,
- mode => '0640',
- }
- }
+ if !empty($config) {
+ file { "/etc/munin/plugin-conf.d/${name}.conf":
+ content => inline_template("[<%= @name %>]\n<%= Array(@config).join(\"\n\") %>\n"),
+ owner => root,
+ group => 0,
+ mode => '0640',
}
}
}
diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp
index cbf64fb..2ffd92e 100644
--- a/manifests/plugin/deploy.pp
+++ b/manifests/plugin/deploy.pp
@@ -3,7 +3,8 @@ define munin::plugin::deploy(
$ensure = 'present',
$source = '',
$config = '',
- $seltype = 'munin_exec_t'
+ $seltype = 'munin_unconfined_plugin_exec_t',
+ $register = true,
) {
$plugin_src = $ensure ? {
'present' => $name,
@@ -23,7 +24,7 @@ define munin::plugin::deploy(
mode => '0755';
}
- if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
+ if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::operatingsystemmajrelease > '5')){
File["munin_plugin_${name}"]{
seltype => $seltype,
}
@@ -36,9 +37,12 @@ define munin::plugin::deploy(
File["munin_plugin_${name}"]{
require => $basic_require,
}
- # register the plugin
- munin::plugin{$name:
- ensure => $ensure,
- config => $config
+
+ # register the plugin if required
+ if ($register) {
+ munin::plugin{$name:
+ ensure => $ensure,
+ config => $config
+ }
}
}
diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp
index 2cad97b..62dd77b 100644
--- a/manifests/plugin/scriptpaths.pp
+++ b/manifests/plugin/scriptpaths.pp
@@ -1,12 +1,10 @@
+# Determine the script path for each OS
class munin::plugin::scriptpaths {
case $::operatingsystem {
- gentoo: { $script_path = "/usr/libexec/munin/plugins" }
- debian: { $script_path = "/usr/share/munin/plugins" }
- centos: { $script_path = "/usr/share/munin/plugins" }
- openbsd: { $script_path = $::operatingsystemrelease ? {
- '4.3' => '/opt/munin/lib/plugins/',
- default => '/usr/local/libexec/munin/plugins/'
- } }
- default: { $script_path = "/usr/share/munin/plugins" }
+ gentoo: { $script_path = '/usr/libexec/munin/plugins' }
+ debian: { $script_path = '/usr/share/munin/plugins' }
+ centos: { $script_path = '/usr/share/munin/plugins' }
+ openbsd: { $script_path = '/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 c6b88ed..33cd84d 100644
--- a/manifests/plugins/base.pp
+++ b/manifests/plugins/base.pp
@@ -1,29 +1,33 @@
+# A basic set of plugins
class munin::plugins::base {
# setup basic plugins
munin::plugin {
- [ df, cpu, interrupts, load, memory, netstat, open_files,
- processes, swap, uptime, users, vmstat ]:
+ [ 'df', 'cpu', 'interrupts', 'load', 'memory', 'netstat', 'open_files',
+ 'processes', 'swap', 'uptime', 'users', 'vmstat' ]:
ensure => present,
}
file{'/etc/munin/plugin-conf.d/df':
content => "[df*]\nenv.exclude none unknown iso9660 squashfs udf romfs ramfs debugfs binfmt_misc rpc_pipefs fuse.gvfs-fuse-daemon\n",
- require => Munin::Plugin[df],
- owner => root, group => 0, mode => 0644;
+ require => Munin::Plugin['df'],
+ owner => 'root',
+ group => 0,
+ mode => '0644',
}
include munin::plugins::interfaces
case $::kernel {
openbsd: { include munin::plugins::openbsd }
linux: {
- case $vserver {
+ case $::vserver {
guest: { include munin::plugins::vserver }
default: { include munin::plugins::linux }
}
}
}
-
+
case $::virtual {
physical: { include munin::plugins::physical }
xen0: { include munin::plugins::dom0 }
+ default: { }
}
}
diff --git a/manifests/plugins/centos.pp b/manifests/plugins/centos.pp
deleted file mode 100644
index 60c706c..0000000
--- a/manifests/plugins/centos.pp
+++ /dev/null
@@ -1,3 +0,0 @@
-class munin::plugins::centos inherits munin::plugins::base {
- munin::plugin { users: ensure => present; }
-}
diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp
index f756150..efa922b 100644
--- a/manifests/plugins/debian.pp
+++ b/manifests/plugins/debian.pp
@@ -1 +1,2 @@
+# Debian specific plugins
class munin::plugins::debian { }
diff --git a/manifests/plugins/djbdns.pp b/manifests/plugins/djbdns.pp
index c0a5163..de3936b 100644
--- a/manifests/plugins/djbdns.pp
+++ b/manifests/plugins/djbdns.pp
@@ -1,3 +1,4 @@
-class munin::plugins::djbdns {
- munin::plugin::deploy { "tinydns": }
+# Set up the djbdns plugin
+class munin::plugins::djbdns {
+ munin::plugin::deploy { 'tinydns': }
}
diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp
index 44995fc..98aee1d 100644
--- a/manifests/plugins/dom0.pp
+++ b/manifests/plugins/dom0.pp
@@ -1,3 +1,4 @@
+# Set up plugins for a Xen dom0 host
class munin::plugins::dom0 {
munin::plugin::deploy {
[ 'xen', 'xen_cpu', 'xen_memory', 'xen_mem',
diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp
index 27d4689..36f2370 100644
--- a/manifests/plugins/gentoo.pp
+++ b/manifests/plugins/gentoo.pp
@@ -1,4 +1,5 @@
-class munin::plugins::gentoo {
+# Set up the plugins for a gentoo host
+class munin::plugins::gentoo {
munin::plugin::deploy { 'gentoo_lastupdated':
config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep"
}
diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp
index c57e887..35b41fd 100644
--- a/manifests/plugins/interfaces.pp
+++ b/manifests/plugins/interfaces.pp
@@ -1,25 +1,21 @@
# handle if_ and if_err_ plugins
-class munin::plugins::interfaces {
+class munin::plugins::interfaces {
# 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+|vnet\d+|__tmp\d+')
- $ifs = regsubst($real_ifs, '(.+)', "if_\\1")
+ $ifs = prefix($real_ifs, 'if_')
- munin::plugin {
- $ifs: ensure => 'if_';
+ $if_err_plugin = $::operatingsystem ? {
+ 'openbsd' => 'if_errcoll_',
+ default => 'if_err_',
}
- case $::operatingsystem {
- openbsd: {
- $if_errs = regsubst($real_ifs, '(.+)', "if_errcoll_\\1")
- munin::plugin{
- $if_errs: ensure => 'if_errcoll_';
- }
- }
- default: {
- $if_errs = regsubst($real_ifs, '(.+)', "if_err_\\1")
- munin::plugin{
- $if_errs: ensure => 'if_err_';
- }
- }
+ $if_errs = prefix($real_ifs, $if_err_plugin)
+
+ munin::plugin { $ifs:
+ ensure => 'if_',
+ }
+
+ munin::plugin { $if_errs:
+ ensure => $if_err_plugin,
}
}
diff --git a/manifests/plugins/kvm.pp b/manifests/plugins/kvm.pp
index 7a1430f..650e5ef 100644
--- a/manifests/plugins/kvm.pp
+++ b/manifests/plugins/kvm.pp
@@ -1,3 +1,4 @@
+# Set up munin plugins for a KVM host
class munin::plugins::kvm {
munin::plugin::deploy {
[ 'kvm_cpu', 'kvm_mem', 'kvm_net' ]:;
diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp
index a73de63..354d23c 100644
--- a/manifests/plugins/linux.pp
+++ b/manifests/plugins/linux.pp
@@ -1,8 +1,10 @@
-class munin::plugins::linux {
+# Set up plugins for a linux host
+class munin::plugins::linux {
munin::plugin {
- [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]:
+ [ 'df_abs', 'forks', 'df_inode', 'irqstats', 'entropy', 'open_inodes',
+ 'diskstats', 'proc_pri', 'threads', ]:
ensure => present;
- acpi:
+ 'acpi':
ensure => $::acpi_available;
}
}
diff --git a/manifests/plugins/muninhost.pp b/manifests/plugins/muninhost.pp
index e4fb87d..644adb6 100644
--- a/manifests/plugins/muninhost.pp
+++ b/manifests/plugins/muninhost.pp
@@ -1,3 +1,4 @@
-class munin::plugins::muninhost {
+# Set up the plugins for a munin host
+class munin::plugins::muninhost {
munin::plugin { ['munin_update', 'munin_graph']: }
}
diff --git a/manifests/plugins/openbsd.pp b/manifests/plugins/openbsd.pp
index b549994..c195a1d 100644
--- a/manifests/plugins/openbsd.pp
+++ b/manifests/plugins/openbsd.pp
@@ -1,6 +1,7 @@
-class munin::plugins::openbsd {
+# Set up the plugins for an openbsd host
+class munin::plugins::openbsd {
munin::plugin {
- [ memory_pools, memory_types ]:
+ [ 'memory_pools', 'memory_types' ]:
ensure => present,
}
}
diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp
index a1c27a7..b04845c 100644
--- a/manifests/plugins/physical.pp
+++ b/manifests/plugins/physical.pp
@@ -1,5 +1,7 @@
-class munin::plugins::physical {
+# Set up the plugins for a physical machine
+class munin::plugins::physical {
case $::kernel {
- linux: { munin::plugin { iostat: } }
+ linux: { munin::plugin { 'iostat': } }
+ default: {}
}
}
diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp
index d094f35..9e03f0a 100644
--- a/manifests/plugins/selinux.pp
+++ b/manifests/plugins/selinux.pp
@@ -1,3 +1,4 @@
+# SELinux specific plugins
class munin::plugins::selinux {
munin::plugin{ [ 'selinux_avcstat' ]: }
}
diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp
index 197b657..a3f3b22 100644
--- a/manifests/plugins/setup.pp
+++ b/manifests/plugins/setup.pp
@@ -1,14 +1,13 @@
+# Set up the munin plugins for a node
class munin::plugins::setup {
- # This is required for the munin-node service and package requirements below.
- include munin::client
-
file {
[ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]:
- ignore => 'snmp_*',
ensure => directory,
+ require => Package['munin-node'],
+ ignore => 'snmp_*',
checksum => mtime,
- recurse => true,
+ recurse => true,
purge => true,
force => true,
notify => Service['munin-node'],
@@ -22,16 +21,4 @@ class munin::plugins::setup {
group => 0,
mode => '0640';
}
- case $::kernel {
- openbsd: {
- File['/etc/munin/plugin-conf.d/munin-node']{
- before => File['/var/run/munin'],
- }
- }
- default: {
- File['/etc/munin/plugin-conf.d/munin-node']{
- before => Package['munin-node'],
- }
- }
- }
}
diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp
index e3eec05..5dc6431 100644
--- a/manifests/plugins/vserver.pp
+++ b/manifests/plugins/vserver.pp
@@ -1,7 +1,7 @@
+# vserver specific plugins
class munin::plugins::vserver {
munin::plugin {
- [ netstat, processes ]:
+ [ 'netstat', 'processes' ]:
ensure => present;
}
}
-
diff --git a/manifests/register.pp b/manifests/register.pp
index 309c322..8c1ec61 100644
--- a/manifests/register.pp
+++ b/manifests/register.pp
@@ -1,10 +1,12 @@
+# Register a munin client
define munin::register (
- $host = $::fqdn,
- $port = '4949',
- $use_ssh = false,
- $description = 'absent',
- $config = [],
- $export_tag = 'munin'
+ $host = $::fqdn,
+ $port = '4949',
+ $use_ssh = false,
+ $description = 'absent',
+ $config = [],
+ $export_tag = 'munin',
+ $group = 'absent',
)
{
$fhost = $name
@@ -12,7 +14,7 @@ define munin::register (
@@concat::fragment{ "munin_client_${fhost}_${port}":
target => '/etc/munin/munin.conf',
- content => template("munin/client.erb"),
+ content => template('munin/client.erb'),
tag => $export_tag,
}
}
diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp
index 78c3e91..8d7ea56 100644
--- a/manifests/register/snmp.pp
+++ b/manifests/register/snmp.pp
@@ -1,21 +1,24 @@
+# Register a munin node with snmp enabled
define munin::register::snmp (
- $community = 'public',
+ $community = 'public',
$description = 'absent',
- $port = '4949',
- $host = $::fqdn
+ $port = '4949',
+ $host = $::fqdn,
+ $group = 'absent',
+ $version = '2',
) {
$fhost = $name
$client_type = 'snmp'
$config = [ 'use_node_name no' ]
exec { "munin_register_snmp_${fhost}":
- command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh",
- unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null",
+ command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --snmpversion ${version} --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',
+ target => '/etc/munin/munin.conf',
+ content => template('munin/client.erb'),
+ tag => 'munin',
}
}
diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp
index 603cb66..dc03c76 100644
--- a/manifests/remoteplugin.pp
+++ b/manifests/remoteplugin.pp
@@ -1,16 +1,23 @@
-define munin::remoteplugin($ensure = "present", $source, $config = '') {
+# Configure a munin remote plugin
+define munin::remoteplugin(
+ $source,
+ $ensure = 'present',
+ $config = ''
+) {
case $ensure {
- "absent": { munin::plugin{ $name: ensure => absent } }
+ 'absent': { munin::plugin{ $name: ensure => absent } }
default: {
file {
"/var/lib/puppet/modules/munin/plugins/${name}":
source => $source,
- mode => 0755, owner => root, group => 0;
+ mode => '0755',
+ owner => root,
+ group => 0,
}
munin::plugin { $name:
- ensure => $ensure,
- config => $config,
- script_path_in => "/var/lib/puppet/modules/munin/plugins",
+ ensure => $ensure,
+ config => $config,
+ script_path_in => '/var/lib/puppet/modules/munin/plugins',
}
}
}
diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp
index 0f8318a..4ff3bf9 100644
--- a/manifests/snmp_collector.pp
+++ b/manifests/snmp_collector.pp
@@ -1,14 +1,17 @@
+# Set up munin as an SNMP collector
class munin::snmp_collector{
- file {
- "/var/lib/puppet/modules/munin/create_snmp_links":
- source => "puppet:///modules/munin/create_snmp_links.sh",
- mode => 755, owner => root, group => 0;
- }
+ file {
+ '/var/lib/puppet/modules/munin/create_snmp_links':
+ source => 'puppet:///modules/munin/create_snmp_links.sh',
+ mode => '0755',
+ owner => root,
+ group => 0,
+ }
- exec { "create_snmp_links":
- command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes",
- require => File["snmp_links"],
- timeout => "2048",
- schedule => daily
+ exec { 'create_snmp_links':
+ command => '/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes',
+ require => File['snmp_links'],
+ timeout => '2048',
+ schedule => daily,
}
}
diff --git a/metadata.json b/metadata.json
new file mode 100644
index 0000000..f761002
--- /dev/null
+++ b/metadata.json
@@ -0,0 +1,16 @@
+{
+ "name": "duritong-munin",
+ "version": "0.0.4",
+ "author": "duritong",
+ "summary": "Puppet module for Munin monitoring",
+ "license": "Apache License, Version 2.0",
+ "source": "git://github.com/duritong/puppet-munin.git",
+ "project_page": "https://github.com/duritong/puppet-munin",
+ "issues_url": "https://github.com/duritong/puppet-munin/issues",
+ "description": "Munin is a performance monitoring system which creates nice RRD graphs and has a very easy plugin interface",
+ "dependencies": [
+ {"name":"puppetlabs/concat","version_requirement":">= 1.1.0"},
+ {"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0"},
+ {"name":"duritong/openbsd","version_requirement":">= 0.0.1"}
+ ]
+}
diff --git a/spec/classes/munin_client_base_spec.rb b/spec/classes/munin_client_base_spec.rb
new file mode 100644
index 0000000..fdf1403
--- /dev/null
+++ b/spec/classes/munin_client_base_spec.rb
@@ -0,0 +1,86 @@
+require 'spec_helper'
+
+describe 'munin::client::base' do
+ let :default_facts do
+ {
+ :fqdn => 'munin-node.example.org',
+ }
+ end
+
+ let :pre_condition do
+ 'include munin::client'
+ end
+
+ context 'on Debian' do
+ let :facts do
+ { :osfamily => 'Debian' }.merge(default_facts)
+ end
+
+ it 'should compile' do
+ should contain_class('munin::client::base')
+ end
+
+ it 'should set up munin-node' do
+ should contain_service('munin-node').with({
+ :ensure => 'running',
+ :enable => true,
+ :hasstatus => true,
+ :hasrestart => true,
+ })
+
+ should contain_file('/etc/munin').with({
+ :ensure => 'directory',
+ :mode => '0755',
+ :owner => 'root',
+ :group => 0,
+ })
+
+ should contain_file('/etc/munin/munin-node.conf').
+ with_content(/^host_name munin-node.example.org$/).
+ with_content(/^allow \^127\\\.0\\\.0\\\.1\$$/).
+ with_content(/^host \*$/).
+ with_content(/^port 4949$/)
+
+ should contain_munin__register('munin-node.example.org').with({
+ :host => 'munin-node.example.org',
+ :port => '4949',
+ :use_ssh => false,
+ :config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
+ :export_tag => 'munin',
+ })
+
+ should contain_class('munin::plugins::base')
+ end
+
+ it 'should contain the Debian specific values' do
+ should contain_file('/etc/munin/munin-node.conf').
+ with_content(/^log_file \/var\/log\/munin\/munin-node.log$/).
+ with_content(/^group root$/)
+ end
+ end
+
+ context 'on CentOS' do
+ let :facts do
+ { :osfamily => 'CentOS' }.merge(default_facts)
+ end
+
+ it 'should contain the CentOS specific values' do
+ should contain_file('/etc/munin/munin-node.conf').
+ with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/).
+ with_content(/^group root$/)
+ end
+ end
+
+ # Disabled because the required openbsd module is not in the requirements
+ context 'on OpenBSD', :if => false do
+ let :facts do
+ { :osfamily => 'OpenBSD' }.merge(default_facts)
+ end
+
+ it 'should contain the config OpenBSD specific values' do
+ should contain_file('/etc/munin/munin-node.conf').
+ with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/).
+ with_content(/^group 0$/)
+ end
+ end
+end
diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb
new file mode 100644
index 0000000..f7fc5e9
--- /dev/null
+++ b/spec/classes/munin_client_spec.rb
@@ -0,0 +1,50 @@
+require 'spec_helper'
+
+describe 'munin::client' do
+ shared_examples 'debian-client' do |os, codename|
+ let(:facts) {{
+ :operatingsystem => os,
+ :osfamily => 'Debian',
+ :lsbdistcodename => codename,
+ }}
+ it { should contain_package('munin-node') }
+ it { should contain_package('iproute') }
+ it { should contain_file('/etc/munin/munin-node.conf') }
+ it { should contain_class('munin::client::debian') }
+ end
+
+ shared_examples 'redhat-client' do |os, codename|
+ let(:facts) {{
+ :operatingsystem => os,
+ :osfamily => 'RedHat',
+ :lsbdistcodename => codename,
+ }}
+ it { should contain_package('munin-node') }
+ it { should contain_file('/etc/munin/munin-node.conf') }
+ end
+
+ context 'on debian-like system' do
+ it_behaves_like 'debian-client', 'Debian', 'squeeze'
+ it_behaves_like 'debian-client', 'Debian', 'wheezy'
+ it_behaves_like 'debian-client', 'Ubuntu', 'precise'
+ end
+
+ context 'on redhat-like system' do
+ it_behaves_like 'redhat-client', 'CentOS', '6'
+ # not supported yet
+ # it_behaves_like 'redhat', 'RedHat', '6'
+ end
+
+ context 'gentoo' do
+ let(:facts) {{
+ :operatingsystem => 'Gentoo',
+ :osfamily => 'Gentoo',
+ :lsbdistcodename => '',
+ :interfaces => 'lo,eth0',
+ }}
+ it { should contain_package('munin-node') }
+ it { should contain_file('/etc/munin/munin-node.conf') }
+ it { should contain_class('munin::client::gentoo') }
+ end
+
+end
diff --git a/spec/classes/munin_host_cgi_spec.rb b/spec/classes/munin_host_cgi_spec.rb
new file mode 100644
index 0000000..52c5c22
--- /dev/null
+++ b/spec/classes/munin_host_cgi_spec.rb
@@ -0,0 +1,57 @@
+require 'spec_helper'
+
+describe 'munin::host::cgi' do
+ #let :pre_condition do
+ # 'include munin::client'
+ #end
+
+ context 'on Debian' do
+ let :facts do
+ { :operatingsystem => 'Debian' }
+ end
+
+ it 'should compile' do
+ should contain_class('munin::host::cgi')
+ end
+
+ it 'should exec set_modes_for_cgi' do
+ should contain_exec('set_modes_for_cgi').with({
+ :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 => 'Concat::Fragment[munin.conf.header]',
+ })
+ end
+
+ it 'should contain logrotate.conf' do
+ should contain_file('/etc/logrotate.d/munin').with({
+ :content => /^ create 660 munin www-data$/,
+ :group => 0,
+ :mode => '0644',
+ :owner => 'root',
+ })
+ end
+ end
+
+ context 'on CentOS' do
+ let :facts do
+ { :operatingsystem => 'CentOS' }
+ end
+
+ it 'should exec set_modes_for_cgi' do
+ should contain_exec('set_modes_for_cgi').with({
+ :command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
+ :refreshonly => true,
+ :subscribe => 'Concat::Fragment[munin.conf.header]',
+ })
+ end
+
+ it 'should contain logrotate.conf' do
+ should contain_file('/etc/logrotate.d/munin').with({
+ :content => /^ create 660 munin apache$/,
+ :group => 0,
+ :mode => '0644',
+ :owner => 'root',
+ })
+ end
+ end
+end
diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb
new file mode 100644
index 0000000..df002ce
--- /dev/null
+++ b/spec/classes/munin_host_spec.rb
@@ -0,0 +1,47 @@
+require 'spec_helper'
+
+describe 'munin::host' do
+ shared_examples 'debian-host' do |os, codename|
+ let(:facts) {{
+ :operatingsystem => os,
+ :osfamily => 'Debian',
+ :lsbdistcodename => codename,
+ :concat_basedir => '/var/lib/puppet/concat',
+ }}
+ it { should contain_package('munin') }
+ it { should contain_file('/etc/munin/munin.conf') }
+ it { should contain_class('munin::host') }
+ end
+
+ shared_examples 'redhat-host' do |os, codename|
+ let(:facts) {{
+ :operatingsystem => os,
+ :osfamily => 'RedHat',
+ :lsbdistcodename => codename,
+ :concat_basedir => '/var/lib/puppet/concat',
+ }}
+ it { should contain_package('munin') }
+ it { should contain_file('/etc/munin/munin.conf') }
+ it { should contain_class('munin::host') }
+ end
+
+ context 'on debian-like system' do
+ it_behaves_like 'debian-host', 'Debian', 'squeeze'
+ it_behaves_like 'debian-host', 'Debian', 'wheezy'
+ it_behaves_like 'debian-host', 'Ubuntu', 'precise'
+ end
+
+ context 'on redhat-like system' do
+ it_behaves_like 'redhat-host', 'CentOS', '6'
+ end
+
+ context 'on Gentoo' do
+ let(:facts) {{
+ :osfamily => 'Gentoo',
+ :concat_basedir => '/var/lib/puppet/concat',
+ }}
+ it { should contain_package('munin') }
+ it { should contain_file('/etc/munin/munin.conf') }
+ it { should contain_class('munin::host') }
+ end
+end
diff --git a/spec/classes/munin_plugins_interfaces_spec.rb b/spec/classes/munin_plugins_interfaces_spec.rb
new file mode 100644
index 0000000..7e3c418
--- /dev/null
+++ b/spec/classes/munin_plugins_interfaces_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe 'munin::plugins::interfaces' do
+ context 'on CentOS' do
+ let :facts do
+ {
+ :operatingsystem => 'CentOS',
+ :interfaces => 'lo,eth0,sit0',
+ }
+ end
+
+ it 'should compile' do
+ should contain_class('munin::plugins::interfaces')
+ end
+
+ it 'should create plugins for each interface' do
+ # lo
+ should contain_munin__plugin('if_lo').with_ensure('if_')
+ should contain_munin__plugin('if_err_lo').with_ensure('if_err_')
+
+ # eth0
+ should contain_munin__plugin('if_eth0').with_ensure('if_')
+ should contain_munin__plugin('if_err_eth0').with_ensure('if_err_')
+ end
+
+ it 'should not create plugins for sit0' do
+ should_not contain_munin__plugin('if_sit0')
+ should_not contain_munin__plugin('if_err_sit0')
+ end
+ end
+
+ context 'on OpenBSD' do
+ let :facts do
+ {
+ :operatingsystem => 'OpenBSD',
+ :interfaces => 'eth0',
+ }
+ end
+
+ it 'should use if_errcoll_ instead of if_err_' do
+ should contain_munin__plugin('if_errcoll_eth0').with_ensure('if_errcoll_')
+ end
+ end
+end
diff --git a/spec/defines/munin_plugin_spec.rb b/spec/defines/munin_plugin_spec.rb
new file mode 100644
index 0000000..0e7306a
--- /dev/null
+++ b/spec/defines/munin_plugin_spec.rb
@@ -0,0 +1,57 @@
+require 'spec_helper'
+
+describe 'munin::plugin' do
+ let(:title) { 'users' }
+ let(:facts) do
+ { :operatingsystem => 'CentOS' }
+ end
+ context 'present' do
+ it { should contain_file('/etc/munin/plugins/users').with(
+ :ensure => 'link',
+ :target => '/usr/share/munin/plugins/users'
+ ) }
+ it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') }
+ end
+
+ context 'present and config' do
+ let(:params) do
+ { :config => 'env.user root' }
+ end
+ it { should contain_file('/etc/munin/plugins/users').with(
+ :ensure => 'link',
+ :target => '/usr/share/munin/plugins/users',
+ :notify => 'Service[munin-node]'
+ ) }
+ it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with(
+ :content => "[users]\nenv.user root\n",
+ :owner => 'root',
+ :group => 0,
+ :mode => '0640'
+ ) }
+ end
+
+ context 'present and config as an array' do
+ let(:params) do
+ { :config => [ 'env.user root', 'env.group root' ] }
+ end
+ it { should contain_file('/etc/munin/plugins/users').with(
+ :ensure => 'link',
+ :target => '/usr/share/munin/plugins/users',
+ :notify => 'Service[munin-node]'
+ ) }
+ it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with(
+ :content => "[users]\nenv.user root\nenv.group root\n",
+ :owner => 'root',
+ :group => 0,
+ :mode => '0640'
+ ) }
+ end
+
+ context 'absent' do
+ let(:params) do
+ { :ensure => 'absent' }
+ end
+ it { should_not contain_file('/etc/munin/plugins/users') }
+ it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') }
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..70ab1fb
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,11 @@
+require 'puppetlabs_spec_helper/module_spec_helper'
+
+fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
+
+RSpec.configure do |c|
+ c.module_path = File.join(fixture_path, 'modules')
+ c.manifest_dir = File.join(fixture_path, 'manifests')
+end
+
+Puppet::Util::Log.level = :warning
+Puppet::Util::Log.newdestination(:console)
diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb
new file mode 100644
index 0000000..9adfea9
--- /dev/null
+++ b/spec/spec_helper_system.rb
@@ -0,0 +1,27 @@
+require 'rspec-system/spec_helper'
+require 'rspec-system-puppet/helpers'
+require 'rspec-system-serverspec/helpers'
+include Serverspec::Helper::RSpecSystem
+include Serverspec::Helper::DetectOS
+include RSpecSystemPuppet::Helpers
+
+RSpec.configure do |c|
+ # Project root
+ proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+ # Enable colour
+ c.tty = true
+
+ c.include RSpecSystemPuppet::Helpers
+
+ # This is where we 'setup' the nodes before running our tests
+ c.before :suite do
+ # Install puppet
+ puppet_install
+
+ # Install modules and dependencies
+ puppet_module_install(:source => proj_root, :module_name => 'munin')
+ shell('puppet module install puppetlabs-stdlib')
+ shell('puppet module install puppetlabs-concat')
+ end
+end
diff --git a/templates/client.erb b/templates/client.erb
index ba03da5..bc42452 100644
--- a/templates/client.erb
+++ b/templates/client.erb
@@ -1,24 +1,24 @@
<%
- # Downcase all information
- dom = scope.lookupvar('::domain').downcase
- h = scope.lookupvar('::hostname').downcase
+ # Downcase all information
+ dom = scope.lookupvar('::domain').downcase
+ h = scope.lookupvar('::hostname').downcase
%>
### Munin client from Puppet template
# Domain: <%= dom %>
# Registered on: <%= h %>
-# Type: <%= client_type %>
-<% if description != 'absent' -%>
-# Description: <%= description.gsub!(/\n/, ' ') %>
+# Type: <%= @client_type %>
+<% if @description != 'absent' -%>
+# Description: <%= @description.gsub(/\n/, ' ') %>
<% end -%>
-[<%= fhost.downcase %>]
-<% if use_ssh -%>
- address ssh://<%= host %>/bin/nc localhost <%= port %>
+[<% if @group != 'absent' -%><%= @group %>;<% end -%><%= @fhost.downcase %>]
+<% if @use_ssh -%>
+ address ssh://<%= @host %>/bin/nc localhost <%= @port %>
<% else -%>
- address <%= host %>
- port <%= port %>
+ address <%= @host %>
+ port <%= @port %>
<% end -%>
-<% if config -%><% config.each do |val| -%>
- <%= val -%>
+<% if @config -%><% @config.each do |val| -%>
+ <%= @val -%>
<% end -%><% end -%>
diff --git a/files/config/host/logrotate.CentOS b/templates/logrotate.conf.erb
index 411de3f..0e3e6ca 100644
--- a/files/config/host/logrotate.CentOS
+++ b/templates/logrotate.conf.erb
@@ -13,7 +13,7 @@
rotate 7
compress
notifempty
- create 660 munin apache
+ create 660 munin <%= @apache_user %>
}
/var/log/munin/munin-html.log {
diff --git a/templates/munin-node.conf.CentOS b/templates/munin-node.conf.CentOS
deleted file mode 120000
index 082b30c..0000000
--- a/templates/munin-node.conf.CentOS
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.default \ No newline at end of file
diff --git a/templates/munin-node.conf.CentOS. b/templates/munin-node.conf.CentOS.
deleted file mode 120000
index 082b30c..0000000
--- a/templates/munin-node.conf.CentOS.
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.default \ No newline at end of file
diff --git a/templates/munin-node.conf.CentOS.5 b/templates/munin-node.conf.CentOS.5
deleted file mode 120000
index 082b30c..0000000
--- a/templates/munin-node.conf.CentOS.5
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.default \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian b/templates/munin-node.conf.Debian
deleted file mode 120000
index e0646b9..0000000
--- a/templates/munin-node.conf.Debian
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Debian.etch \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.etch b/templates/munin-node.conf.Debian.etch
deleted file mode 100644
index 9763772..0000000
--- a/templates/munin-node.conf.Debian.etch
+++ /dev/null
@@ -1,39 +0,0 @@
-##########
-########## 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 <%= scope.lookupvar('munin::client::host') %>
-port <%= scope.lookupvar('munin::client::port') %>
-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 <%= scope.lookupvar('::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
-<% scope.lookupvar('munin::client::allow').each do |allow| -%>
-allow <%= "^#{Regexp.escape(allow)}$" %>
-<% end -%>
-
diff --git a/templates/munin-node.conf.Debian.feisty b/templates/munin-node.conf.Debian.feisty
deleted file mode 120000
index e0646b9..0000000
--- a/templates/munin-node.conf.Debian.feisty
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Debian.etch \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.gutsy b/templates/munin-node.conf.Debian.gutsy
deleted file mode 120000
index e0646b9..0000000
--- a/templates/munin-node.conf.Debian.gutsy
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Debian.etch \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.hardy b/templates/munin-node.conf.Debian.hardy
deleted file mode 120000
index e0646b9..0000000
--- a/templates/munin-node.conf.Debian.hardy
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Debian.etch \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.lenny b/templates/munin-node.conf.Debian.lenny
deleted file mode 100644
index 9763772..0000000
--- a/templates/munin-node.conf.Debian.lenny
+++ /dev/null
@@ -1,39 +0,0 @@
-##########
-########## 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 <%= scope.lookupvar('munin::client::host') %>
-port <%= scope.lookupvar('munin::client::port') %>
-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 <%= scope.lookupvar('::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
-<% scope.lookupvar('munin::client::allow').each do |allow| -%>
-allow <%= "^#{Regexp.escape(allow)}$" %>
-<% end -%>
-
diff --git a/templates/munin-node.conf.Debian.lucid b/templates/munin-node.conf.Debian.lucid
deleted file mode 120000
index e0646b9..0000000
--- a/templates/munin-node.conf.Debian.lucid
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Debian.etch \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.sarge b/templates/munin-node.conf.Debian.sarge
deleted file mode 120000
index e0646b9..0000000
--- a/templates/munin-node.conf.Debian.sarge
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Debian.etch \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.sid b/templates/munin-node.conf.Debian.sid
deleted file mode 120000
index 6b8d690..0000000
--- a/templates/munin-node.conf.Debian.sid
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 120000
index 6b8d690..0000000
--- a/templates/munin-node.conf.Debian.squeeze
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Debian.lenny \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.wheezy b/templates/munin-node.conf.Debian.wheezy
deleted file mode 100644
index fe6f27f..0000000
--- a/templates/munin-node.conf.Debian.wheezy
+++ /dev/null
@@ -1,57 +0,0 @@
-##########
-########## Managed by puppet
-##########
-
-log_level 4
-log_file /var/log/munin/munin-node.log
-pid_file /var/run/munin/munin-node.pid
-
-background 1
-setsid 1
-
-user root
-group root
-
-# Regexps for files to ignore
-
-ignore_file ~$
-#ignore_file [#~]$ # FIX doesn't work. '#' starts a comment
-ignore_file DEADJOE$
-ignore_file \.bak$
-ignore_file %$
-ignore_file \.dpkg-(tmp|new|old|dist)$
-ignore_file \.rpm(save|new)$
-ignore_file \.pod$
-
-# Set this if the client doesn't report the correct hostname when
-# telnetting to localhost, port 4949
-#
-#host_name localhost.localdomain
-host_name <%= scope.lookupvar('::fqdn') %>
-
-# A list of addresses that are allowed to connect. This must be a
-# regular expression, since Net::Server does not understand CIDR-style
-# network notation unless the perl module Net::CIDR is installed. You
-# may repeat the allow line as many times as you'd like
-
-<% scope.lookupvar('munin::client::allow').each do |allow| -%>
-allow <%= "^#{Regexp.escape(allow)}$" %>
-<% end -%>
-
-# If you have installed the Net::CIDR perl module, you can use one or more
-# cidr_allow and cidr_deny address/mask patterns. A connecting client must
-# match any cidr_allow, and not match any cidr_deny. Note that a netmask
-# *must* be provided, even if it's /32
-#
-# Example:
-#
-# cidr_allow 127.0.0.1/32
-# cidr_allow 192.0.2.0/24
-# cidr_deny 192.0.2.42/32
-
-# Which address to bind to;
-host <%= scope.lookupvar('munin::client::host') %>
-
-# And which port
-port <%= scope.lookupvar('munin::client::port') %>
-
diff --git a/templates/munin-node.conf.Gentoo b/templates/munin-node.conf.Gentoo
deleted file mode 120000
index 082b30c..0000000
--- a/templates/munin-node.conf.Gentoo
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.default \ No newline at end of file
diff --git a/templates/munin-node.conf.Gentoo. b/templates/munin-node.conf.Gentoo.
deleted file mode 120000
index fd16e50..0000000
--- a/templates/munin-node.conf.Gentoo.
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Gentoo \ No newline at end of file
diff --git a/templates/munin-node.conf.OpenBSD b/templates/munin-node.conf.OpenBSD
deleted file mode 100644
index 14b658e..0000000
--- a/templates/munin-node.conf.OpenBSD
+++ /dev/null
@@ -1,59 +0,0 @@
-##########
-########## Managed by puppet
-##########
-#
-# Example config-file for munin-node
-#
-
-log_level 4
-log_file /var/log/munin/munin-node.log
-pid_file /var/run/munin/munin-node.pid
-
-background 1
-setsid 1
-
-user root
-group 0
-
-# Regexps for files to ignore
-ignore_file ~$
-ignore_file DEADJOE$
-ignore_file \.bak$
-ignore_file %$
-ignore_file \.dpkg-(tmp|new|old|dist)$
-ignore_file \.rpm(save|new)$
-ignore_file \.pod$
-
-# Set this if the client doesn't report the correct hostname when
-# telnetting to localhost, port 4949
-#
-#host_name localhost.localdomain
-host_name <%= scope.lookupvar('::fqdn') %>
-
-# A list of addresses that are allowed to connect. This must be a
-# regular expression, since Net::Server does not understand CIDR-style
-# network notation unless the perl module Net::CIDR is installed. You
-# may repeat the allow line as many times as you'd like
-
-<% scope.lookupvar('munin::client::allow').each do |allow| -%>
-allow <%= "^#{Regexp.escape(allow)}$" %>
-<% end -%>
-
-# If you have installed the Net::CIDR perl module, you can use one or more
-# cidr_allow and cidr_deny address/mask patterns. A connecting client must
-# match any cidr_allow, and not match any cidr_deny. Note that a netmask
-# *must* be provided, even if it's /32
-#
-# Example:
-#
-# cidr_allow 127.0.0.1/32
-# cidr_allow 192.0.2.0/24
-# cidr_deny 192.0.2.42/32
-
-# Which address to bind to;
-host <%= scope.lookupvar('munin::client::host') %>
-# host 127.0.0.1
-
-# And which port
-port <%= scope.lookupvar('munin::client::port') %>
-
diff --git a/templates/munin-node.conf.Ubuntu b/templates/munin-node.conf.Ubuntu
deleted file mode 100644
index 9763772..0000000
--- a/templates/munin-node.conf.Ubuntu
+++ /dev/null
@@ -1,39 +0,0 @@
-##########
-########## 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 <%= scope.lookupvar('munin::client::host') %>
-port <%= scope.lookupvar('munin::client::port') %>
-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 <%= scope.lookupvar('::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
-<% scope.lookupvar('munin::client::allow').each do |allow| -%>
-allow <%= "^#{Regexp.escape(allow)}$" %>
-<% end -%>
-
diff --git a/templates/munin-node.conf.Ubuntu.precise b/templates/munin-node.conf.Ubuntu.precise
deleted file mode 120000
index d8fcb24..0000000
--- a/templates/munin-node.conf.Ubuntu.precise
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Ubuntu \ No newline at end of file
diff --git a/templates/munin-node.conf.Ubuntu.quantal b/templates/munin-node.conf.Ubuntu.quantal
deleted file mode 120000
index d8fcb24..0000000
--- a/templates/munin-node.conf.Ubuntu.quantal
+++ /dev/null
@@ -1 +0,0 @@
-munin-node.conf.Ubuntu \ No newline at end of file
diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.erb
index 9d7f32f..f51a665 100644
--- a/templates/munin-node.conf.default
+++ b/templates/munin-node.conf.erb
@@ -1,22 +1,29 @@
##########
########## Managed by puppet
##########
-#
-# Example config-file for munin-node
-#
log_level 4
-log_file /var/log/munin-node/munin-node.log
+log_file <%= @log_file %>
pid_file /var/run/munin/munin-node.pid
background 1
setsid 1
-user root
-group 0
+user <%= @user %>
+group <%= @group %>
+
+# This is the timeout for the whole transaction.
+# Units are in sec. Default is 15 min
+#
+# global_timeout 900
+
+# This is the timeout for each plugin.
+# Units are in sec. Default is 1 min
+#
+# timeout 60
# Regexps for files to ignore
-ignore_file [\#~]$
+#ignore_file [\#~]$
ignore_file DEADJOE$
ignore_file \.bak$
ignore_file %$
@@ -27,15 +34,13 @@ ignore_file \.pod$
# Set this if the client doesn't report the correct hostname when
# telnetting to localhost, port 4949
#
-#host_name localhost.localdomain
-host_name <%= fqdn %>
+host_name <%= scope.lookupvar('munin::host_name') %>
# A list of addresses that are allowed to connect. This must be a
# regular expression, since Net::Server does not understand CIDR-style
# network notation unless the perl module Net::CIDR is installed. You
# may repeat the allow line as many times as you'd like
-
-<% scope.lookupvar('munin::client::allow').each do |allow| -%>
+<% scope.lookupvar('munin::allow').each do |allow| -%>
allow <%= "^#{Regexp.escape(allow)}$" %>
<% end -%>
@@ -51,9 +56,7 @@ allow <%= "^#{Regexp.escape(allow)}$" %>
# cidr_deny 192.0.2.42/32
# Which address to bind to;
-host <%= scope.lookupvar('munin::client::host') %>
-# host 127.0.0.1
+host <%= scope.lookupvar('munin::host') %>
# And which port
-port <%= scope.lookupvar('munin::client::port') %>
-
+port <%= scope.lookupvar('munin::port') %>
diff --git a/templates/site.conf b/templates/site.conf
deleted file mode 100644
index 52ddb53..0000000
--- a/templates/site.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-<VirtualHost *>
- ServerName <%= name %>
- DocumentRoot /var/cache/munin/www/
- <Location />
- order allow,deny
- Allow from all
- </Location>
-</VirtualHost>
-