From 82d90e5f3d3dc8cf0daeb58e8fe597eef7738ae8 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Sat, 2 Aug 2008 13:11:24 +0200 Subject: munin-node.conf can be used unmodified for lenny --- templates/munin-node.conf.Debian.lenny | 1 + 1 file changed, 1 insertion(+) create mode 120000 templates/munin-node.conf.Debian.lenny diff --git a/templates/munin-node.conf.Debian.lenny b/templates/munin-node.conf.Debian.lenny new file mode 120000 index 0000000..e0646b9 --- /dev/null +++ b/templates/munin-node.conf.Debian.lenny @@ -0,0 +1 @@ +munin-node.conf.Debian.etch \ No newline at end of file -- cgit v1.2.3 From c9c389010b40f1768f039200539cf27a032d0348 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Mon, 8 Sep 2008 20:12:12 +0200 Subject: add apache site --- manifests/host.pp | 9 +++++++++ templates/site.conf | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 templates/site.conf diff --git a/manifests/host.pp b/manifests/host.pp index f539c9e..af0f11b 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -37,3 +37,12 @@ class munin::snmp_collector schedule => daily } } + +define munin::apache_site() +{ + apache::site { + $name: + ensure => present, + content => template("munin/site.conf") + } +} 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 @@ + + ServerName <%= name %> + DocumentRoot /var/www/munin/ + + order allow,deny + Allow from all + + + -- cgit v1.2.3 From c223993eba487cc24425890b2b9b6abd2f6c4d35 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Sun, 31 May 2009 21:18:22 +0200 Subject: adapt to new "common" module --- README | 6 +++--- manifests/host.pp | 4 ++-- manifests/init.pp | 4 ++-- manifests/plugin.pp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README b/README index 762a802..18cfa0a 100644 --- a/README +++ b/README @@ -37,9 +37,9 @@ To use this module, follow these directions: c. you will also need to create the following empty directories: mkdir /etc/puppet/modules/munin/files/empty - mkdir /etc/puppet/modules/munin/files/modules_dir - mkdir -p /etc/puppet/modules/munin/files/nodes/modules_dir - mkdir -p /etc/puppet/modules/munin/files/plugins/modules_dir + mkdir /etc/puppet/modules/munin/files/module_dir + mkdir -p /etc/puppet/modules/munin/files/nodes/module_dir + mkdir -p /etc/puppet/modules/munin/files/plugins/module_dir 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): diff --git a/manifests/host.pp b/manifests/host.pp index af0f11b..f89cbb8 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -25,13 +25,13 @@ class munin::snmp_collector { file { - "/var/lib/puppet/modules/munin/create_snmp_links": + "${module_dir_path}/munin/create_snmp_links": source => "puppet://$servername/munin/create_snmp_links.sh", mode => 755, owner => root, group => root; } exec { "create_snmp_links": - command => "/var/lib/puppet/modules/munin/create_snmp_links $NODESDIR", + command => "${module_dir_path}/munin/create_snmp_links $NODESDIR", require => File["snmp_links"], timeout => "2048", schedule => daily diff --git a/manifests/init.pp b/manifests/init.pp index a1ea92c..4a049a4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,9 +5,9 @@ # the port is a parameter so vservers can share IP addresses and still be happy # Define where the individual nodes' configs are stored -$NODESDIR="/var/lib/puppet/modules/munin/nodes" +$NODESDIR="${module_dir_path}/munin/nodes" -modules_dir { [ "munin", "munin/nodes", "munin/plugins" ]: } +module_dir { [ "munin", "munin/nodes", "munin/plugins" ]: } import "host.pp" import "client.pp" diff --git a/manifests/plugin.pp b/manifests/plugin.pp index a23a567..85fa444 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -53,14 +53,14 @@ define munin::remoteplugin($ensure = "present", $source, $config = '') { "absent": { munin::plugin{ $name: ensure => absent } } default: { file { - "/var/lib/puppet/modules/munin/plugins/${name}": + "${module_dir_path}/munin/plugins/${name}": source => $source, mode => 0755, owner => root, group => root; } munin::plugin { $name: ensure => $ensure, config => $config, - script_path => "/var/lib/puppet/modules/munin/plugins", + script_path => "${module_dir_path}/munin/plugins", } } } -- cgit v1.2.3 From c0abb341bfdd1061c85d0349b9a880de6047728f Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 3 Jun 2009 11:11:45 +0200 Subject: use cidr_allow in lenny and newer This change keeps munin_allow for etch and feisty, since I don't know whether cidr_allow is already possible there. Everyone else should change to the much nicer CIDR notation of cidr_allow. You can use an array to specify multiple rules. --- README | 8 +++++- templates/munin-node.conf.Debian.lenny | 44 +++++++++++++++++++++++++++++++- templates/munin-node.conf.Debian.sid | 2 +- templates/munin-node.conf.Debian.squeeze | 1 + 4 files changed, 52 insertions(+), 3 deletions(-) mode change 120000 => 100644 templates/munin-node.conf.Debian.lenny create mode 120000 templates/munin-node.conf.Debian.squeeze diff --git a/README b/README index 18cfa0a..8352db0 100644 --- a/README +++ b/README @@ -44,7 +44,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' + $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 = '^192\.168\.0\.1$' e. In the node definition in your site.pp for your main munin host, add the following: diff --git a/templates/munin-node.conf.Debian.lenny b/templates/munin-node.conf.Debian.lenny deleted file mode 120000 index e0646b9..0000000 --- a/templates/munin-node.conf.Debian.lenny +++ /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 new file mode 100644 index 0000000..07f4980 --- /dev/null +++ b/templates/munin-node.conf.Debian.lenny @@ -0,0 +1,43 @@ +########## +########## 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. +<% +if ! munin_cidr_allow.is_a?(Array) then + allows = [ munin_cidr_allow ] +else + allows = munin_cidr_allow +end + +allows.each do |cidr| +-%> +cidr_allow <%= cidr %> +<% 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 -- cgit v1.2.3 From 23dc1202b2e30355e1f45f7be882f65db8477053 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 3 Jun 2009 11:38:08 +0200 Subject: Add initialisation for munin.conf.header --- README | 3 +++ manifests/host.pp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README b/README index 8352db0..80d0408 100644 --- a/README +++ b/README @@ -87,3 +87,6 @@ To use this module, follow these directions: $munin_port = 4948 +4. Cleanup: If you need any manual configuration or had already nodes defined + in your munin.conf, you can add/remove them from + /etc/munin/munin.conf.header on the munin::host. diff --git a/manifests/host.pp b/manifests/host.pp index f89cbb8..1d17518 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -12,11 +12,19 @@ class munin::host dir => $NODESDIR, header => "/etc/munin/munin.conf.header", } + + file { + "/etc/munin/munin.conf.header": + source => "/etc/munin/munin.conf", + replace => no, # only initialise + mode => 0644, owner => root, group => 0, + before => File["/etc/munin/munin.conf"]; + } 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 => root; + ensure => present, + mode => 640, owner => munin, group => root; } } -- cgit v1.2.3 From 9e3a03b42c2426988cef1a1da236aa16ee54f125 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 3 Jun 2009 15:09:52 +0200 Subject: remove superfluous graph_period specification --- templates/defaultclient.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/defaultclient.erb b/templates/defaultclient.erb index 954a0cb..ddce1bb 100644 --- a/templates/defaultclient.erb +++ b/templates/defaultclient.erb @@ -11,4 +11,3 @@ address <%= munin_host_real %> port <%= munin_port_real %> use_node_name yes - exim_mailstats.graph_period minute -- cgit v1.2.3 From 1868c2508f01c6b85f9086ddac00998521067fbc Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Thu, 4 Jun 2009 11:15:43 +0200 Subject: Remove superfluous modules_dir/.ignore and fix README --- README | 17 +++++------------ files/modules_dir/.ignore | 0 2 files changed, 5 insertions(+), 12 deletions(-) delete mode 100644 files/modules_dir/.ignore diff --git a/README b/README index 80d0408..55bff26 100644 --- a/README +++ b/README @@ -34,14 +34,7 @@ To use this module, follow these directions: "modules.pp" in your site.pp, if you do not have that, then you will need to add the import line to your site.pp) - c. you will also need to create the following empty directories: - - mkdir /etc/puppet/modules/munin/files/empty - mkdir /etc/puppet/modules/munin/files/module_dir - mkdir -p /etc/puppet/modules/munin/files/nodes/module_dir - mkdir -p /etc/puppet/modules/munin/files/plugins/module_dir - - d. Add to the top of your site.pp a variable which indicates what IP should be allowed to + c. 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_cidr_allow = '192.168.0.1/32' @@ -52,16 +45,16 @@ To use this module, follow these directions: $munin_allow = '^192\.168\.0\.1$' - e. In the node definition in your site.pp for your main munin host, add the following: + d. In the node definition in your site.pp for your main munin host, add the following: include munin::host - f. On each node that will gather munin statistics, add this line to that node's entry + e. On each node that will gather munin statistics, add this line to that node's entry in site.pp (you may want to also add this to your main munin host): include munin::client - g. If there are particular munin plugins you want to enable or configure, you define them + f. 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 @@ -81,7 +74,7 @@ To use this module, follow these directions: } - h. If you have Linux-Vservers configured, you will likely have multiple munin-node processes + g. 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 in the node definition: diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3 From 08156d7433c3052205a545951af7f0c5670a3a36 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Mon, 20 Jul 2009 10:15:15 +0200 Subject: Move interfaces fact to munin_interfaces This is to avoid clashes with newer facter versions which bring their own interfaces fact. --- manifests/plugin.pp | 4 ++-- plugins/facter/interfaces.rb | 13 ------------- plugins/facter/munin_interfaces.rb | 13 +++++++++++++ 3 files changed, 15 insertions(+), 15 deletions(-) delete mode 100755 plugins/facter/interfaces.rb create mode 100755 plugins/facter/munin_interfaces.rb diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 85fa444..87259f7 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -88,8 +88,8 @@ class munin::plugins::base { # handle if_ and if_err_ plugins class munin::plugins::interfaces inherits munin::plugins::base { - $ifs = gsub(split($interfaces, " "), "(.+)", "if_\\1") - $if_errs = gsub(split($interfaces, " "), "(.+)", "if_err_\\1") + $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_"; diff --git a/plugins/facter/interfaces.rb b/plugins/facter/interfaces.rb deleted file mode 100755 index a498d64..0000000 --- a/plugins/facter/interfaces.rb +++ /dev/null @@ -1,13 +0,0 @@ -# return the set of active interfaces as an array -Facter.add("interfaces") do - setcode do - `ip -o link show`.split(/\n/).collect do |line| - value = nil - matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/) - if !matches.nil? - value = matches[1] - end - value - end.compact.sort.join(" ") - end -end diff --git a/plugins/facter/munin_interfaces.rb b/plugins/facter/munin_interfaces.rb new file mode 100755 index 0000000..5366573 --- /dev/null +++ b/plugins/facter/munin_interfaces.rb @@ -0,0 +1,13 @@ +# return the set of active interfaces as an array +Facter.add("munin_interfaces") do + setcode do + `ip -o link show`.split(/\n/).collect do |line| + value = nil + matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/) + if !matches.nil? + value = matches[1] + end + value + end.compact.sort.join(" ") + end +end -- cgit v1.2.3 From 3121bc68df6df329608464c6f3bf316917cbe813 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Mon, 20 Jul 2009 11:41:20 +0200 Subject: avoid passing on the superflous @... suffixes on interfaces --- plugins/facter/munin_interfaces.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/facter/munin_interfaces.rb b/plugins/facter/munin_interfaces.rb index 5366573..f7a3575 100755 --- a/plugins/facter/munin_interfaces.rb +++ b/plugins/facter/munin_interfaces.rb @@ -6,6 +6,9 @@ Facter.add("munin_interfaces") do matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/) if !matches.nil? value = matches[1] + # remove superfluous "underlying interface" specification + # for VLAN interfaces + value.gsub!(/@.*/, '') end value end.compact.sort.join(" ") -- cgit v1.2.3 From b46b64fa416d82c4a305463c02731d2da4a54879 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 12:17:37 -0500 Subject: some clarifications to README for those who do not have the empty directories --- README | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/README b/README index 55bff26..762a802 100644 --- a/README +++ b/README @@ -34,27 +34,28 @@ To use this module, follow these directions: "modules.pp" in your site.pp, if you do not have that, then you will need to add the import line to your site.pp) - c. 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_cidr_allow = '192.168.0.1/32' + c. you will also need to create the following empty directories: - You can also put an array there. + mkdir /etc/puppet/modules/munin/files/empty + mkdir /etc/puppet/modules/munin/files/modules_dir + mkdir -p /etc/puppet/modules/munin/files/nodes/modules_dir + mkdir -p /etc/puppet/modules/munin/files/plugins/modules_dir - On pre-lenny systems, you have to use the older Regexp-variant: + 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$' + $munin_allow = '192.168.0.1' - d. In the node definition in your site.pp for your main munin host, add the following: + e. In the node definition in your site.pp for your main munin host, add the following: include munin::host - e. On each node that will gather munin statistics, add this line to that node's entry + f. On each node that will gather munin statistics, add this line to that node's entry in site.pp (you may want to also add this to your main munin host): include munin::client - f. If there are particular munin plugins you want to enable or configure, you define them + g. 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 @@ -74,12 +75,9 @@ To use this module, follow these directions: } - g. If you have Linux-Vservers configured, you will likely have multiple munin-node processes + h. 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 in the node definition: $munin_port = 4948 -4. Cleanup: If you need any manual configuration or had already nodes defined - in your munin.conf, you can add/remove them from - /etc/munin/munin.conf.header on the munin::host. -- cgit v1.2.3 From 94eb06a3c753fcca3213bc5940d7d025dc790a37 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 12:27:10 -0500 Subject: move plugin directory to fit new 0.25.x style and update file paths accordingly --- lib/facter/acpi_available.rb | 10 ++++++++++ lib/facter/munin_interfaces.rb | 16 ++++++++++++++++ manifests/host.pp | 2 +- manifests/plugin.pp | 2 +- plugins/facter/acpi_available.rb | 10 ---------- plugins/facter/munin_interfaces.rb | 16 ---------------- 6 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 lib/facter/acpi_available.rb create mode 100755 lib/facter/munin_interfaces.rb delete mode 100644 plugins/facter/acpi_available.rb delete mode 100755 plugins/facter/munin_interfaces.rb diff --git a/lib/facter/acpi_available.rb b/lib/facter/acpi_available.rb new file mode 100644 index 0000000..e3d8dfa --- /dev/null +++ b/lib/facter/acpi_available.rb @@ -0,0 +1,10 @@ +# return whether acpi is available -- used for deciding whether to install the munin plugin +Facter.add("acpi_available") do + setcode do + if `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? + "absent" + else + "present" + end + end +end diff --git a/lib/facter/munin_interfaces.rb b/lib/facter/munin_interfaces.rb new file mode 100755 index 0000000..f7a3575 --- /dev/null +++ b/lib/facter/munin_interfaces.rb @@ -0,0 +1,16 @@ +# return the set of active interfaces as an array +Facter.add("munin_interfaces") do + setcode do + `ip -o link show`.split(/\n/).collect do |line| + value = nil + matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/) + if !matches.nil? + value = matches[1] + # remove superfluous "underlying interface" specification + # for VLAN interfaces + value.gsub!(/@.*/, '') + end + value + end.compact.sort.join(" ") + end +end diff --git a/manifests/host.pp b/manifests/host.pp index 1d17518..804bd02 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -34,7 +34,7 @@ class munin::snmp_collector file { "${module_dir_path}/munin/create_snmp_links": - source => "puppet://$servername/munin/create_snmp_links.sh", + source => "puppet://$server/modules/munin/create_snmp_links.sh", mode => 755, owner => root, group => root; } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 87259f7..c9bb6e5 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -70,7 +70,7 @@ class munin::plugins::base { file { [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: - source => "puppet://$servername/common/empty", + source => "puppet://$server/modules/common/empty", ensure => directory, checksum => mtime, ignore => '.ignore', recurse => true, purge => true, force => true, diff --git a/plugins/facter/acpi_available.rb b/plugins/facter/acpi_available.rb deleted file mode 100644 index e3d8dfa..0000000 --- a/plugins/facter/acpi_available.rb +++ /dev/null @@ -1,10 +0,0 @@ -# return whether acpi is available -- used for deciding whether to install the munin plugin -Facter.add("acpi_available") do - setcode do - if `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? - "absent" - else - "present" - end - end -end diff --git a/plugins/facter/munin_interfaces.rb b/plugins/facter/munin_interfaces.rb deleted file mode 100755 index f7a3575..0000000 --- a/plugins/facter/munin_interfaces.rb +++ /dev/null @@ -1,16 +0,0 @@ -# return the set of active interfaces as an array -Facter.add("munin_interfaces") do - setcode do - `ip -o link show`.split(/\n/).collect do |line| - value = nil - matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/) - if !matches.nil? - value = matches[1] - # remove superfluous "underlying interface" specification - # for VLAN interfaces - value.gsub!(/@.*/, '') - end - value - end.compact.sort.join(" ") - end -end -- cgit v1.2.3 From 35982d28049064b3ef36dc7377070c8ada6410ce Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 12:32:03 -0500 Subject: adjust README to note the new munin_cidr_allow variable --- README | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README b/README index 762a802..c0872f0 100644 --- a/README +++ b/README @@ -1,4 +1,3 @@ - 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/ @@ -44,7 +43,7 @@ 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' + $munin_cidr_allow = '192.168.0.1' e. In the node definition in your site.pp for your main munin host, add the following: -- cgit v1.2.3 From ff66ccb14f738dd0f6f95bf2d9406874d3edb4c8 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 12:41:05 -0500 Subject: fixup the README so it includes DavidS' changes for the munin_cidr_allow information: * add back the cidr notation to the example variable * add back the information about pre-lenny versions --- README | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README b/README index c0872f0..c79cdf0 100644 --- a/README +++ b/README @@ -43,7 +43,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_cidr_allow = '192.168.0.1' + $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 = '^192\.168\.0\.1$' e. In the node definition in your site.pp for your main munin host, add the following: -- cgit v1.2.3 From ab1f4cc93c5143e05fd588289ca044e132049bac Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 12:47:24 -0500 Subject: take out the removal of the postfix_mailvolume munin plugin. I do not see what the bug is, and this interferes with local installation of the plugin (causes duplicate definitions) --- manifests/client.pp | 3 --- 1 file changed, 3 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 0ad7856..b89877f 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -117,8 +117,5 @@ class munin::client::debian } munin::register { $fqdn: } - - # workaround bug in munin_node_configure - plugin { "postfix_mailvolume": ensure => absent } } -- cgit v1.2.3 From 54af63deb16a02bfc8611e444bb3a64e12757f47 Mon Sep 17 00:00:00 2001 From: pietro Date: Fri, 27 Nov 2009 18:43:54 -0800 Subject: update source path --- manifests/plugin.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugin.pp b/manifests/plugin.pp index c9bb6e5..817111d 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -70,7 +70,7 @@ class munin::plugins::base { file { [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: - source => "puppet://$server/modules/common/empty", + source => "puppet://$server/common/empty", ensure => directory, checksum => mtime, ignore => '.ignore', recurse => true, purge => true, force => true, -- cgit v1.2.3 From 577ff440b791ab67de77b20440b5e385fe1c9572 Mon Sep 17 00:00:00 2001 From: pietro Date: Fri, 27 Nov 2009 19:00:45 -0800 Subject: Revert "update source path" This reverts commit 54af63deb16a02bfc8611e444bb3a64e12757f47. --- manifests/plugin.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 817111d..c9bb6e5 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -70,7 +70,7 @@ class munin::plugins::base { file { [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: - source => "puppet://$server/common/empty", + source => "puppet://$server/modules/common/empty", ensure => directory, checksum => mtime, ignore => '.ignore', recurse => true, purge => true, force => true, -- cgit v1.2.3 From 8f711a933dbc0917b43d5e29b98da7157bd5727f Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 19:48:36 -0500 Subject: fix some merge problems --- files/modules_dir/.ignore | 0 lib/facter/acpi_available.rb | 14 ++--- manifests/client.pp | 2 +- manifests/plugin.pp | 122 ------------------------------------------- templates/defaultclient.erb | 3 -- 5 files changed, 8 insertions(+), 133 deletions(-) create mode 100644 files/modules_dir/.ignore diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore new file mode 100644 index 0000000..e69de29 diff --git a/lib/facter/acpi_available.rb b/lib/facter/acpi_available.rb index e3d8dfa..9a0474f 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 `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? - "absent" - else - "present" - end - end + 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 end diff --git a/manifests/client.pp b/manifests/client.pp index d033c28..24d84da 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -3,7 +3,7 @@ # See LICENSE for the full license granted to you. # Adapted and improved by admin(at)immerda.ch -class munin::client { +class munin::client inherits munin { $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } $munin_host_real = $munin_host ? { diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 75c4423..1fa4651 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -10,127 +10,6 @@ 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 } @@ -182,5 +61,4 @@ class munin::plugins::vserver inherits munin::plugins::base { } } } ->>>>>>> 76352415fec5c2ab6975e3a8843dd4983f7cae6a } diff --git a/templates/defaultclient.erb b/templates/defaultclient.erb index 7d754a7..5611bf4 100644 --- a/templates/defaultclient.erb +++ b/templates/defaultclient.erb @@ -11,8 +11,5 @@ address <%= munin_host_real %> port <%= munin_port_real %> use_node_name yes -<<<<<<< HEAD -======= load.load.warning 5 load.load.critical 10 ->>>>>>> 76352415fec5c2ab6975e3a8843dd4983f7cae6a -- cgit v1.2.3 From ebfde169e0ef4fc749cd6804e707103fab7dbf78 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 19:50:28 -0500 Subject: take out the removal of the postfix_mailvolume munin plugin. I do not see what the bug is, and this interferes with local installation of the plugin (causes duplicate definitions) --- manifests/client/debian.pp | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index a6d677e..7b8b5a7 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -9,7 +9,5 @@ class munin::client::debian inherits munin::client::package { 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 } -- cgit v1.2.3 From 511afffde2c5375fd685133f6c697c3ffeaaed8b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 19:59:02 -0500 Subject: indentation fixups, using the emacs/vim modes for standardization --- manifests/client/debian.pp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 7b8b5a7..0bc0414 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,13 +1,13 @@ class munin::client::debian inherits munin::client::package { - # 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"), - } - include munin::plugins::debian + # 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"), + } + include munin::plugins::debian } -- cgit v1.2.3 From ed86ae3ba62c53f480047ac8dd0488ef84878fa2 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 20:00:51 -0500 Subject: we may have iproute installed elsewhere, by doing it in the munin module, we risk duplicate definitions. this commit fixes that by doing a check to see if it is already defined elsewhere, and if it is not, then it installs the package --- manifests/client/debian.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 0bc0414..8dfa35f 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,6 +1,8 @@ class munin::client::debian inherits munin::client::package { # the plugin will need that - package { "iproute": ensure => installed } + if !defined(Package["iproute"]) { + package { "iproute": ensure => installed } + } Service["munin-node"]{ # sarge's munin-node init script has no status -- cgit v1.2.3 From f868f9fbb4ab6eae2a49212cd7734bda455e812d Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 20:17:16 -0500 Subject: Revert "take out the removal of the postfix_mailvolume munin plugin. I do not see what the bug is, and this interferes with local installation of the plugin (causes duplicate definitions)" It looks like the reason this is here is because on a default debian install, without postfix installed, this postfix munin module is activated, leading to empty graphs. So rather that leave non-postfix people in this situation, we can instead leave this in and the class can be overridden locally. This reverts commit ebfde169e0ef4fc749cd6804e707103fab7dbf78. Conflicts: manifests/client/debian.pp --- manifests/client/debian.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 8dfa35f..f7df8d5 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -12,4 +12,8 @@ class munin::client::debian inherits munin::client::package { content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"), } include munin::plugins::debian + + # workaround bug in munin_node_configure + plugin { "postfix_mailvolume": ensure => absent } + include munin::plugins::debian } -- cgit v1.2.3 From 5abd8f38402f08a3cbb544681ca47ff44e4253e6 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 20:49:00 -0500 Subject: move the munin-kill cronjob into the centos-specific case. this is not something debian needs AFAICT --- manifests/host.pp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/manifests/host.pp b/manifests/host.pp index 9fd637d..fd70710 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -32,14 +32,15 @@ class munin::host inherits munin include munin::plugins::muninhost case $operatingsystem { - centos: { include munin::host::cgi } + centos: { + include munin::host::cgi + # 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; + } + } } - - # 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; - } if $use_shorewall { include shorewall::rules::out::munin } -- cgit v1.2.3 From 3594e9a5ab49ae2a60915c788d3ca3b0e979078b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 20:51:18 -0500 Subject: fix formatting to be standard --- manifests/host.pp | 68 +++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/manifests/host.pp b/manifests/host.pp index fd70710..c1fa3db 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -4,43 +4,43 @@ class munin::host inherits munin { - package {"munin": ensure => installed, } - - File <<| tag == 'munin' |>> - - file{'/etc/munin/munin.conf.header': - source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/munin.conf.header", - "puppet://$server/modules/site-munin/config/host/munin.conf.header.$operatingsystem", - "puppet://$server/modules/site-munin/config/host/munin.conf.header", - "puppet://$server/modules/munin/config/host/munin.conf.header.$operatingsystem", - "puppet://$server/modules/munin/config/host/munin.conf.header" ], - notify => Exec['concat_/etc/munin/munin.conf'], + package {"munin": ensure => installed, } + + File <<| tag == 'munin' |>> + + file{'/etc/munin/munin.conf.header': + source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/munin.conf.header", + "puppet://$server/modules/site-munin/config/host/munin.conf.header.$operatingsystem", + "puppet://$server/modules/site-munin/config/host/munin.conf.header", + "puppet://$server/modules/munin/config/host/munin.conf.header.$operatingsystem", + "puppet://$server/modules/munin/config/host/munin.conf.header" ], + notify => Exec['concat_/etc/munin/munin.conf'], + owner => root, group => 0, mode => 0644; + } + + 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; + } + + include munin::plugins::muninhost + + case $operatingsystem { + centos: { + include munin::host::cgi + # 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; - } - - 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; - } - - include munin::plugins::muninhost - - case $operatingsystem { - centos: { - include munin::host::cgi - # 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; - } } } + } if $use_shorewall { include shorewall::rules::out::munin } -- cgit v1.2.3 From d4df3117855d985402106e4104b87b6cb73a05c1 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 20:55:27 -0500 Subject: remove duplicated include of plugins --- manifests/client/debian.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index f7df8d5..bd0fad5 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -11,7 +11,6 @@ class munin::client::debian inherits munin::client::package { File["/etc/munin/munin-node.conf"]{ content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"), } - include munin::plugins::debian # workaround bug in munin_node_configure plugin { "postfix_mailvolume": ensure => absent } -- cgit v1.2.3 From d53ba65913d4a312cdb1e7d980b608dc103269d7 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 20:56:01 -0500 Subject: formatting standardization --- manifests/client/package.pp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 84fcf5c..58f40da 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,11 +1,11 @@ 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'], - } + 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'], + } } -- cgit v1.2.3 From 556b274473452c9f95a02714e7686d3918f54dde Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 20:58:14 -0500 Subject: more formatting standardizations --- manifests/plugins/debian.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp index f239989..970fa9d 100644 --- a/manifests/plugins/debian.pp +++ b/manifests/plugins/debian.pp @@ -1,4 +1,4 @@ class munin::plugins::debian inherits munin::plugins::base { - munin::plugin { apt_all: ensure => present; } + munin::plugin { apt_all: ensure => present; } } -- cgit v1.2.3 From 8067746d6c6efde6cc3d67177910aa96f9491652 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 21:00:14 -0500 Subject: the 'users' munin plugin seems to be a centos-specific one, so we setup a special munin::plugins::centos and include that in the proper client case statement for centos --- manifests/client/package.pp | 1 + manifests/plugins/base.pp | 2 +- manifests/plugins/centos.pp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 manifests/plugins/centos.pp diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 58f40da..1b124d0 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -8,4 +8,5 @@ class munin::client::package inherits munin::client::base { # boot the munin-node without failure! before => Package['munin-node'], } + include munin::plugins::centos } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 4658acc..5fc2476 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -15,7 +15,7 @@ class munin::plugins::base { munin::plugin { [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, uptime, users, vmstat + processes, swap, uptime, vmstat ]: ensure => present, } diff --git a/manifests/plugins/centos.pp b/manifests/plugins/centos.pp new file mode 100644 index 0000000..60c706c --- /dev/null +++ b/manifests/plugins/centos.pp @@ -0,0 +1,3 @@ +class munin::plugins::centos inherits munin::plugins::base { + munin::plugin { users: ensure => present; } +} -- cgit v1.2.3 From ba05b95dee4b83c727795bb596eebc9951637d92 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 22 Dec 2009 21:24:50 -0500 Subject: add missing header file for Debian (contacts disabled) --- files/config/host/munin.conf.header.Debian | 75 ++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 files/config/host/munin.conf.header.Debian diff --git a/files/config/host/munin.conf.header.Debian b/files/config/host/munin.conf.header.Debian new file mode 100644 index 0000000..082f01f --- /dev/null +++ b/files/config/host/munin.conf.header.Debian @@ -0,0 +1,75 @@ +# 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/munin +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 +# + -- cgit v1.2.3 From 68238a10e33a4fae78e81b3aa74064c973a52306 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 22:32:56 -0500 Subject: more standardization of indenting/formatting --- manifests/client/base.pp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/manifests/client/base.pp b/manifests/client/base.pp index b3fcc4a..b834e9b 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,23 +1,23 @@ 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: } + include munin::plugins::base } -- cgit v1.2.3 From 3eccdd86f22ba7c4a6505da7704a4b77830edf93 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 22 Dec 2009 22:42:37 -0500 Subject: update README to note the proper variable for script_path_in --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 10e6136..e3f5136 100644 --- a/README +++ b/README @@ -71,7 +71,7 @@ To use this module, follow these directions: # Use a non-standard plugin path to use custom plugins munin::plugin { "spamassassin": ensure => "spamassassin", - script_path => "/usr/local/share/munin-plugins", + script_path_in => "/usr/local/share/munin-plugins", } # Use a special config to pass parameters to the plugin -- cgit v1.2.3 From a6477f6edc481b7874ae8b3497343d3ad8ad805f Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 23 Dec 2009 14:25:02 -0500 Subject: finish settting up splitting the centos bits --- manifests/client.pp | 2 +- manifests/client/package.pp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 24d84da..1767c00 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -17,7 +17,7 @@ class munin::client inherits munin { 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::centos } default: { include munin::client::base } } if $use_shorewall { diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 1b124d0..58f40da 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -8,5 +8,4 @@ class munin::client::package inherits munin::client::base { # boot the munin-node without failure! before => Package['munin-node'], } - include munin::plugins::centos } -- cgit v1.2.3 From a8d3b6af4a63724ca31eab772978a35927797b2b Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Wed, 30 Dec 2009 15:11:39 -0800 Subject: add support for setting munin and munin-node package versions --- README | 12 ++++++++++++ manifests/client/package.pp | 7 ++++++- manifests/host.pp | 7 ++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README b/README index e3f5136..5018472 100644 --- a/README +++ b/README @@ -56,12 +56,24 @@ To use this module, follow these directions: e. In the node definition in your site.pp for your main munin host, add the following: include munin::host + + If you want to specify a particular package version for the main munin + host, you can set the $munin_ensure_version variable _before_ the above + include, like this + + $munin_ensure_version = "1.2.6-17" f. On each node that will gather munin statistics, add this line to that node's entry in site.pp (you may want to also add this to your main munin host): include munin::client + If you want to specify a particular package version for the munin + client, you can set the $munin_ensure_version variable _before_ the + above include, like this + + $munin-node_ensure_version = "1.2.6-17" + g. If there are particular munin plugins you want to enable or configure, you define them in the node definition, like follows: diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 58f40da..482ca4f 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,5 +1,10 @@ class munin::client::package inherits munin::client::base { - package { 'munin-node': ensure => installed } + + case $munin-node_ensure_version { + '': { $munin-node_ensure_version = "installed" } + } + + package { 'munin-node': ensure => $munin-node_ensure_version } Service['munin-node']{ require => Package[munin-node], } diff --git a/manifests/host.pp b/manifests/host.pp index c1fa3db..3306195 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -4,7 +4,12 @@ class munin::host inherits munin { - package {"munin": ensure => installed, } + + case $munin_ensure_version { + '': { $munin_ensure_version = "installed" } + } + + package {"munin": ensure => $munin_ensure_version, } File <<| tag == 'munin' |>> -- cgit v1.2.3 From da6ded035a7074306587c76e8d3b90cda6b3bdc8 Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Wed, 30 Dec 2009 15:34:40 -0800 Subject: can't use - in a variable name --- README | 4 ++-- manifests/client/package.pp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index 5018472..f787d35 100644 --- a/README +++ b/README @@ -69,10 +69,10 @@ To use this module, follow these directions: include munin::client If you want to specify a particular package version for the munin - client, you can set the $munin_ensure_version variable _before_ the + client, you can set the $munin_node_ensure_version variable _before_ the above include, like this - $munin-node_ensure_version = "1.2.6-17" + $munin_node_ensure_version = "1.2.6-17" g. If there are particular munin plugins you want to enable or configure, you define them in the node definition, like follows: diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 482ca4f..7f8a7ba 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,10 +1,10 @@ class munin::client::package inherits munin::client::base { - case $munin-node_ensure_version { - '': { $munin-node_ensure_version = "installed" } + case $munin_node_ensure_version { + '': { $munin_node_ensure_version = "installed" } } - package { 'munin-node': ensure => $munin-node_ensure_version } + package { 'munin-node': ensure => $munin_node_ensure_version } Service['munin-node']{ require => Package[munin-node], } -- cgit v1.2.3 From 022e824d8a006f1ef4e742b6af5176daecda1cd0 Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Wed, 30 Dec 2009 21:22:17 -0800 Subject: switch to correct way of checking if the variable is set --- manifests/client/package.pp | 4 +--- manifests/host.pp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 7f8a7ba..0fc3529 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,8 +1,6 @@ class munin::client::package inherits munin::client::base { - case $munin_node_ensure_version { - '': { $munin_node_ensure_version = "installed" } - } + if $munin_node_ensure_version == '' { $munin_node_ensure_version = 'installed' } package { 'munin-node': ensure => $munin_node_ensure_version } Service['munin-node']{ diff --git a/manifests/host.pp b/manifests/host.pp index 3306195..e6b3916 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -5,9 +5,7 @@ class munin::host inherits munin { - case $munin_ensure_version { - '': { $munin_ensure_version = "installed" } - } + if $munin_ensure_version == '' { $munin_ensure_version = 'installed' } package {"munin": ensure => $munin_ensure_version, } -- cgit v1.2.3 From 637db5c2a02ab38df60e5c18dbb470db6c15c186 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 9 Aug 2010 17:34:43 -0400 Subject: have munin::host::cgi inherit munin::host. this prevents you from having to include both in the node definition for your munin host --- manifests/host/cgi.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index aeb0cdf..3039de1 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,4 +1,4 @@ -class munin::host::cgi { +class munin::host::cgi inherits munin::host { 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, -- cgit v1.2.3 From 56130bf23dd566caecba9c5be8ea255d56bea735 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 9 Aug 2010 17:55:20 -0400 Subject: add the logrotate.Debian file --- files/config/host/logrotate.Debian | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 files/config/host/logrotate.Debian diff --git a/files/config/host/logrotate.Debian b/files/config/host/logrotate.Debian new file mode 100644 index 0000000..411de3f --- /dev/null +++ b/files/config/host/logrotate.Debian @@ -0,0 +1,35 @@ +/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 apache +} + +/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 +} -- cgit v1.2.3 From 79ad433298c1646c17ccb336d4d06c3a6296ffdb Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 9 Aug 2010 18:12:29 -0400 Subject: add an $operatingsystem case to the host/cgi.pp for Debian, because the default apache group is www-data, not apache --- manifests/host/cgi.pp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 3039de1..45e0034 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,16 +1,27 @@ class munin::host::cgi inherits munin::host { - exec{'set_modes_for_cgi': + 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/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 => 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'], + } } + } - file{'/etc/logrotate.d/munin': - source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/logrotate", - "puppet://$server/modules/site-munin/config/host/logrotate.$operatingsystem", - "puppet://$server/modules/site-munin/config/host/logrotate", - "puppet://$server/modules/munin/config/host/logrotate.$operatingsystem", - "puppet://$server/modules/munin/config/host/logrotate" ], - owner => root, group => 0, mode => 0644; - } + file{'/etc/logrotate.d/munin': + source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/logrotate", + "puppet://$server/modules/site-munin/config/host/logrotate.$operatingsystem", + "puppet://$server/modules/site-munin/config/host/logrotate", + "puppet://$server/modules/munin/config/host/logrotate.$operatingsystem", + "puppet://$server/modules/munin/config/host/logrotate" ], + owner => root, group => 0, mode => 0644; + } } -- cgit v1.2.3 From 882bef6995352dd125b58ebbdadaddbd88121120 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 11 Aug 2010 10:27:33 -0400 Subject: fix ownership of logrotate files to reflect debian apache user (www-data) --- files/config/host/logrotate.Debian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/config/host/logrotate.Debian b/files/config/host/logrotate.Debian index 411de3f..732c871 100644 --- a/files/config/host/logrotate.Debian +++ b/files/config/host/logrotate.Debian @@ -13,7 +13,7 @@ rotate 7 compress notifempty - create 660 munin apache + create 660 munin www-data } /var/log/munin/munin-html.log { -- cgit v1.2.3 From fefc399e7e28ec871d91089d535073c2bc705009 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 10 Dec 2010 16:35:10 -0500 Subject: this change makes sure that munin-common is installed before munin-node is installed on Debian systems that are not lenny (would be nice if we could use operators for lsbdistcode name like 'if $lsbdistcodename >> "lenny") on Debian Squeeze and later, the munin-node package requires that munin-common be installed. this would normally be handled automatically by the packaging system, but if you utilize the $munin_node_ensure_version variable to set it to the backports version, and you have backports pinned properly (as the shared-apt module does it), it will fail to install the munin-common package from backports. you would think that this change should go in the debian.pp, but that is not possible because debian.pp inherits client/package.pp and thus the order happens wrong --- manifests/client/package.pp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 0fc3529..921d996 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -2,10 +2,24 @@ 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']{ + 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! -- cgit v1.2.3 From 74f66a8e77b153552ef52efee03187320e1ce877 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 10 Dec 2010 16:48:01 -0500 Subject: standardize formatting --- manifests/client/base.pp | 10 ++++- manifests/client/darwin.pp | 44 +++++++++++--------- manifests/client/debian.pp | 4 +- manifests/client/gentoo.pp | 8 ++-- manifests/client/openbsd.pp | 83 ++++++++++++++++++++----------------- manifests/client/package.pp | 1 + manifests/host/cgi.pp | 8 ++-- manifests/plugin.pp | 91 ++++++++++++++++++++--------------------- manifests/plugin/deploy.pp | 70 ++++++++++++++++--------------- manifests/plugin/scriptpaths.pp | 3 +- manifests/plugins/apache.pp | 10 +++-- manifests/plugins/base.pp | 91 ++++++++++++++++++++++------------------- manifests/plugins/dom0.pp | 15 +++---- manifests/plugins/gentoo.pp | 4 +- manifests/plugins/interfaces.pp | 32 +++++++-------- manifests/plugins/linux.pp | 16 ++++---- manifests/plugins/openbsd.pp | 14 +++---- manifests/plugins/physical.pp | 8 ++-- manifests/plugins/selinux.pp | 6 ++- manifests/plugins/vserver.pp | 10 +++-- manifests/register.pp | 24 +++++------ manifests/register_snmp.pp | 37 +++++++++-------- manifests/remoteplugin.pp | 30 +++++++------- manifests/snmp_collector.pp | 24 +++++------ 24 files changed, 342 insertions(+), 301 deletions(-) diff --git a/manifests/client/base.pp b/manifests/client/base.pp index b834e9b..0f0feca 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,23 +1,29 @@ class munin::client::base { + service { 'munin-node': ensure => running, enable => true, hasstatus => true, hasrestart => true, } - file {'/etc/munin': + + 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': + + 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 + } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index f6fc95f..5ae5b60 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,21 +1,27 @@ 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 bd0fad5..e75f484 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,13 +1,15 @@ class munin::client::debian inherits munin::client::package { + # 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"), } diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index 53d472b..e651134 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,8 +1,10 @@ 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 90bf7df..468cffa 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,43 +1,50 @@ # currently we install munin on openbsd by targz # :( + 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, - } + 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, + } } diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 921d996..f6e7a08 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -25,4 +25,5 @@ class munin::client::package inherits munin::client::base { # boot the munin-node without failure! before => Package['munin-node'], } + } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 45e0034..0cb3b32 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,14 +1,15 @@ class munin::host::cgi inherits munin::host { + case $operatingsystem { debian: { - exec{'set_modes_for_cgi': + 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/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 => File['/etc/munin/munin.conf.header'], } } default: { - exec{'set_modes_for_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'], @@ -16,7 +17,7 @@ class munin::host::cgi inherits munin::host { } } - file{'/etc/logrotate.d/munin': + file{ '/etc/logrotate.d/munin': source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/logrotate", "puppet://$server/modules/site-munin/config/host/logrotate.$operatingsystem", "puppet://$server/modules/site-munin/config/host/logrotate", @@ -24,4 +25,5 @@ class munin::host::cgi inherits munin::host { "puppet://$server/modules/munin/config/host/logrotate" ], owner => root, group => 0, mode => 0644; } + } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 1fa4651..10aab79 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -8,57 +8,54 @@ 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" - 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']; - } - - } + 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, } } - case $config { - '': { - file { $plugin_conf: 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: { - 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, - } - } - } - } + 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/deploy.pp b/manifests/plugin/deploy.pp index 846a873..d4dbf6d 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -1,37 +1,39 @@ -define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { - $plugin_src = $ensure ? { - 'present' => $name, - 'absent' => $name, - default => $ensure - } - $real_source = $source ? { - '' => "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; - } +define munin::plugin::deploy( $source = '', $ensure = 'present', $config = '' ) +{ + $plugin_src = $ensure ? { + 'present' => $name, + 'absent' => $name, + default => $ensure + } + + $real_source = $source ? { + '' => "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; + } - 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 { - 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 } + 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 { + 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 } + } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index ebaa6fa..bfdf1be 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,5 +1,6 @@ class munin::plugin::scriptpaths { - case $operatingsystem { + + case $operatingsystem { gentoo: { $script_path = "/usr/libexec/munin/plugins" } debian: { $script_path = "/usr/share/munin/plugins" } centos: { $script_path = "/usr/share/munin/plugins" } diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp index ee90de8..030e7e6 100644 --- a/manifests/plugins/apache.pp +++ b/manifests/plugins/apache.pp @@ -1,6 +1,8 @@ class munin::plugins::apache inherits munin::plugins::base { - munin::plugin{ "apache_accesses": } - munin::plugin{ "apache_processes": } - munin::plugin{ "apache_volume": } - munin::plugin::deploy { "apache_activity": } + + munin::plugin{ "apache_accesses": } + munin::plugin{ "apache_processes": } + munin::plugin{ "apache_volume": } + munin::plugin::deploy { "apache_activity": } + } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 5fc2476..64756bc 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -1,50 +1,55 @@ class munin::plugins::base { - file { - [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - source => "puppet://$server/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']; - '/etc/munin/plugin-conf.d/munin-node': - ensure => present, - mode => 0644, owner => root, group => 0, - notify => Service['munin-node'], - } - munin::plugin { - [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, uptime, vmstat - ]: - ensure => present, - } - include munin::plugins::interfaces + file { + [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: + source => "puppet://$server/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']; - 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'], - } - } + '/etc/munin/plugin-conf.d/munin-node': + ensure => present, + mode => 0644, owner => root, group => 0, + notify => Service['munin-node'], + } + + munin::plugin { + [ df, cpu, interrupts, load, memory, netstat, open_files, + processes, swap, uptime, vmstat ]: + ensure => present, + } + + include munin::plugins::interfaces + + case $kernel { + openbsd: { + File['/etc/munin/plugin-conf.d/munin-node']{ + before => File['/var/run/munin'], + } } - case $kernel { - linux: { - case $vserver { - guest: { include munin::plugins::vserver } - default: { - include munin::plugins::linux - } - } - } + default: { + File['/etc/munin/plugin-conf.d/munin-node']{ + before => Package['munin-node'], + } } - case $virtual { - physical: { include munin::plugins::physical } - xen0: { include munin::plugins::dom0 } + } + + case $kernel { + linux: { + case $vserver { + guest: { include munin::plugins::vserver } + default: { + include munin::plugins::linux + } + } } + } + + 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 8d919c3..3efc6bd 100644 --- a/manifests/plugins/dom0.pp +++ b/manifests/plugins/dom0.pp @@ -1,9 +1,10 @@ class munin::plugins::dom0 inherits munin::plugins::physical { - munin::plugin::deploy { "xen": config => "user root"} - munin::plugin::deploy { "xen-cpu": config => "user root"} - munin::plugin::deploy { "xen_memory": config => "user root"} - munin::plugin::deploy { "xen_mem": config => "user root"} - munin::plugin::deploy { "xen_vm": config => "user root"} - munin::plugin::deploy { "xen_vbd": config => "user root"} - munin::plugin::deploy { "xen_traffic_all": config => "user root"} + + munin::plugin::deploy { "xen": config => "user root"} + munin::plugin::deploy { "xen-cpu": config => "user root"} + munin::plugin::deploy { "xen_memory": config => "user root"} + munin::plugin::deploy { "xen_mem": config => "user root"} + munin::plugin::deploy { "xen_vm": config => "user root"} + munin::plugin::deploy { "xen_vbd": config => "user root"} + munin::plugin::deploy { "xen_traffic_all": config => "user root"} } diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp index 81d0e6b..6d02a24 100644 --- a/manifests/plugins/gentoo.pp +++ b/manifests/plugins/gentoo.pp @@ -1,3 +1,5 @@ class munin::plugins::gentoo inherits munin::plugins::base { - 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 99b85ba..de4b75b 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,22 +1,22 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces inherits munin::plugins::base { + + $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") - $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") - munin::plugin { - $ifs: ensure => "if_"; + munin::plugin { $ifs: ensure => "if_"; } + + case $operatingsystem { + openbsd: { + $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") + munin::plugin{ + $if_errs: ensure => "if_errcoll_"; + } } - case $operatingsystem { - openbsd: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") - munin::plugin{ - $if_errs: ensure => "if_errcoll_"; - } - } - default: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1") - munin::plugin{ - $if_errs: ensure => "if_err_"; - } - } + default: { + $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1") + munin::plugin{ + $if_errs: ensure => "if_err_"; + } } + } } diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index c7beb59..5c6afe9 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,10 +1,12 @@ class munin::plugins::linux inherits munin::plugins::base { - munin::plugin { - [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: - ensure => present; - acpi: - ensure => $acpi_available; - } - include munin::plugins::interfaces + munin::plugin { + [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: + ensure => present; + acpi: + ensure => $acpi_available; + } + + include munin::plugins::interfaces + } diff --git a/manifests/plugins/openbsd.pp b/manifests/plugins/openbsd.pp index 67cf32d..feb71fb 100644 --- a/manifests/plugins/openbsd.pp +++ b/manifests/plugins/openbsd.pp @@ -1,13 +1,9 @@ class munin::plugins::openbsd inherits munin::plugins::base { - munin::plugin { + + munin::plugin { [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, users, vmstat - ]: - ensure => present, - } - munin::plugin { - [ memory_pools, memory_types ]: + processes, swap, users, vmstat, memory_pools, memory_types ]: ensure => present, - } - + } + } diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp index 6706711..1bf1465 100644 --- a/manifests/plugins/physical.pp +++ b/manifests/plugins/physical.pp @@ -1,5 +1,7 @@ class munin::plugins::physical inherits munin::plugins::base { - case $kernel { - linux: { munin::plugin { iostat: } } - } + + case $kernel { + linux: { munin::plugin { iostat: } } + } + } diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp index 6affc86..847f0b9 100644 --- a/manifests/plugins/selinux.pp +++ b/manifests/plugins/selinux.pp @@ -1,4 +1,6 @@ class munin::plugins::selinux inherits munin::plugins::base { - munin::plugin::deploy { "selinuxenforced": } - munin::plugin::deploy { "selinux_avcstats": } + + munin::plugin::deploy { "selinuxenforced": } + munin::plugin::deploy { "selinux_avcstats": } + } diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp index bce28a1..ffc4b0a 100644 --- a/manifests/plugins/vserver.pp +++ b/manifests/plugins/vserver.pp @@ -1,7 +1,9 @@ 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 e1271e1..55b98fe 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,17 +1,17 @@ define munin::register() { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => $fqdn, - 'fqdn' => $fqdn, - default => $munin_host - } - - @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": - ensure => present, - content => template("munin/defaultclient.erb"), - tag => 'munin', - } + $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } + $munin_host_real = $munin_host ? { + '' => $fqdn, + 'fqdn' => $fqdn, + default => $munin_host + } + + @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": + ensure => present, + content => template("munin/defaultclient.erb"), + tag => 'munin', + } } diff --git a/manifests/register_snmp.pp b/manifests/register_snmp.pp index e74ba44..1ce606e 100644 --- a/manifests/register_snmp.pp +++ b/manifests/register_snmp.pp @@ -1,21 +1,22 @@ # snmp_testplugin: the plugin we use to test if it's set -define munin::register_snmp( - $snmpd_testplugin = 'load' -) +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', - } + $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 4bca235..cc83f8c 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 4f72b95..3b60541 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://$server/modules/munin/create_snmp_links.sh", - mode => 755, owner => root, group => 0; - } +class munin::snmp_collector { - 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 - } + 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 + } } -- cgit v1.2.3 From d4ba356a919c557cdd25f6038b8d0284366a2fe8 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 10 Dec 2010 17:01:29 -0500 Subject: another formatting fix --- manifests/client.pp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 1767c00..234523f 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -5,22 +5,24 @@ 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::centos } + default: { include munin::client::base } + } + + if $use_shorewall { + include shorewall::rules::munin + } + } -- cgit v1.2.3 From 6a5439f2ad807f15f588266432afa8fc2cd76410 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sun, 12 Dec 2010 18:15:06 -0500 Subject: fix syntax error introduced with previous commit --- manifests/plugin/deploy.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index d4dbf6d..0ab4e9f 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -32,7 +32,7 @@ define munin::plugin::deploy( $source = '', $ensure = 'present', $config = '' ) } # register the plugin - if $require { munin::plugin{$name: ensure => $ensure, config => $config, require => $require } } } + if $require { munin::plugin{$name: ensure => $ensure, config => $config, require => $require } } else { munin::plugin{$name: ensure => $ensure, config => $config } } -- cgit v1.2.3 From e7cb137590fc0c28da9854252c76c3e08b866c63 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 24 Mar 2011 23:28:25 -0400 Subject: remove outdated and undesirable apt_all plugin on debian systems which triggers random apt-get update commands Conflicts: manifests/plugins/debian.pp --- manifests/plugins/debian.pp | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp index 970fa9d..6d2faef 100644 --- a/manifests/plugins/debian.pp +++ b/manifests/plugins/debian.pp @@ -1,4 +1,2 @@ class munin::plugins::debian inherits munin::plugins::base { - munin::plugin { apt_all: ensure => present; } } - -- cgit v1.2.3 From 105b64eee4c6e326aa5e7e9c842318b45f72977b Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Mon, 1 Feb 2010 15:31:06 -0500 Subject: remove nagios plugin, now provided by nagios module --- files/plugins/nagios_hosts | 28 ---------------------------- files/plugins/nagios_perf_ | 35 ----------------------------------- files/plugins/nagios_svc | 33 --------------------------------- manifests/plugins/nagios.pp | 20 -------------------- 4 files changed, 116 deletions(-) delete mode 100755 files/plugins/nagios_hosts delete mode 100755 files/plugins/nagios_perf_ delete mode 100755 files/plugins/nagios_svc delete mode 100644 manifests/plugins/nagios.pp diff --git a/files/plugins/nagios_hosts b/files/plugins/nagios_hosts deleted file mode 100755 index 842ef43..0000000 --- a/files/plugins/nagios_hosts +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -if [ "$1" = "config" ]; then - echo 'graph_title Nagios host stats' - echo 'graph_args --base 1000 -l 0' - echo 'graph_vlabel hosts' - echo 'graph_category nagios' - echo 'graph_info The number of hosts checked by nagios' - echo 'up.label up' - echo 'up.draw AREA' - echo 'up.info number of hosts UP' - echo 'down.label down' - echo 'down.draw STACK' - echo 'down.info number of hosts DOWN' - echo 'unr.label unr' - echo 'unr.draw STACK' - echo 'unr.info number of hosts UNREACHABLE' - - exit 0 -fi - -echo -n 'up.value ' -nagiostats --mrtg --data NUMHSTUP -echo -n 'down.value ' -nagiostats --mrtg --data NUMHSTDOWN -echo -n 'unr.value ' -nagiostats --mrtg --data NUMHSTUNR - diff --git a/files/plugins/nagios_perf_ b/files/plugins/nagios_perf_ deleted file mode 100755 index 4d292c7..0000000 --- a/files/plugins/nagios_perf_ +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -NAME=$(basename $0) - -TYPE=${NAME##nagios_perf_} - -[ "x$TYPE" = 'xhosts' ] && TYPE_ABBR=HST -[ "x$TYPE" = 'xsvc' ] && TYPE_ABBR=SVC -[ -z "$TYPE_ABBR" ] && echo "unknown type $TYPE" >&2 && exit 1 - -if [ "$1" = "config" ]; then - echo "graph_title Nagios $TYPE performance stats" - echo "graph_args --base 1000" - echo "graph_vlabel seconds" - echo "graph_category nagios" - echo "graph_info Check performance statistics" - - echo "act_lat_$TYPE_ABBR.label act lat" - echo "act_lat_$TYPE_ABBR.type GAUGE" - echo "act_lat_$TYPE_ABBR.draw AREA" - echo "act_lat_$TYPE_ABBR.cdef act_lat_$TYPE_ABBR,1000,/" - echo "act_lat_$TYPE_ABBR.info average latency of active checks over the last 5 minutes" - - echo "act_ext_$TYPE_ABBR.label act ext" - echo "act_ext_$TYPE_ABBR.type GAUGE" - echo "act_ext_$TYPE_ABBR.draw LINE1" - echo "act_ext_$TYPE_ABBR.cdef act_ext_$TYPE_ABBR,1000,/" - echo "act_ext_$TYPE_ABBR.info average execution time of active checks over the last 5 minutes" - - exit 0 -fi - -echo "act_lat_$TYPE_ABBR.value " $(nagiostats --mrtg --data AVGACT${TYPE_ABBR}LAT) -echo "act_ext_$TYPE_ABBR.value " $(nagiostats --mrtg --data AVGACT${TYPE_ABBR}EXT) - diff --git a/files/plugins/nagios_svc b/files/plugins/nagios_svc deleted file mode 100755 index 86fcabf..0000000 --- a/files/plugins/nagios_svc +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -if [ "$1" = "config" ]; then - echo 'graph_title Nagios service stats' - echo 'graph_args --base 1000 -l 0' - echo 'graph_vlabel services' - echo 'graph_category nagios' - echo 'graph_info The number of services checked by nagios' - echo 'ok.label ok' - echo 'ok.draw AREA' - echo 'ok.info number of services OK' - echo 'warn.label warn' - echo 'warn.draw STACK' - echo 'warn.info number of services WARNING' - echo 'crit.label crit' - echo 'crit.draw STACK' - echo 'crit.info number of services CRITICAL' - echo 'unkn.label unkn' - echo 'unkn.draw STACK' - echo 'unkn.info number of services UNKNOWN' - - exit 0 -fi - -echo -n 'ok.value ' -nagiostats --mrtg --data NUMSVCOK -echo -n 'warn.value ' -nagiostats --mrtg --data NUMSVCWARN -echo -n 'crit.value ' -nagiostats --mrtg --data NUMSVCCRIT -echo -n 'unkn.value ' -nagiostats --mrtg --data NUMSVCUNKN - diff --git a/manifests/plugins/nagios.pp b/manifests/plugins/nagios.pp deleted file mode 100644 index c07e99d..0000000 --- a/manifests/plugins/nagios.pp +++ /dev/null @@ -1,20 +0,0 @@ -class munin::plugins::nagios inherits munin::plugins::base { - - munin::plugin::deploy { - nagios_hosts: config => 'user root'; - nagios_svc: config => 'user root'; - nagios_perf_hosts: ensure => nagios_perf_, config => 'user root'; - nagios_perf_svc: ensure => nagios_perf_, config => 'user root'; - } - - exec { 'munin_nagios2stats_link': - command => 'ln -s /usr/sbin/nagios2stats /usr/local/sbin/nagiostats', - onlyif => ["test ! -e /usr/local/sbin/nagiostats", "test -e /usr/sbin/nagios2stats"], - } - - exec { 'munin_nagios3stats_link': - command => 'ln -s /usr/sbin/nagios3stats /usr/local/sbin/nagiostats', - onlyif => ["test ! -e /usr/local/sbin/nagiostats", "test -e /usr/sbin/nagios3stats"], - } - -} -- cgit v1.2.3 From b3e29447187e289c60a4a9f7830032f1b10fae2f Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 24 Mar 2011 23:31:58 -0400 Subject: add ability to register a non-puppet-managed munin node Conflicts: manifests/register.pp --- manifests/register.pp | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/manifests/register.pp b/manifests/register.pp index 55b98fe..59500a0 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,17 +1,30 @@ -define munin::register() +define munin::register( + $host = 'absent', + $port = 'absent' +) { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => $fqdn, - 'fqdn' => $fqdn, - default => $munin_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 { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": + ensure => present, + content => template("munin/defaultclient.erb"), + tag => 'munin', + } } -- cgit v1.2.3 From a08b5db5d00980233fc5fea21e292f3b433119a0 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 25 Mar 2011 12:07:08 -0400 Subject: fix syntax error as a result of the merge --- manifests/client/package.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 0ee7443..29f256d 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -7,7 +7,7 @@ class munin::client::package inherits munin::client::base { before => Package['munin-node'], ensure => $munin_node_ensure_version; } - + } package { 'munin-node': ensure => $munin_node_ensure_version } Service['munin-node']{ require => Package[munin-node], @@ -17,5 +17,5 @@ class munin::client::package inherits munin::client::base { # boot the munin-node without failure! before => Package['munin-node'], } - } } + -- cgit v1.2.3 From e17c0e0fae335470971cc628d71a798d168e70af Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 29 Mar 2011 17:18:40 -0400 Subject: fix merge conflict syntax error --- manifests/host.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifests/host.pp b/manifests/host.pp index cf445ce..9d30d6a 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -18,6 +18,8 @@ class munin::host inherits munin "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; + } concatenated_file { "/etc/munin/munin.conf": dir => '/var/lib/puppet/modules/munin/nodes', -- cgit v1.2.3