summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/client.pp21
-rw-r--r--manifests/client/base.pp14
-rw-r--r--manifests/host.pp13
-rw-r--r--manifests/init.pp38
-rw-r--r--templates/munin-node.conf.erb8
5 files changed, 57 insertions, 37 deletions
diff --git a/manifests/client.pp b/manifests/client.pp
index 724ff05..aca899a 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -3,18 +3,7 @@
# Adapted and improved by admin(at)immerda.ch
# configure a munin node
-class munin::client(
- $allow = [ '127.0.0.1' ],
- $host = '*',
- $host_name = $::fqdn,
- $port = '4949',
- $use_ssh = false,
- $manage_shorewall = false,
- $shorewall_collector_source = 'net',
- $export_tag = 'munin',
- $description = 'absent',
- $munin_group = 'absent',
-) {
+class munin::client {
case $::operatingsystem {
openbsd: { include munin::client::openbsd }
@@ -24,11 +13,11 @@ class munin::client(
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 6ed0f71..8ee8b95 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -26,19 +26,19 @@ class munin::client::base inherits munin::client::params {
owner => root,
group => 0,
}
- $host = $munin::client::host ? {
+ $host = $munin::host ? {
'*' => $::fqdn,
- default => $munin::client::host
+ default => $munin::host
}
munin::register { $::fqdn:
host => $host,
- port => $munin::client::port,
- use_ssh => $munin::client::use_ssh,
- description => $munin::client::description,
- group => $munin::client::munin_group,
+ 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::client::export_tag,
+ export_tag => $munin::export_tag,
}
include munin::plugins::base
}
diff --git a/manifests/host.pp b/manifests/host.pp
index 0e5fb01..9831052 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -2,11 +2,8 @@
# 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,
- $cgi_owner = 'os_default',
- $export_tag = 'munin'
-) {
+class munin::host {
+
package {'munin': ensure => installed, }
Concat::Fragment <<| tag == $export_tag |>>
@@ -31,9 +28,9 @@ class munin::host(
include munin::plugins::muninhost
- if $munin::host::cgi_graphing {
+ if $munin::cgi_graphing {
class {'munin::host::cgi':
- owner => $cgi_owner,
+ owner => $munin::cgi_owner,
}
}
@@ -44,7 +41,7 @@ class munin::host(
user => 'root',
}
- if $munin::host::manage_shorewall {
+ if $munin::manage_shorewall {
include shorewall::rules::out::munin
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 54b489b..bbabf2e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -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/templates/munin-node.conf.erb b/templates/munin-node.conf.erb
index b0c8fc8..f51a665 100644
--- a/templates/munin-node.conf.erb
+++ b/templates/munin-node.conf.erb
@@ -34,13 +34,13 @@ ignore_file \.pod$
# Set this if the client doesn't report the correct hostname when
# telnetting to localhost, port 4949
#
-host_name <%= scope.lookupvar('munin::client::host_name') %>
+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 -%>
@@ -56,7 +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 <%= scope.lookupvar('munin::host') %>
# And which port
-port <%= scope.lookupvar('munin::client::port') %>
+port <%= scope.lookupvar('munin::port') %>