summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/config/host/munin.conf.header.CentOS46
-rw-r--r--manifests/client.pp38
-rw-r--r--manifests/client/base.pp49
-rw-r--r--manifests/client/centos.pp2
-rw-r--r--manifests/client/darwin.pp43
-rw-r--r--manifests/client/debian.pp26
-rw-r--r--manifests/client/gentoo.pp5
-rw-r--r--manifests/client/openbsd.pp99
-rw-r--r--manifests/client/package.pp24
-rw-r--r--manifests/host.pp2
-rw-r--r--manifests/init.pp11
-rw-r--r--manifests/plugin.pp93
-rw-r--r--manifests/plugin/scriptpaths.pp16
-rw-r--r--manifests/plugins/interfaces.pp6
-rw-r--r--manifests/plugins/vserver.pp9
-rw-r--r--manifests/register.pp52
-rw-r--r--manifests/register/snmp.pp22
-rw-r--r--manifests/register_snmp.pp22
-rw-r--r--manifests/remoteplugin.pp30
-rw-r--r--manifests/snmp_collector.pp24
-rw-r--r--templates/client.erb18
-rw-r--r--templates/defaultclient.erb15
-rw-r--r--templates/munin-node.conf.default24
-rw-r--r--templates/snmpclient.erb10
24 files changed, 362 insertions, 324 deletions
diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS
index dcadd6b..413cd84 100644
--- a/files/config/host/munin.conf.header.CentOS
+++ b/files/config/host/munin.conf.header.CentOS
@@ -1,21 +1,51 @@
# 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/www/html/munin/
-logdir /var/log/munin
-rundir /var/run/munin
+# 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
+# logdir /var/log/munin
+# rundir /var/run/munin
+#
+# tmpldir /etc/munin/templates
-# Where to look for the HTML templates
-tmpldir /etc/munin/templates
+# (Exactly one) directory to include all files from.
+#
+# includedir /etc/munin/munin-conf.d
# Make graphs show values per minute instead of per second
#graph_period minute
+# Graphics files are normaly generated by munin-graph, no matter if
+# the graphs are used or not. You can change this to
+# on-demand-graphing by following the instructions in
+# http://munin.projects.linpro.no/wiki/CgiHowto
+#
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 /cgi-bin/munin-cgi-graph
+
+# munin-graph runs in parallel, the number of concurrent processes is
+# 6. If you want munin-graph to not be parallel set to 0. If set too
+# high it will slow down munin-graph. Some experiments are needed to
+# determine how many are optimal on your system. On a multi-core
+# system with good SCSI disks the number can probably be quite high.
+#
+#max_graph_jobs 6
+
# 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
diff --git a/manifests/client.pp b/manifests/client.pp
index 234523f..273070d 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -5,24 +5,22 @@
class munin::client inherits munin {
- $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
- $munin_host_real = $munin_host ? {
- '' => '*',
- 'fqdn' => '*',
- default => $munin_host
- }
-
- case $operatingsystem {
- openbsd: { include munin::client::openbsd }
- darwin: { include munin::client::darwin }
- debian,ubuntu: { include munin::client::debian }
- gentoo: { include munin::client::gentoo }
- centos: { include munin::client::centos }
- default: { include munin::client::base }
- }
-
- if $use_shorewall {
- include shorewall::rules::munin
- }
-
+ $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
+ $munin_host_real = $munin_host ? {
+ '' => '*',
+ 'fqdn' => '*',
+ default => $munin_host
+ }
+
+ case $operatingsystem {
+ openbsd: { include munin::client::openbsd }
+ darwin: { include munin::client::darwin }
+ debian,ubuntu: { include munin::client::debian }
+ gentoo: { include munin::client::gentoo }
+ centos: { include munin::client::package }
+ default: { include munin::client::base }
+ }
+ if $use_shorewall {
+ include shorewall::rules::munin
+ }
}
diff --git a/manifests/client/base.pp b/manifests/client/base.pp
index 0f0feca..7c2adc2 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -1,29 +1,26 @@
class munin::client::base {
- service { 'munin-node':
- ensure => running,
- enable => true,
- hasstatus => true,
- hasrestart => true,
- }
-
- file { '/etc/munin':
- ensure => directory,
- mode => 0755, owner => root, group => 0;
- }
-
- $real_munin_allow = $munin_allow ? {
- '' => '127.0.0.1',
- default => $munin_allow
- }
-
- file { '/etc/munin/munin-node.conf':
- content => template("munin/munin-node.conf.$operatingsystem"),
- notify => Service['munin-node'],
- mode => 0644, owner => root, group => 0,
- }
-
- munin::register { $fqdn: }
- include munin::plugins::base
-
+ service { 'munin-node':
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ hasrestart => true,
+ }
+ file {'/etc/munin':
+ ensure => directory,
+ mode => 0755, owner => root, group => 0;
+ }
+ $real_munin_allow = $munin_allow ? {
+ '' => '127.0.0.1',
+ default => $munin_allow
+ }
+ file {'/etc/munin/munin-node.conf':
+ content => template("munin/munin-node.conf.$operatingsystem"),
+ notify => Service['munin-node'],
+ mode => 0644, owner => root, group => 0,
+ }
+ munin::register { $fqdn:
+ config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
+ }
+ include munin::plugins::base
}
diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp
index 46a7e3f..42e8c59 100644
--- a/manifests/client/centos.pp
+++ b/manifests/client/centos.pp
@@ -1,3 +1,3 @@
class munin::client::centos inherits munin::client::package {
- include munin::plugins::centos
+ include munin::plugins::centos
}
diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp
index 5ae5b60..9cfe7e9 100644
--- a/manifests/client/darwin.pp
+++ b/manifests/client/darwin.pp
@@ -1,27 +1,22 @@
class munin::client::darwin {
- file { '/usr/share/snmp/snmpd.conf':
- mode => 744,
- content => template("munin/darwin_snmpd.conf.erb"),
- group => 0,
- owner => root,
- }
-
- delete_matching_line{"startsnmpdno":
- file => "/etc/hostconfig",
- pattern => "SNMPSERVER=-NO-",
- }
-
- line { "startsnmpdyes":
- file => "/etc/hostconfig",
- line => "SNMPSERVER=-YES-",
- notify => Exec["/sbin/SystemStarter start SNMP"],
- }
-
- exec{"/sbin/SystemStarter start SNMP":
- noop => false,
- }
-
- munin::register_snmp { $fqdn: }
-
+ file { "/usr/share/snmp/snmpd.conf":
+ mode => 744,
+ content => template("munin/darwin_snmpd.conf.erb"),
+ group => 0,
+ owner => root,
+ }
+ delete_matching_line{"startsnmpdno":
+ file => "/etc/hostconfig",
+ pattern => "SNMPSERVER=-NO-",
+ }
+ line { "startsnmpdyes":
+ file => "/etc/hostconfig",
+ line => "SNMPSERVER=-YES-",
+ notify => Exec["/sbin/SystemStarter start SNMP"],
+ }
+ exec{"/sbin/SystemStarter start SNMP":
+ noop => false,
+ }
+ munin::register_snmp { $fqdn: }
}
diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp
index e75f484..7c56788 100644
--- a/manifests/client/debian.pp
+++ b/manifests/client/debian.pp
@@ -1,20 +1,16 @@
class munin::client::debian inherits munin::client::package {
- # the plugin will need that
- if !defined(Package["iproute"]) {
+ # the plugin will need that
package { "iproute": ensure => installed }
- }
-
- Service["munin-node"]{
- # sarge's munin-node init script has no status
- hasstatus => $lsbdistcodename ? { sarge => false, default => true }
- }
-
- File["/etc/munin/munin-node.conf"]{
- content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"),
- }
- # workaround bug in munin_node_configure
- plugin { "postfix_mailvolume": ensure => absent }
- include munin::plugins::debian
+ Service["munin-node"]{
+ # sarge's munin-node init script has no status
+ hasstatus => $lsbdistcodename ? { sarge => false, default => true }
+ }
+ File["/etc/munin/munin-node.conf"]{
+ content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"),
+ }
+ # workaround bug in munin_node_configure
+ plugin { "postfix_mailvolume": ensure => absent }
+ include munin::plugins::debian
}
diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp
index e651134..d4fe71e 100644
--- a/manifests/client/gentoo.pp
+++ b/manifests/client/gentoo.pp
@@ -3,8 +3,7 @@ class munin::client::gentoo inherits munin::client::package {
Package['munin-node'] {
name => 'munin',
category => 'net-analyzer',
- }
+ }
- include munin::plugins::gentoo
-
+ include munin::plugins::gentoo
}
diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp
index 468cffa..1f6248d 100644
--- a/manifests/client/openbsd.pp
+++ b/manifests/client/openbsd.pp
@@ -3,48 +3,59 @@
class munin::client::openbsd inherits munin::client::base {
- file{ '/usr/src/munin_openbsd.tar.gz':
- source => "puppet://$server/modules/munin/openbsd/package/munin_openbsd.tar.gz",
- owner => root, group => 0, mode => 0600;
- }
-
- package { [ 'p5-Compress-Zlib', 'p5-Crypt-SSLeay', 'p5-HTML-Parser',
- 'p5-HTML-Tagset', 'p5-HTTP-GHTTP', 'p5-LWP-UserAgent-Determined',
- 'p5-Net-SSLeay', 'p5-Net-Server', 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
- ensure => installed,
- before => File['/var/run/munin'],
- }
-
- exec { 'extract_openbsd':
- command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz',
- unless => 'test -d /opt/munin',
- require => File['/usr/src/munin_openbsd.tar.gz'],
- }
-
- file{ [ '/var/run/munin', '/var/log/munin' ]:
- ensure => directory,
- require => Exec['extract_openbsd'],
- owner => root, group => 0, mode => 0755;
- }
-
- openbsd::rc_local{ 'munin-node':
- binary => '/opt/munin/sbin/munin-node',
- require => File['/var/run/munin'],
- }
-
- Service['munin-node']{
- restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
- stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
- start => '/opt/munin/sbin/munin-node',
- hasstatus => false,
- hasrestart => false,
- require => [ File['/var/run/munin'], File['/var/log/munin'] ],
- }
-
- cron { 'clean_munin_logfile':
- command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
- minute => 0,
- hour => 2,
- weekday => 0,
- }
+ if $operatingsystemrelease == '4.3' {
+ file{'/usr/src/munin_openbsd.tar.gz':
+ source => "puppet://$server/modules/munin/openbsd/package/munin_openbsd.tar.gz",
+ owner => root, group => 0, mode => 0600;
+ }
+ exec{'extract_openbsd':
+ command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz',
+ unless => 'test -d /opt/munin',
+ require => File['/usr/src/munin_openbsd.tar.gz'],
+ before => File['/var/run/munin'],
+ }
+ package{'p5-Compress-Zlib':
+ ensure => installed,
+ before => File['/var/run/munin'],
+ }
+ } else {
+ package{'munin-node':
+ ensure => installed,
+ }
+ }
+ package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP',
+ 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server',
+ 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
+ ensure => installed,
+ before => File['/var/run/munin'],
+ }
+ file{[ '/var/run/munin', '/var/log/munin' ]:
+ ensure => directory,
+ owner => root, group => 0, mode => 0755;
+ }
+ openbsd::rc_local{'munin-node':
+ binary => $operatingsystemrelease ? {
+ '4.3' => '/opt/munin/sbin/munin-node',
+ default => '/usr/local/sbin/munin-node'
+ },
+ require => File['/var/run/munin'],
+ }
+ Service['munin-node']{
+ restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
+ stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
+ start => $operatingsystemrelease ? {
+ '4.3' => '/opt/munin/sbin/munin-node',
+ default => '/usr/local/sbin/munin-node'
+ },
+ status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^$(cat /var/run/munin/munin-node.pid).*munin-node")',
+ hasstatus => true,
+ hasrestart => true,
+ require => [ File['/var/run/munin'], File['/var/log/munin'] ],
+ }
+ cron{'clean_munin_logfile':
+ command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
+ minute => 0,
+ hour => 2,
+ weekday => 0,
+ }
}
diff --git a/manifests/client/package.pp b/manifests/client/package.pp
index f6e7a08..0ee7443 100644
--- a/manifests/client/package.pp
+++ b/manifests/client/package.pp
@@ -8,22 +8,14 @@ class munin::client::package inherits munin::client::base {
ensure => $munin_node_ensure_version;
}
- Package['munin-node']{
- require => Package['munin-common'],
+ package { 'munin-node': ensure => $munin_node_ensure_version }
+ Service['munin-node']{
+ require => Package[munin-node],
+ }
+ File['/etc/munin/munin-node.conf']{
+ # this has to be installed before the package, so the postinst can
+ # boot the munin-node without failure!
+ before => Package['munin-node'],
}
}
-
-
- package { 'munin-node': ensure => $munin_node_ensure_version }
-
- Service['munin-node']{
- require => Package[munin-node],
- }
-
- File['/etc/munin/munin-node.conf']{
- # this has to be installed before the package, so the postinst can
- # boot the munin-node without failure!
- before => Package['munin-node'],
- }
-
}
diff --git a/manifests/host.pp b/manifests/host.pp
index e6b3916..b9e59e4 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -7,6 +7,8 @@ class munin::host inherits munin
if $munin_ensure_version == '' { $munin_ensure_version = 'installed' }
+ File <<| tag == 'munin' |>>
+
package {"munin": ensure => $munin_ensure_version, }
File <<| tag == 'munin' |>>
diff --git a/manifests/init.pp b/manifests/init.pp
index 578c4bb..bae83a4 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -2,19 +2,20 @@
# munin module
# munin.pp - everything a sitewide munin installation needs
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
-#
+#
# Copyright 2008, Puzzle ITC GmbH
# Marcel Härry haerry+puppet(at)puzzle.ch
# Simon Josi josi+puppet(at)puzzle.ch
#
-# This program is free software; you can redistribute
-# it and/or modify it under the terms of the GNU
-# General Public License version 3 as published by
+# This program is free software; you can redistribute
+# it and/or modify it under the terms of the GNU
+# General Public License version 3 as published by
# the Free Software Foundation.
#
-# the port is a parameter so vservers can share
+# the port is a parameter so vservers can share
# IP addresses and still be happy
class munin {
+ include common::moduledir
module_dir { [ "munin", "munin/nodes", "munin/plugins" ]: }
}
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 10aab79..08ac916 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -10,52 +10,57 @@ define munin::plugin (
$script_path_in = '',
$config = '' )
{
+ include munin::plugin::scriptpaths
+ $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
- include munin::plugin::scriptpaths
- $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
-
- $plugin_src = $ensure ? { "present" => $name, default => $ensure }
- $plugin = "/etc/munin/plugins/$name"
- $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
-
- case $ensure {
- "absent": {
- file { $plugin: ensure => absent, }
- }
- default: {
- case $kernel {
- openbsd: { $basic_require = File['/var/run/munin'] }
- default: { $basic_require = Package['munin-node'] }
- }
- if $require { $real_require = [ $require, $basic_require ] }
- else {
- $real_require = $basic_require
- }
- file { $plugin:
- ensure => "${real_script_path}/${plugin_src}",
- require => $real_require,
- notify => Service['munin-node'];
- }
- }
- }
+ $plugin_src = $ensure ? { "present" => $name, default => $ensure }
+ $plugin = "/etc/munin/plugins/$name"
+ $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
+
+ case $ensure {
+ "absent": {
+ file { $plugin: ensure => absent, }
+ }
+ default: {
+ case $kernel {
+ openbsd: { $basic_require = File['/var/run/munin'] }
+ default: { $basic_require = Package['munin-node'] }
+ }
+ if $require {
+ $real_require = [ $require, $basic_require ]
+ } else {
+ $real_require = $basic_require
+ }
+ file { $plugin:
+ ensure => "${real_script_path}/${plugin_src}",
+ require => $real_require,
+ notify => Service['munin-node'];
+ }
- 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",
- mode => 0644, owner => root, group => 0,
- }
- if $require {
- File[$plugin_conf]{
- require +> $require,
+ }
+ }
+ 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",
+ mode => 0644, owner => root, group => 0,
+ }
+ if $require {
+ File[$plugin_conf]{
+ require +> $require,
+ }
+ }
+ }
}
- }
- }
- }
+ }
}
- }
}
+
diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp
index bfdf1be..164a17e 100644
--- a/manifests/plugin/scriptpaths.pp
+++ b/manifests/plugin/scriptpaths.pp
@@ -1,10 +1,12 @@
class munin::plugin::scriptpaths {
-
- case $operatingsystem {
- gentoo: { $script_path = "/usr/libexec/munin/plugins" }
- debian: { $script_path = "/usr/share/munin/plugins" }
- centos: { $script_path = "/usr/share/munin/plugins" }
- openbsd: { $script_path = "/opt/munin/lib/plugins/" }
- default: { $script_path = "/usr/share/munin/plugins" }
+ case $operatingsystem {
+ gentoo: { $script_path = "/usr/libexec/munin/plugins" }
+ debian: { $script_path = "/usr/share/munin/plugins" }
+ centos: { $script_path = "/usr/share/munin/plugins" }
+ openbsd: { $script_path = $operatingsystemrelease ? {
+ '4.3' => '/opt/munin/lib/plugins/',
+ default => '/usr/local/libexec/munin/plugins/'
+ } }
+ default: { $script_path = "/usr/share/munin/plugins" }
}
}
diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp
index de4b75b..03ed0e7 100644
--- a/manifests/plugins/interfaces.pp
+++ b/manifests/plugins/interfaces.pp
@@ -2,9 +2,9 @@
class munin::plugins::interfaces inherits munin::plugins::base {
$ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1")
-
+
munin::plugin { $ifs: ensure => "if_"; }
-
+
case $operatingsystem {
openbsd: {
$if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1")
@@ -15,7 +15,7 @@ class munin::plugins::interfaces inherits munin::plugins::base {
default: {
$if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1")
munin::plugin{
- $if_errs: ensure => "if_err_";
+ $if_errs: ensure => "if_err_";
}
}
}
diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp
index ffc4b0a..42a9bf4 100644
--- a/manifests/plugins/vserver.pp
+++ b/manifests/plugins/vserver.pp
@@ -1,9 +1,8 @@
class munin::plugins::vserver inherits munin::plugins::base {
- munin::plugin {
- [ netstat, processes ]:
- ensure => present;
- }
-
+ munin::plugin {
+ [ netstat, processes ]:
+ ensure => present;
+ }
}
diff --git a/manifests/register.pp b/manifests/register.pp
index 59500a0..21f1d35 100644
--- a/manifests/register.pp
+++ b/manifests/register.pp
@@ -1,30 +1,34 @@
-define munin::register(
+define munin::register (
$host = 'absent',
- $port = 'absent'
+ $port = 'absent',
+ $description = 'absent',
+ $config = []
)
{
- $munin_port_real = $port ? {
- 'absent' => $munin_port ? {
- '' => 4949,
- default => $munin_port
- },
- default => $port
- }
+ $fhost = $name
+ $client_type = 'client'
- $munin_host_real = $host ? {
- 'absent' => $munin_host ? {
- '' => $fqdn,
- 'fqdn' => $fqdn,
- default => $munin_host
- },
- default => $host
- }
-
- @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}":
- ensure => present,
- content => template("munin/defaultclient.erb"),
- tag => 'munin',
- }
-}
+ $munin_port_real = $port ? {
+ 'absent' => $munin_port ? {
+ '' => 4949,
+ default => $munin_port
+ },
+ default => $port
+ }
+ $munin_host_real = $host ? {
+ 'absent' => $munin_host ? {
+ '' => $fqdn,
+ 'fqdn' => $fqdn,
+ default => $munin_host
+ },
+ default => $host
+ }
+ @@file { "munin_client_${fhost}_${munin_port_real}":
+ ensure => present,
+ path => "/var/lib/puppet/modules/munin/nodes/${fhost}_${munin_port_real}",
+ content => template("munin/client.erb"),
+ tag => 'munin',
+ }
+}
diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp
new file mode 100644
index 0000000..c0d9279
--- /dev/null
+++ b/manifests/register/snmp.pp
@@ -0,0 +1,22 @@
+define munin::register::snmp (
+ $community = 'public',
+ $description = 'absent'
+)
+{
+ $fhost = $name
+ $munin_host_real = $fqdn
+ $client_type = 'snmp'
+ $config = [ 'use_node_name no' ]
+
+ exec { "munin_register_snmp_${fhost}":
+ command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh",
+ unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null",
+ }
+
+ @@file { "munin_snmp_${fhost}":
+ ensure => present,
+ path => "/var/lib/puppet/modules/munin/nodes/${fhost}",
+ content => template("munin/client.erb"),
+ tag => 'munin',
+ }
+}
diff --git a/manifests/register_snmp.pp b/manifests/register_snmp.pp
deleted file mode 100644
index 1ce606e..0000000
--- a/manifests/register_snmp.pp
+++ /dev/null
@@ -1,22 +0,0 @@
-# snmp_testplugin: the plugin we use to test if it's set
-define munin::register_snmp( $snmpd_testplugin = 'load' )
-{
- $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
- $munin_host_real = $munin_host ? {
- '' => '*',
- 'fqdn' => '*',
- default => $munin_host
- }
-
- exec{"register_snmp_munin_for_${name}":
- command => "munin-node-configure-snmp ${name} | sh",
- unless => "test -e /etc/munin/plugins/snmp_${name}_${snmpd_testplugin}",
- }
-
- @@file { "munin_snmp_${name}":
- path => "/var/lib/puppet/modules/munin/nodes/${name}",
- ensure => present,
- content => template("munin/snmpclient.erb"),
- tag => 'munin',
- }
-}
diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp
index cc83f8c..ce87492 100644
--- a/manifests/remoteplugin.pp
+++ b/manifests/remoteplugin.pp
@@ -1,18 +1,18 @@
-define munin::remoteplugin($ensure = "present", $source, $config = '')
-{
- case $ensure {
- "absent": { munin::plugin{ $name: ensure => absent } }
- default: {
- file { "/var/lib/puppet/modules/munin/plugins/${name}":
- source => $source,
- mode => 0755, owner => root, group => 0;
- }
- munin::plugin { $name:
- ensure => $ensure,
- config => $config,
- script_path_in => "/var/lib/puppet/modules/munin/plugins",
- }
+define munin::remoteplugin($ensure = "present", $source, $config = '') {
+ case $ensure {
+ "absent": { munin::plugin{ $name: ensure => absent } }
+ default: {
+ file {
+ "/var/lib/puppet/modules/munin/plugins/${name}":
+ source => $source,
+ mode => 0755, owner => root, group => 0;
+ }
+ munin::plugin { $name:
+ ensure => $ensure,
+ config => $config,
+ script_path_in => "/var/lib/puppet/modules/munin/plugins",
+ }
+ }
}
- }
}
diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp
index 3b60541..6f3fe34 100644
--- a/manifests/snmp_collector.pp
+++ b/manifests/snmp_collector.pp
@@ -1,14 +1,14 @@
-class munin::snmp_collector {
+class munin::snmp_collector{
+ file {
+ "/var/lib/puppet/modules/munin/create_snmp_links":
+ source => "puppet://$server/modules/munin/create_snmp_links.sh",
+ mode => 755, owner => root, group => 0;
+ }
- file { "/var/lib/puppet/modules/munin/create_snmp_links":
- source => "puppet://$server/modules/munin/create_snmp_links.sh",
- mode => 755, owner => root, group => 0;
- }
-
- exec { "create_snmp_links":
- command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes",
- require => File["snmp_links"],
- timeout => "2048",
- schedule => daily
- }
+ 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/templates/client.erb b/templates/client.erb
new file mode 100644
index 0000000..e7c6730
--- /dev/null
+++ b/templates/client.erb
@@ -0,0 +1,18 @@
+<%
+ # Downcase all information
+ dom = domain.downcase
+ host = hostname.downcase
+%>
+
+### Munin client from Puppet template
+# Domain: <%= dom %>
+# Registered on: <%= host %>
+# Type: <%= client_type %>
+<% if description != 'absent' -%>
+# Description: <%= description.gsub!(/\n/, ' ') %>
+<% end -%>
+[<%= fhost.downcase %>]
+ address <%= munin_host_real -%>
+<% if config -%><% config.each do |val| -%>
+ <%= val -%>
+<% end -%><% end -%>
diff --git a/templates/defaultclient.erb b/templates/defaultclient.erb
deleted file mode 100644
index 5611bf4..0000000
--- a/templates/defaultclient.erb
+++ /dev/null
@@ -1,15 +0,0 @@
-<%
- # Downcase all information
- dom = domain.downcase
- host = hostname.downcase
- fhost = name.downcase
-%>
-### This syntax can be extended, it might get better ...
-#+<%= dom %>
-#-<%= host %>=<%= fhost %>:load.load
-[<%= fhost %>] # linux box
- address <%= munin_host_real %>
- port <%= munin_port_real %>
- use_node_name yes
- load.load.warning 5
- load.load.critical 10
diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default
index befcae4..e584df1 100644
--- a/templates/munin-node.conf.default
+++ b/templates/munin-node.conf.default
@@ -1,21 +1,25 @@
##########
########## 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
-setseid 1
+setsid 1
user root
group 0
-setsid yes
# 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)$
@@ -29,14 +33,24 @@ ignore_file \.pod$
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
+# 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
<% real_munin_allow.split(':').each do |val| -%>
allow <%= '^'+val.gsub(/\./, '\.')+'$' %>
<% end -%>
+# If you have installed the Net::CIDR perl module, you can use
+# multiple cidr_allow and cidr_deny address/mask patterns. A
+# connecting client must match any cidr_allow, and not match any
+# cidr_deny. 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 <%= munin_host_real %>
# host 127.0.0.1
diff --git a/templates/snmpclient.erb b/templates/snmpclient.erb
deleted file mode 100644
index 44ecc6d..0000000
--- a/templates/snmpclient.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-<%
- # Downcase all information
- dom = domain.downcase
- host = hostname.downcase
- fhost = name.downcase
-%>
-### This syntax can be extended, it might get better ...
-#<%= dom %> snmp -> <%= fhost %>
-[<%= fhost %>] # snmp box
- address <%= munin_host_real %>