summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authormicah <micah@muck.riseup.net>2013-03-20 18:25:28 -0400
committermicah <micah@muck.riseup.net>2013-03-20 18:25:28 -0400
commitc9748747c5c755443d80445a9a6c3f5d2ab3bc7f (patch)
tree65887003b9bceefd7a6ba3e3692b9a6f08373304 /manifests
parent149a78e7a8465da97f8ea267cd6a75e3bcdefe4d (diff)
parentf79f662bedbbd75c7e2022da282ba48c1b323e90 (diff)
Merge branch 'immerda/master'
Conflicts: files/plugins/xen-cpu templates/munin-node.conf.Debian.squeeze
Diffstat (limited to 'manifests')
-rw-r--r--manifests/client.pp42
-rw-r--r--manifests/client/base.pp50
-rw-r--r--manifests/client/centos.pp2
-rw-r--r--manifests/client/darwin.pp40
-rw-r--r--manifests/client/debian.pp27
-rw-r--r--manifests/client/gentoo.pp2
-rw-r--r--manifests/client/openbsd.pp105
-rw-r--r--manifests/client/package.pp27
-rw-r--r--manifests/host.pp52
-rw-r--r--manifests/host/cgi.pp30
-rw-r--r--manifests/init.pp5
-rw-r--r--manifests/plugin.pp102
-rw-r--r--manifests/plugin/deploy.pp49
-rw-r--r--manifests/plugin/scriptpaths.pp20
-rw-r--r--manifests/plugins/apache.pp4
-rw-r--r--manifests/plugins/base.pp10
-rw-r--r--manifests/plugins/dom0.pp2
-rw-r--r--manifests/plugins/gentoo.pp6
-rw-r--r--manifests/plugins/interfaces.pp19
-rw-r--r--manifests/plugins/kvm.pp7
-rw-r--r--manifests/plugins/linux.pp2
-rw-r--r--manifests/plugins/physical.pp2
-rw-r--r--manifests/plugins/selinux.pp2
-rw-r--r--manifests/plugins/setup.pp26
-rw-r--r--manifests/register.pp40
-rw-r--r--manifests/register/snmp.pp33
-rw-r--r--manifests/remoteplugin.pp28
-rw-r--r--manifests/snmp_collector.pp22
28 files changed, 361 insertions, 395 deletions
diff --git a/manifests/client.pp b/manifests/client.pp
index 273070d..2316bc9 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -3,24 +3,28 @@
# See LICENSE for the full license granted to you.
# Adapted and improved by admin(at)immerda.ch
-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::package }
- default: { include munin::client::base }
- }
- if $use_shorewall {
- include shorewall::rules::munin
+class munin::client(
+ $allow = [ '127.0.0.1' ],
+ $host = '*',
+ $port = '4949',
+ $use_ssh = false,
+ $manage_shorewall = false,
+ $shorewall_collector_source = 'net',
+ $export_tag = 'munin'
+) {
+ case $::operatingsystem {
+ openbsd: { include munin::client::openbsd }
+ darwin: { include munin::client::darwin }
+ debian,ubuntu: { include munin::client::debian }
+ gentoo: { include munin::client::gentoo }
+ centos: { include munin::client::package }
+ default: { include munin::client::base }
+ }
+ if $munin::client::manage_shorewall {
+ class{'shorewall::rules::munin':
+ munin_port => $port,
+ munin_collector => delete($allow,'127.0.0.1'),
+ collector_source => $shorewall_collector_source,
}
+ }
}
diff --git a/manifests/client/base.pp b/manifests/client/base.pp
index 7c2adc2..78398a9 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -1,26 +1,28 @@
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:
- config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
- }
- include munin::plugins::base
+ service { 'munin-node':
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ hasrestart => true,
+ }
+ file {'/etc/munin':
+ ensure => directory,
+ mode => 0755, owner => root, group => 0;
+ }
+ file {'/etc/munin/munin-node.conf':
+ content => template("munin/munin-node.conf.${::operatingsystem}"),
+ notify => Service['munin-node'],
+ mode => 0644, owner => root, group => 0,
+ }
+ munin::register { $::fqdn:
+ 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,
+ }
+ include munin::plugins::base
}
diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp
index 42e8c59..3a7151b 100644
--- a/manifests/client/centos.pp
+++ b/manifests/client/centos.pp
@@ -1,3 +1,3 @@
class munin::client::centos inherits munin::client::package {
- include munin::plugins::centos
+ include munin::plugins::centos
}
diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp
index 9cfe7e9..264263d 100644
--- a/manifests/client/darwin.pp
+++ b/manifests/client/darwin.pp
@@ -1,22 +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,
+ }
+ line{"startsnmpdno":
+ file => "/etc/hostconfig",
+ line => "SNMPSERVER=-NO-",
+ ensure => 'absent',
+ }
+ 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 60b496d..e67ac26 100644
--- a/manifests/client/debian.pp
+++ b/manifests/client/debian.pp
@@ -1,18 +1,15 @@
class munin::client::debian inherits munin::client::package {
+ # the plugin will need that
+ package { "iproute": ensure => installed }
- # the plugin will need that
- if !defined(Package['iproute']) {
- 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 d4fe71e..e79f6b0 100644
--- a/manifests/client/gentoo.pp
+++ b/manifests/client/gentoo.pp
@@ -5,5 +5,5 @@ class munin::client::gentoo inherits munin::client::package {
category => 'net-analyzer',
}
- include munin::plugins::gentoo
+ include munin::plugins::gentoo
}
diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp
index 89b5752..cd21abf 100644
--- a/manifests/client/openbsd.pp
+++ b/manifests/client/openbsd.pp
@@ -2,60 +2,61 @@
# :(
class munin::client::openbsd inherits munin::client::base {
-
- if $operatingsystemrelease == '4.3' {
- file{'/usr/src/munin_openbsd.tar.gz':
- source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz",
- owner => root, group => 0, mode => 0600;
- }
- exec{'extract_openbsd':
- command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz',
- unless => 'test -d /opt/munin',
- require => File['/usr/src/munin_openbsd.tar.gz'],
- before => File['/var/run/munin'],
- }
- package{'p5-Compress-Zlib':
- ensure => installed,
- before => File['/var/run/munin'],
- }
- } else {
- package{'munin-node':
- ensure => installed,
- }
- }
- package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP',
- 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server',
- 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
- ensure => installed,
- before => File['/var/run/munin'],
- }
- file{[ '/var/run/munin', '/var/log/munin' ]:
- ensure => directory,
- owner => root, group => 0, mode => 0755;
+ 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';
}
- 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'],
+ 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'],
}
- 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'] ],
+ package{'p5-Compress-Zlib':
+ ensure => installed,
+ before => File['/var/run/munin'],
}
- cron{'clean_munin_logfile':
- command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
- minute => 0,
- hour => 2,
- weekday => 0,
+ } else {
+ package{'munin-node':
+ ensure => installed,
}
+ }
+ package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP',
+ 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server',
+ 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
+ ensure => installed,
+ before => File['/var/run/munin'],
+ }
+ file{[ '/var/run/munin', '/var/log/munin' ]:
+ ensure => directory,
+ owner => root,
+ group => 0,
+ mode => '0755';
+ }
+ $bin_loc = $::operatingsystemrelease ? {
+ '4.3' => '/opt/munin/sbin/munin-node',
+ default => '/usr/local/sbin/munin-node'
+ }
+ openbsd::rc_local{'munin-node':
+ binary => $bin_loc,
+ require => File['/var/run/munin'],
+ }
+ Service['munin-node']{
+ restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
+ stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
+ start => $bin_loc,
+ status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^ *$(cat /var/run/munin/munin-node.pid).*munin-node")',
+ hasstatus => true,
+ hasrestart => true,
+ require => [ File['/var/run/munin'], File['/var/log/munin'] ],
+ }
+ cron{'clean_munin_logfile':
+ command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
+ minute => 0,
+ hour => 2,
+ weekday => 0,
+ }
}
diff --git a/manifests/client/package.pp b/manifests/client/package.pp
index 29f256d..206ccc8 100644
--- a/manifests/client/package.pp
+++ b/manifests/client/package.pp
@@ -1,21 +1,12 @@
class munin::client::package inherits munin::client::base {
-
- if $munin_node_ensure_version == '' { $munin_node_ensure_version = 'installed' }
-
- if $operatingsystem == "Debian" and $lsbdistcodename != "lenny" {
- package { 'munin-common':
- before => Package['munin-node'],
- ensure => $munin_node_ensure_version;
- }
- }
- package { 'munin-node': ensure => $munin_node_ensure_version }
- Service['munin-node']{
- require => Package[munin-node],
- }
- File['/etc/munin/munin-node.conf']{
- # this has to be installed before the package, so the postinst can
- # boot the munin-node without failure!
- before => Package['munin-node'],
- }
+ package { 'munin-node': ensure => installed }
+ Service['munin-node']{
+ require => Package[munin-node],
+ }
+ File['/etc/munin/munin-node.conf']{
+ # this has to be installed before the package, so the postinst can
+ # boot the munin-node without failure!
+ before => Package['munin-node'],
+ }
}
diff --git a/manifests/host.pp b/manifests/host.pp
index 0d069e1..05dcb5e 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -2,40 +2,35 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-class munin::host inherits munin
-{
+class munin::host(
+ $cgi_graphing = false,
+ $export_tag = 'munin'
+) {
+ package {"munin": ensure => installed, }
+ include concat::setup
- if $munin_ensure_version == '' { $munin_ensure_version = 'installed' }
+ Concat::Fragment <<| tag == $export_tag |>>
- package {"munin": ensure => $munin_ensure_version, }
-
- File <<| tag == 'munin' |>>
-
- file{'/etc/munin/munin.conf.header':
- source => [ "puppet:///modules/site_munin/config/host/${fqdn}/munin.conf.header",
- "puppet:///modules/site_munin/config/host/munin.conf.header.$operatingsystem",
+ concat::fragment{'munin.conf.header':
+ target => '/etc/munin/munin.conf',
+ source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/munin.conf.header",
+ "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}",
+ "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}",
"puppet:///modules/site_munin/config/host/munin.conf.header",
- "puppet:///modules/munin/config/host/munin.conf.header.$operatingsystem",
+ "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}",
+ "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}",
"puppet:///modules/munin/config/host/munin.conf.header" ],
- notify => Exec['concat_/etc/munin/munin.conf'],
- owner => root, group => 0, mode => 0644;
+ order => 05,
}
-
- concatenated_file { "/etc/munin/munin.conf":
- dir => '/var/lib/puppet/modules/munin/nodes',
- header => "/etc/munin/munin.conf.header",
- }
-
- file { ["/var/log/munin-update.log", "/var/log/munin-limits.log",
- "/var/log/munin-graph.log", "/var/log/munin-html.log"]:
- ensure => present,
- mode => 640, owner => munin, group => 0;
+
+ concat{ "/etc/munin/munin.conf":
+ owner => root, group => 0, mode => 0644;
}
-
+
include munin::plugins::muninhost
-
- case $operatingsystem {
- centos: { include munin::host::cgi }
+
+ if $munin::host::cgi_graphing {
+ include munin::host::cgi
}
# from time to time we cleanup hanging munin-runs
@@ -43,8 +38,7 @@ class munin::host inherits munin
content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n",
owner => root, group => 0, mode => 0644;
}
-
- if $use_shorewall {
+ if $munin::host::manage_shorewall {
include shorewall::rules::out::munin
}
}
diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp
index 8b35d8b..9980856 100644
--- a/manifests/host/cgi.pp
+++ b/manifests/host/cgi.pp
@@ -1,27 +1,15 @@
-class munin::host::cgi inherits munin::host {
-
- case $operatingsystem {
- debian: {
- exec { 'set_modes_for_cgi':
- command => 'chgrp www-data /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/cache/munin/www/* -maxdepth 1 -type d -exec chgrp -R www-data {} \; && find /var/cache/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
- refreshonly => true,
- subscribe => File['/etc/munin/munin.conf.header'],
- }
- }
- default: {
- exec { 'set_modes_for_cgi':
- command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
- refreshonly => true,
- subscribe => File['/etc/munin/munin.conf.header'],
- }
- }
+class munin::host::cgi {
+ exec{'set_modes_for_cgi':
+ command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
+ refreshonly => true,
+ subscribe => File['/etc/munin/munin.conf.header'],
}
-
+
file{'/etc/logrotate.d/munin':
- source => [ "puppet:///modules/site_munin/config/host/${fqdn}/logrotate",
- "puppet:///modules/site_munin/config/host/logrotate.$operatingsystem",
+ source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/logrotate",
+ "puppet:///modules/site_munin/config/host/logrotate.${::operatingsystem}",
"puppet:///modules/site_munin/config/host/logrotate",
- "puppet:///modules/munin/config/host/logrotate.$operatingsystem",
+ "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}",
"puppet:///modules/munin/config/host/logrotate" ],
owner => root, group => 0, mode => 0644;
}
diff --git a/manifests/init.pp b/manifests/init.pp
index bae83a4..b015521 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -14,8 +14,3 @@
#
# the port is a parameter so vservers can share
# IP addresses and still be happy
-
-class munin {
- include common::moduledir
- module_dir { [ "munin", "munin/nodes", "munin/plugins" ]: }
-}
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index d243b66..ffe5452 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -1,67 +1,57 @@
-# plugin.pp - configure a specific munin plugin
-# 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
-
-### defines
-
+# configure a specific munin plugin
define munin::plugin (
- $ensure = "present",
- $script_path_in = '',
- $config = '' )
-{
- include munin::plugin::scriptpaths
- $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
+ $ensure = 'present',
+ $script_path_in = '',
+ $config = ''
+) {
+ include munin::plugin::scriptpaths
+ $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
- $plugin_src = $ensure ? { "present" => $name, default => $ensure }
- $plugin = "/etc/munin/plugins/$name"
- $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
-
- include munin::plugins::setup
- case $ensure {
- "absent": {
- file { $plugin: ensure => absent, }
- }
- default: {
- case $kernel {
- openbsd: { $basic_require = File['/var/run/munin'] }
- default: { $basic_require = Package['munin-node'] }
- }
- if $require {
- $real_require = [ $require, $basic_require ]
- } else {
- $real_require = $basic_require
- }
- file { $plugin:
- ensure => "${real_script_path}/${plugin_src}",
- require => $real_require,
- notify => Service['munin-node'];
- }
+ $plugin_src = $ensure ? { 'present' => $name, default => $ensure }
+ $plugin = "/etc/munin/plugins/${name}"
+ $plugin_conf = "/etc/munin/plugin-conf.d/${name}.conf"
+ include munin::plugins::setup
+ case $ensure {
+ 'absent': {
+ file { $plugin: ensure => absent, }
+ }
+ default: {
+ $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 ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
+ File[$plugin]{
+ seltype => 'munin_etc_t',
}
+ }
+ }
+ }
+ case $config {
+ '': {
+ file { $plugin_conf: ensure => absent }
}
- case $config {
- '': {
- file { $plugin_conf: ensure => absent }
+ default: {
+ case $ensure {
+ absent: {
+ file { $plugin_conf: ensure => absent }
}
default: {
- case $ensure {
- absent: {
- file { $plugin_conf: ensure => absent }
- }
- default: {
- file { $plugin_conf:
- content => "[${name}]\n$config\n",
- mode => 0640, owner => root, group => 0,
- }
- if $require {
- File[$plugin_conf]{
- require +> $require,
- }
- }
- }
- }
+ file { $plugin_conf:
+ content => "[${name}]\n${config}\n",
+ owner => root,
+ group => 0,
+ mode => '0640',
+ }
}
+ }
}
+ }
}
diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp
index 0ab4e9f..cbf64fb 100644
--- a/manifests/plugin/deploy.pp
+++ b/manifests/plugin/deploy.pp
@@ -1,39 +1,44 @@
-define munin::plugin::deploy( $source = '', $ensure = 'present', $config = '' )
-{
+# deploy and register a munin plugin
+define munin::plugin::deploy(
+ $ensure = 'present',
+ $source = '',
+ $config = '',
+ $seltype = 'munin_exec_t'
+) {
$plugin_src = $ensure ? {
'present' => $name,
- 'absent' => $name,
- default => $ensure
+ 'absent' => $name,
+ default => $ensure
}
-
$real_source = $source ? {
- '' => "munin/plugins/$plugin_src",
+ '' => "munin/plugins/${plugin_src}",
default => $source
}
-
include munin::plugin::scriptpaths
-
file { "munin_plugin_${name}":
- path => "$munin::plugin::scriptpaths::script_path/${name}",
- source => "puppet://$server/modules/$real_source",
- mode => 0755, owner => root, group => 0;
+ path => "${munin::plugin::scriptpaths::script_path}/${name}",
+ source => "puppet:///modules/${real_source}",
+ owner => root,
+ group => 0,
+ mode => '0755';
}
- case $kernel {
- openbsd: { $basic_require = File['/var/run/munin'] }
- default: { $basic_require = Package['munin-node'] }
- }
-
- if $require { File["munin_plugin_${name}"]{ require => [ $basic_require, $require ] } }
- else {
+ if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
File["munin_plugin_${name}"]{
- require => $basic_require,
+ seltype => $seltype,
}
}
+ case $::kernel {
+ openbsd: { $basic_require = File['/var/run/munin'] }
+ default: { $basic_require = Package['munin-node'] }
+ }
+ File["munin_plugin_${name}"]{
+ require => $basic_require,
+ }
# register the plugin
- if $require { munin::plugin{$name: ensure => $ensure, config => $config, require => $require } }
- else {
- munin::plugin{$name: ensure => $ensure, config => $config }
+ munin::plugin{$name:
+ ensure => $ensure,
+ config => $config
}
}
diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp
index 164a17e..2cad97b 100644
--- a/manifests/plugin/scriptpaths.pp
+++ b/manifests/plugin/scriptpaths.pp
@@ -1,12 +1,12 @@
class munin::plugin::scriptpaths {
- case $operatingsystem {
- gentoo: { $script_path = "/usr/libexec/munin/plugins" }
- debian: { $script_path = "/usr/share/munin/plugins" }
- centos: { $script_path = "/usr/share/munin/plugins" }
- openbsd: { $script_path = $operatingsystemrelease ? {
- '4.3' => '/opt/munin/lib/plugins/',
- default => '/usr/local/libexec/munin/plugins/'
- } }
- default: { $script_path = "/usr/share/munin/plugins" }
- }
+ case $::operatingsystem {
+ gentoo: { $script_path = "/usr/libexec/munin/plugins" }
+ debian: { $script_path = "/usr/share/munin/plugins" }
+ centos: { $script_path = "/usr/share/munin/plugins" }
+ openbsd: { $script_path = $::operatingsystemrelease ? {
+ '4.3' => '/opt/munin/lib/plugins/',
+ default => '/usr/local/libexec/munin/plugins/'
+ } }
+ default: { $script_path = "/usr/share/munin/plugins" }
+ }
}
diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp
deleted file mode 100644
index b3e7634..0000000
--- a/manifests/plugins/apache.pp
+++ /dev/null
@@ -1,4 +0,0 @@
-class munin::plugins::apache {
- munin::plugin{ [ 'apache_accesses', 'apache_processes',' apache_volume' ]: }
- munin::plugin::deploy { "apache_activity": }
-}
diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp
index bfccae5..c6b88ed 100644
--- a/manifests/plugins/base.pp
+++ b/manifests/plugins/base.pp
@@ -1,14 +1,18 @@
class munin::plugins::base {
-
# setup basic plugins
munin::plugin {
[ 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;
+ }
include munin::plugins::interfaces
- case $kernel {
+ case $::kernel {
openbsd: { include munin::plugins::openbsd }
linux: {
case $vserver {
@@ -18,7 +22,7 @@ class munin::plugins::base {
}
}
- case $virtual {
+ case $::virtual {
physical: { include munin::plugins::physical }
xen0: { include munin::plugins::dom0 }
}
diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp
index ed4f62c..44995fc 100644
--- a/manifests/plugins/dom0.pp
+++ b/manifests/plugins/dom0.pp
@@ -1,6 +1,6 @@
class munin::plugins::dom0 {
munin::plugin::deploy {
- [ 'xen', 'xen-cpu', 'xen_memory', 'xen_mem',
+ [ 'xen', 'xen_cpu', 'xen_memory', 'xen_mem',
'xen_vm', 'xen_vbd', 'xen_traffic_all' ]:
config => 'user root';
}
diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp
index 25c1626..27d4689 100644
--- a/manifests/plugins/gentoo.pp
+++ b/manifests/plugins/gentoo.pp
@@ -1,5 +1,5 @@
class munin::plugins::gentoo {
- munin::plugin::deploy { 'gentoo_lastupdated':
- config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep"
- }
+ munin::plugin::deploy { 'gentoo_lastupdated':
+ config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep"
+ }
}
diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp
index 18a713b..da89ed0 100644
--- a/manifests/plugins/interfaces.pp
+++ b/manifests/plugins/interfaces.pp
@@ -1,21 +1,24 @@
# 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+|__tmp\d+')
+ $ifs = regsubst($real_ifs, '(.+)', "if_\\1")
- $ifs = regsubst(split($interfaces, " |,"), "(.+)", "if_\\1")
munin::plugin {
- $ifs: ensure => "if_";
+ $ifs: ensure => 'if_';
}
- case $operatingsystem {
+ case $::operatingsystem {
openbsd: {
- $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1")
+ $if_errs = regsubst($real_ifs, '(.+)', "if_errcoll_\\1")
munin::plugin{
- $if_errs: ensure => "if_errcoll_";
+ $if_errs: ensure => 'if_errcoll_';
}
}
default: {
- $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_err_\\1")
+ $if_errs = regsubst($real_ifs, '(.+)', "if_err_\\1")
munin::plugin{
- $if_errs: ensure => "if_err_";
+ $if_errs: ensure => 'if_err_';
}
}
}
diff --git a/manifests/plugins/kvm.pp b/manifests/plugins/kvm.pp
new file mode 100644
index 0000000..7a1430f
--- /dev/null
+++ b/manifests/plugins/kvm.pp
@@ -0,0 +1,7 @@
+class munin::plugins::kvm {
+ munin::plugin::deploy {
+ [ 'kvm_cpu', 'kvm_mem', 'kvm_net' ]:;
+ 'kvm_io':
+ config => 'user root';
+ }
+}
diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp
index 30e0af6..a73de63 100644
--- a/manifests/plugins/linux.pp
+++ b/manifests/plugins/linux.pp
@@ -3,6 +3,6 @@ class munin::plugins::linux {
[ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]:
ensure => present;
acpi:
- ensure => $acpi_available;
+ ensure => $::acpi_available;
}
}
diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp
index ac050a5..a1c27a7 100644
--- a/manifests/plugins/physical.pp
+++ b/manifests/plugins/physical.pp
@@ -1,5 +1,5 @@
class munin::plugins::physical {
- case $kernel {
+ case $::kernel {
linux: { munin::plugin { iostat: } }
}
}
diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp
index faf610a..d094f35 100644
--- a/manifests/plugins/selinux.pp
+++ b/manifests/plugins/selinux.pp
@@ -1,3 +1,3 @@
class munin::plugins::selinux {
- munin::plugin::deploy { [ 'selinuxenforced', 'selinux_avcstats' ]: }
+ munin::plugin{ [ 'selinux_avcstat' ]: }
}
diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp
index 2dff15d..197b657 100644
--- a/manifests/plugins/setup.pp
+++ b/manifests/plugins/setup.pp
@@ -5,18 +5,24 @@ class munin::plugins::setup {
file {
[ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]:
- source => "puppet:///modules/common/empty",
- ignore => [ '.ignore', 'snmp_*' ],
- ensure => directory, checksum => mtime,
- recurse => true, purge => true, force => true,
- mode => 0755, owner => root, group => 0,
- notify => Service['munin-node'];
+ ignore => 'snmp_*',
+ ensure => directory,
+ checksum => mtime,
+ recurse => true,
+ purge => true,
+ force => true,
+ notify => Service['munin-node'],
+ owner => root,
+ group => 0,
+ mode => '0755';
'/etc/munin/plugin-conf.d/munin-node':
- ensure => present,
- mode => 0640, owner => root, group => 0,
- notify => Service['munin-node'],
+ ensure => present,
+ notify => Service['munin-node'],
+ owner => root,
+ group => 0,
+ mode => '0640';
}
- case $kernel {
+ case $::kernel {
openbsd: {
File['/etc/munin/plugin-conf.d/munin-node']{
before => File['/var/run/munin'],
diff --git a/manifests/register.pp b/manifests/register.pp
index 21f1d35..309c322 100644
--- a/manifests/register.pp
+++ b/manifests/register.pp
@@ -1,34 +1,18 @@
define munin::register (
- $host = 'absent',
- $port = 'absent',
+ $host = $::fqdn,
+ $port = '4949',
+ $use_ssh = false,
$description = 'absent',
- $config = []
+ $config = [],
+ $export_tag = 'munin'
)
{
- $fhost = $name
- $client_type = 'client'
+ $fhost = $name
+ $client_type = 'client'
- $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',
- }
+ @@concat::fragment{ "munin_client_${fhost}_${port}":
+ target => '/etc/munin/munin.conf',
+ content => template("munin/client.erb"),
+ tag => $export_tag,
+ }
}
diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp
index 0c3ac5c..78c3e91 100644
--- a/manifests/register/snmp.pp
+++ b/manifests/register/snmp.pp
@@ -1,22 +1,21 @@
define munin::register::snmp (
$community = 'public',
- $description = 'absent'
-)
-{
- $fhost = $name
- $munin_host_real = $fqdn
- $client_type = 'snmp'
- $config = [ 'use_node_name no' ]
+ $description = 'absent',
+ $port = '4949',
+ $host = $::fqdn
+) {
+ $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",
- }
+ exec { "munin_register_snmp_${fhost}":
+ command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | 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',
- }
+ @@concat::fragment{ "munin_snmp_${fhost}":
+ target => '/etc/munin/munin.conf',
+ content => template("munin/client.erb"),
+ tag => 'munin',
+ }
}
diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp
index ce87492..603cb66 100644
--- a/manifests/remoteplugin.pp
+++ b/manifests/remoteplugin.pp
@@ -1,18 +1,18 @@
define munin::remoteplugin($ensure = "present", $source, $config = '') {
- case $ensure {
- "absent": { munin::plugin{ $name: ensure => absent } }
- default: {
- file {
- "/var/lib/puppet/modules/munin/plugins/${name}":
- source => $source,
- mode => 0755, owner => root, group => 0;
- }
- munin::plugin { $name:
- ensure => $ensure,
- config => $config,
- script_path_in => "/var/lib/puppet/modules/munin/plugins",
- }
- }
+ case $ensure {
+ "absent": { munin::plugin{ $name: ensure => absent } }
+ default: {
+ file {
+ "/var/lib/puppet/modules/munin/plugins/${name}":
+ source => $source,
+ mode => 0755, owner => root, group => 0;
+ }
+ munin::plugin { $name:
+ ensure => $ensure,
+ config => $config,
+ script_path_in => "/var/lib/puppet/modules/munin/plugins",
+ }
}
+ }
}
diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp
index 7bd8bba..0f8318a 100644
--- a/manifests/snmp_collector.pp
+++ b/manifests/snmp_collector.pp
@@ -1,14 +1,14 @@
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 => 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
+ }
}