summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README10
-rw-r--r--files/modules_dir/.ignore0
-rw-r--r--lib/facter/acpi_available.rb14
-rw-r--r--manifests/host.pp2
-rw-r--r--manifests/init.pp4
-rw-r--r--manifests/plugin.pp122
-rw-r--r--templates/defaultclient.erb3
-rw-r--r--[l---------]templates/munin-node.conf.Debian.lenny40
l---------templates/munin-node.conf.Debian.sid2
l---------templates/munin-node.conf.Debian.squeeze1
-rw-r--r--templates/site.conf9
11 files changed, 192 insertions, 15 deletions
diff --git a/README b/README
index 5964b21..10e6136 100644
--- a/README
+++ b/README
@@ -45,11 +45,13 @@ To use this module, follow these directions:
d. Add to the top of your site.pp a variable which indicates what IP should be allowed to
connect to your individual munin-nodes (this is typically your main munin host's IP):
- $munin_allow = '192.168.0.1'
-
- If you want to define more than one host, you can seperate them by colon:
+ $munin_cidr_allow = '192.168.0.1/32'
+
+ You can also put an array there.
+
+ On pre-lenny systems, you have to use the older Regexp-variant:
- $munin_allow = '127.0.0.1:192.168.0.1'
+ $munin_allow = '^192\.168\.0\.1$'
e. In the node definition in your site.pp for your main munin host, add the following:
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/lib/facter/acpi_available.rb b/lib/facter/acpi_available.rb
index 9a0474f..e3d8dfa 100644
--- a/lib/facter/acpi_available.rb
+++ b/lib/facter/acpi_available.rb
@@ -1,10 +1,10 @@
# 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?
- "absent"
- else
- "present"
- end
- end
+ setcode do
+ if `acpi -t -B -A 2>/dev/null`.match(/\d/).nil?
+ "absent"
+ else
+ "present"
+ end
+ end
end
diff --git a/manifests/host.pp b/manifests/host.pp
index af78570..9fd637d 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -2,7 +2,7 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-class munin::host
+class munin::host inherits munin
{
package {"munin": ensure => installed, }
diff --git a/manifests/init.pp b/manifests/init.pp
index 983c7d5..578c4bb 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -15,4 +15,6 @@
# the port is a parameter so vservers can share
# IP addresses and still be happy
-modules_dir { [ "munin", "munin/nodes", "munin/plugins" ]: }
+class munin {
+ module_dir { [ "munin", "munin/nodes", "munin/plugins" ]: }
+}
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 1fa4651..75c4423 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -10,6 +10,127 @@ define munin::plugin (
$script_path_in = '',
$config = '')
{
+<<<<<<< HEAD
+ debug ( "munin_plugin: name=$name, ensure=$ensure, script_path=$script_path" )
+ $plugin = "/etc/munin/plugins/$name"
+ $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
+ case $ensure {
+ "absent": {
+ debug ( "munin_plugin: suppressing $plugin" )
+ file { $plugin: ensure => absent, }
+ }
+ default: {
+ $plugin_src = $ensure ? { "present" => $name, default => $ensure }
+ debug ( "munin_plugin: making $plugin using src: $plugin_src" )
+ file { $plugin:
+ ensure => "$script_path/${plugin_src}",
+ require => Package["munin-node"],
+ notify => Service["munin-node"],
+ }
+ }
+ }
+ case $config {
+ '': {
+ debug("no config for $name")
+ file { $plugin_conf: ensure => absent }
+ }
+ default: {
+ case $ensure {
+ absent: {
+ debug("removing config for $name")
+ file { $plugin_conf: ensure => absent }
+ }
+ default: {
+ debug("creating $plugin_conf")
+ file { $plugin_conf:
+ content => "[${name}]\n$config\n",
+ mode => 0644, owner => root, group => root,
+ }
+ }
+ }
+ }
+ }
+}
+
+define munin::remoteplugin($ensure = "present", $source, $config = '') {
+ case $ensure {
+ "absent": { munin::plugin{ $name: ensure => absent } }
+ default: {
+ file {
+ "${module_dir_path}/munin/plugins/${name}":
+ source => $source,
+ mode => 0755, owner => root, group => root;
+ }
+ munin::plugin { $name:
+ ensure => $ensure,
+ config => $config,
+ script_path => "${module_dir_path}/munin/plugins",
+ }
+ }
+ }
+}
+
+class munin::plugins::base {
+
+ file {
+ [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]:
+ source => "puppet://$server/modules/common/empty",
+ ensure => directory, checksum => mtime,
+ ignore => '.ignore',
+ recurse => true, purge => true, force => true,
+ mode => 0755, owner => root, group => root,
+ notify => Service[munin-node];
+ "/etc/munin/plugin-conf.d/munin-node":
+ ensure => present,
+ mode => 0644, owner => root, group => root,
+ notify => Service[munin-node],
+ before => Package[munin-node];
+ }
+
+}
+
+# handle if_ and if_err_ plugins
+class munin::plugins::interfaces inherits munin::plugins::base {
+
+ $ifs = gsub(split($munin_interfaces, " "), "(.+)", "if_\\1")
+ $if_errs = gsub(split($munin_interfaces, " "), "(.+)", "if_err_\\1")
+ plugin {
+ $ifs: ensure => "if_";
+ $if_errs: ensure => "if_err_";
+ }
+
+
+}
+
+class munin::plugins::linux inherits munin::plugins::base {
+
+ plugin {
+ [ df_abs, forks, iostat, memory, processes, cpu, df_inode, irqstats,
+ netstat, open_files, swap, df, entropy, interrupts, load, open_inodes,
+ vmstat
+ ]:
+ ensure => present;
+ acpi:
+ ensure => $acpi_available;
+ }
+
+ include munin::plugins::interfaces
+}
+
+class munin::plugins::debian inherits munin::plugins::base {
+
+ plugin { apt_all: ensure => present; }
+
+}
+
+class munin::plugins::vserver inherits munin::plugins::base {
+
+ plugin {
+ [ netstat, processes ]:
+ ensure => present;
+ }
+
+=======
include munin::plugin::scriptpaths
$real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
@@ -61,4 +182,5 @@ define munin::plugin (
}
}
}
+>>>>>>> 76352415fec5c2ab6975e3a8843dd4983f7cae6a
}
diff --git a/templates/defaultclient.erb b/templates/defaultclient.erb
index 5611bf4..7d754a7 100644
--- a/templates/defaultclient.erb
+++ b/templates/defaultclient.erb
@@ -11,5 +11,8 @@
address <%= munin_host_real %>
port <%= munin_port_real %>
use_node_name yes
+<<<<<<< HEAD
+=======
load.load.warning 5
load.load.critical 10
+>>>>>>> 76352415fec5c2ab6975e3a8843dd4983f7cae6a
diff --git a/templates/munin-node.conf.Debian.lenny b/templates/munin-node.conf.Debian.lenny
index e0646b9..56da89d 120000..100644
--- a/templates/munin-node.conf.Debian.lenny
+++ b/templates/munin-node.conf.Debian.lenny
@@ -1 +1,39 @@
-munin-node.conf.Debian.etch \ No newline at end of file
+##########
+########## Managed by puppet
+##########
+
+log_level 4
+log_file /var/log/munin/munin-node.log
+pid_file /var/run/munin/munin-node.pid
+background 1
+setseid 1
+
+# Which host/port to bind to;
+host <%= munin_host_real %>
+port <%= munin_port_real %>
+user root
+group root
+setsid yes
+
+# Regexps for files to ignore
+
+ignore_file ~$
+ignore_file \.bak$
+ignore_file %$
+ignore_file \.dpkg-(tmp|new|old|dist)$
+ignore_file \.rpm(save|new)$
+
+# Set this if the client doesn't report the correct hostname when
+# telnetting to localhost, port 4949
+#
+#host_name localhost.localdomain
+host_name <%= fqdn %>
+
+# A list of addresses that are allowed to connect. This must be a
+# regular expression, due to brain damage in Net::Server, which
+# doesn't understand CIDR-style network notation. You may repeat
+# the allow line as many times as you'd like
+<% real_munin_allow.split(':').each do |val| -%>
+allow <%= '^'+val.gsub(/\./, '\.')+'$' %>
+<% end -%>
+
diff --git a/templates/munin-node.conf.Debian.sid b/templates/munin-node.conf.Debian.sid
index e0646b9..6b8d690 120000
--- a/templates/munin-node.conf.Debian.sid
+++ b/templates/munin-node.conf.Debian.sid
@@ -1 +1 @@
-munin-node.conf.Debian.etch \ No newline at end of file
+munin-node.conf.Debian.lenny \ No newline at end of file
diff --git a/templates/munin-node.conf.Debian.squeeze b/templates/munin-node.conf.Debian.squeeze
new file mode 120000
index 0000000..6b8d690
--- /dev/null
+++ b/templates/munin-node.conf.Debian.squeeze
@@ -0,0 +1 @@
+munin-node.conf.Debian.lenny \ No newline at end of file
diff --git a/templates/site.conf b/templates/site.conf
new file mode 100644
index 0000000..549437c
--- /dev/null
+++ b/templates/site.conf
@@ -0,0 +1,9 @@
+<VirtualHost *>
+ ServerName <%= name %>
+ DocumentRoot /var/www/munin/
+ <Location />
+ order allow,deny
+ Allow from all
+ </Location>
+</VirtualHost>
+