From 23b3b3caca4b00f900ed323e7186453eb23ff6f6 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 30 Oct 2009 22:05:22 +0100 Subject: switch to new lsb way --- manifests/init.pp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index e5a92af..983c7d5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,7 +16,3 @@ # IP addresses and still be happy modules_dir { [ "munin", "munin/nodes", "munin/plugins" ]: } - -case $operatingsystem { - debian,ubuntu: { include assert_lsbdistcodename } -} -- cgit v1.2.3 From 11c66b121dbd6a9ce1cb77067d2844839b9c609f Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 31 Oct 2009 15:16:31 +0100 Subject: move plugin directory to fit new 0.25 style --- lib/facter/acpi_available.rb | 10 ++++++++++ lib/facter/interfaces.rb | 13 +++++++++++++ plugins/facter/acpi_available.rb | 10 ---------- plugins/facter/interfaces.rb | 13 ------------- 4 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 lib/facter/acpi_available.rb create mode 100755 lib/facter/interfaces.rb delete mode 100644 plugins/facter/acpi_available.rb delete mode 100755 plugins/facter/interfaces.rb diff --git a/lib/facter/acpi_available.rb b/lib/facter/acpi_available.rb new file mode 100644 index 0000000..9a0474f --- /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 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/lib/facter/interfaces.rb b/lib/facter/interfaces.rb new file mode 100755 index 0000000..a498d64 --- /dev/null +++ b/lib/facter/interfaces.rb @@ -0,0 +1,13 @@ +# 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/acpi_available.rb b/plugins/facter/acpi_available.rb deleted file mode 100644 index 9a0474f..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 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/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 -- cgit v1.2.3 From 36c07aa6cb615aad0cc5dd7d163221383d7ff9bb Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 2 Nov 2009 00:57:23 +0100 Subject: recursivly updating file path to new 0.25 style --- manifests/client/openbsd.pp | 2 +- manifests/host.pp | 4 ++-- manifests/host/cgi.pp | 4 ++-- manifests/snmp_collector.pp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 17abdbf..90bf7df 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -2,7 +2,7 @@ # :( class munin::client::openbsd inherits munin::client::base { file{'/usr/src/munin_openbsd.tar.gz': - source => "puppet://$server/munin/openbsd/package/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', diff --git a/manifests/host.pp b/manifests/host.pp index 9251516..bbfd0db 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -12,8 +12,8 @@ class munin::host source => [ "puppet://$server/files/munin/config/host/${fqdn}/munin.conf.header", "puppet://$server/files/munin/config/host/munin.conf.header.$operatingsystem", "puppet://$server/files/munin/config/host/munin.conf.header", - "puppet://$server/munin/config/host/munin.conf.header.$operatingsystem", - "puppet://$server/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; } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 7fdb281..6896b22 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -9,8 +9,8 @@ class munin::host::cgi { source => [ "puppet://$server/files/munin/config/host/${fqdn}/logrotate", "puppet://$server/files/munin/config/host/logrotate.$operatingsystem", "puppet://$server/files/munin/config/host/logrotate", - "puppet://$server/munin/config/host/logrotate.$operatingsystem", - "puppet://$server/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; } } diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp index 53a860f..4f72b95 100644 --- a/manifests/snmp_collector.pp +++ b/manifests/snmp_collector.pp @@ -1,7 +1,7 @@ class munin::snmp_collector{ file { "/var/lib/puppet/modules/munin/create_snmp_links": - source => "puppet://$server/munin/create_snmp_links.sh", + source => "puppet://$server/modules/munin/create_snmp_links.sh", mode => 755, owner => root, group => 0; } -- cgit v1.2.3 From 28628310d169c03f9778e22c8aee6bc926829579 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 2 Nov 2009 01:13:57 +0100 Subject: change pending module file resources to new 0.25 style --- manifests/plugins/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 1bfed48..4658acc 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -1,7 +1,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", ignore => [ '\.ignore', 'snmp_*' ], ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, -- cgit v1.2.3 From 81abf6e0558e5fd9be6c61c380083150d9c3123d Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 14 Nov 2009 13:14:09 +0100 Subject: use correct path --- manifests/client/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 1f72e7e..b3fcc4a 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -5,7 +5,7 @@ class munin::client::base { hasstatus => true, hasrestart => true, } - file {'/etc/munin/': + file {'/etc/munin': ensure => directory, mode => 0755, owner => root, group => 0; } -- cgit v1.2.3 From 53f373c61b0452488cdfb1d2779364e7865011ca Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 14 Nov 2009 13:15:30 +0100 Subject: update file paths to 0.25.x style --- manifests/host.pp | 6 +++--- manifests/host/cgi.pp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/host.pp b/manifests/host.pp index bbfd0db..af78570 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -9,9 +9,9 @@ class munin::host File <<| tag == 'munin' |>> file{'/etc/munin/munin.conf.header': - source => [ "puppet://$server/files/munin/config/host/${fqdn}/munin.conf.header", - "puppet://$server/files/munin/config/host/munin.conf.header.$operatingsystem", - "puppet://$server/files/munin/config/host/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'], diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 6896b22..aeb0cdf 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -6,9 +6,9 @@ class munin::host::cgi { } file{'/etc/logrotate.d/munin': - source => [ "puppet://$server/files/munin/config/host/${fqdn}/logrotate", - "puppet://$server/files/munin/config/host/logrotate.$operatingsystem", - "puppet://$server/files/munin/config/host/logrotate", + 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 f1f906dda45a652697704331737166224382d0f3 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 14 Nov 2009 13:23:19 +0100 Subject: modules prefix path --- 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 47bf796..29d9978 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -11,7 +11,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { include munin::plugin::scriptpaths file { "munin_plugin_${name}": path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet://$server/$real_source", + source => "puppet://$server/modlues/$real_source", mode => 0755, owner => root, group => 0; } -- cgit v1.2.3 From c2b3bc7cc42a3944b06088a2c66f77deaf3e2bd3 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 14 Nov 2009 13:33:13 +0100 Subject: fix typo --- 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 29d9978..846a873 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -11,7 +11,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { include munin::plugin::scriptpaths file { "munin_plugin_${name}": path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet://$server/modlues/$real_source", + source => "puppet://$server/modules/$real_source", mode => 0755, owner => root, group => 0; } -- cgit v1.2.3 From 76352415fec5c2ab6975e3a8843dd4983f7cae6a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 9 Dec 2009 17:48:41 -0500 Subject: modify nagios plugin to work with nagios2 and nagios3 --- files/plugins/nagios_hosts | 6 +++--- files/plugins/nagios_perf_ | 4 ++-- files/plugins/nagios_svc | 8 ++++---- manifests/plugins/nagios.pp | 12 ++++++++++++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/files/plugins/nagios_hosts b/files/plugins/nagios_hosts index 04fe8ed..842ef43 100755 --- a/files/plugins/nagios_hosts +++ b/files/plugins/nagios_hosts @@ -20,9 +20,9 @@ if [ "$1" = "config" ]; then fi echo -n 'up.value ' -nagios2stats --mrtg --data NUMHSTUP +nagiostats --mrtg --data NUMHSTUP echo -n 'down.value ' -nagios2stats --mrtg --data NUMHSTDOWN +nagiostats --mrtg --data NUMHSTDOWN echo -n 'unr.value ' -nagios2stats --mrtg --data NUMHSTUNR +nagiostats --mrtg --data NUMHSTUNR diff --git a/files/plugins/nagios_perf_ b/files/plugins/nagios_perf_ index f819def..4d292c7 100755 --- a/files/plugins/nagios_perf_ +++ b/files/plugins/nagios_perf_ @@ -30,6 +30,6 @@ if [ "$1" = "config" ]; then exit 0 fi -echo "act_lat_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}LAT) -echo "act_ext_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}EXT) +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 index 3938999..86fcabf 100755 --- a/files/plugins/nagios_svc +++ b/files/plugins/nagios_svc @@ -23,11 +23,11 @@ if [ "$1" = "config" ]; then fi echo -n 'ok.value ' -nagios2stats --mrtg --data NUMSVCOK +nagiostats --mrtg --data NUMSVCOK echo -n 'warn.value ' -nagios2stats --mrtg --data NUMSVCWARN +nagiostats --mrtg --data NUMSVCWARN echo -n 'crit.value ' -nagios2stats --mrtg --data NUMSVCCRIT +nagiostats --mrtg --data NUMSVCCRIT echo -n 'unkn.value ' -nagios2stats --mrtg --data NUMSVCUNKN +nagiostats --mrtg --data NUMSVCUNKN diff --git a/manifests/plugins/nagios.pp b/manifests/plugins/nagios.pp index 93a261c..c07e99d 100644 --- a/manifests/plugins/nagios.pp +++ b/manifests/plugins/nagios.pp @@ -1,8 +1,20 @@ 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 ab0c496979e18b6a2ef1a550e2385766c76f765e Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Thu, 10 Dec 2009 16:08:30 -0500 Subject: adapt module_dir to new common module and create 'munin' base class to provide it, instead of doing an import --- manifests/client.pp | 2 +- manifests/host.pp | 2 +- manifests/init.pp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) 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/host.pp b/manifests/host.pp index af78570..9fd637d 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -2,7 +2,7 @@ # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. -class munin::host +class munin::host inherits munin { package {"munin": ensure => installed, } diff --git a/manifests/init.pp b/manifests/init.pp index 983c7d5..578c4bb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,4 +15,6 @@ # the port is a parameter so vservers can share # IP addresses and still be happy -modules_dir { [ "munin", "munin/nodes", "munin/plugins" ]: } +class munin { + module_dir { [ "munin", "munin/nodes", "munin/plugins" ]: } +} -- cgit v1.2.3 From d13c333bba37688457f0ce8b3a76fe70135a9cb8 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 9a79e6ff75f62faf15978f1b43345e0d8bc51e8a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Mon, 1 Feb 2010 15:08:39 -0500 Subject: remove outdated and undesirable apt_all plugin on debian systems which triggers random apt-get update commands --- manifests/plugins/debian.pp | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp index f239989..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 b87436f0513d1fea94b3fda625fd9e1c4f20c4d0 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 e6b6a712447882174b4d0a357218dfb1aaa7faca Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 5 Mar 2010 08:56:12 +0100 Subject: new upstream config --- files/config/host/munin.conf.header.CentOS | 46 ++++++++++++++++++++++++------ templates/munin-node.conf.default | 24 ++++++++++++---- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS index dcadd6b..413cd84 100644 --- a/files/config/host/munin.conf.header.CentOS +++ b/files/config/host/munin.conf.header.CentOS @@ -1,21 +1,51 @@ # Example configuration file for Munin, generated by 'make build' # The next three variables specifies where the location of the RRD -# databases, the HTML output, and the logs, severally. They all -# must be writable by the user running munin-cron. -dbdir /var/lib/munin -htmldir /var/www/html/munin/ -logdir /var/log/munin -rundir /var/run/munin +# databases, the HTML output, logs and the lock/pid files. They all +# must be writable by the user running munin-cron. They are all +# defaulted to the values you see here. +# +# dbdir /var/lib/munin +# htmldir /var/www/html/munin +# logdir /var/log/munin +# rundir /var/run/munin +# +# tmpldir /etc/munin/templates -# Where to look for the HTML templates -tmpldir /etc/munin/templates +# (Exactly one) directory to include all files from. +# +# includedir /etc/munin/munin-conf.d # Make graphs show values per minute instead of per second #graph_period minute +# Graphics files are normaly generated by munin-graph, no matter if +# the graphs are used or not. You can change this to +# on-demand-graphing by following the instructions in +# http://munin.projects.linpro.no/wiki/CgiHowto +# graph_strategy cgi +# munin-cgi-graph is invoked by the web server up to very many times at the +# same time. This is not optimal since it results in high CPU and memory +# consumption to the degree that the system can thrash. Again the default is +# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as +# max_graph_jobs. +# +#munin_cgi_graph_jobs 6 + +# If the automatic CGI url is wrong for your system override it here: +# +#cgiurl_graph /cgi-bin/munin-cgi-graph + +# munin-graph runs in parallel, the number of concurrent processes is +# 6. If you want munin-graph to not be parallel set to 0. If set too +# high it will slow down munin-graph. Some experiments are needed to +# determine how many are optimal on your system. On a multi-core +# system with good SCSI disks the number can probably be quite high. +# +#max_graph_jobs 6 + # Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime # something changes (OK -> WARNING, CRITICAL -> OK, etc) #contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default index befcae4..afafa4b 100644 --- a/templates/munin-node.conf.default +++ b/templates/munin-node.conf.default @@ -1,21 +1,25 @@ ########## ########## Managed by puppet ########## +# +# Example config-file for munin-node +# log_level 4 log_file /var/log/munin/munin-node.log pid_file /var/run/munin/munin-node.pid background 1 -setseid 1 +setid 1 user root group 0 -setsid yes # Regexps for files to ignore ignore_file ~$ +#ignore_file [#~]$ # FIX doesn't work. '#' starts a comment +ignore_file DEADJOE$ ignore_file \.bak$ ignore_file %$ ignore_file \.dpkg-(tmp|new|old|dist)$ @@ -29,14 +33,24 @@ ignore_file \.pod$ host_name <%= fqdn %> # A list of addresses that are allowed to connect. This must be a -# regular expression, due to brain damage in Net::Server, which -# doesn't understand CIDR-style network notation. You may repeat -# the allow line as many times as you'd like +# regular expression, since Net::Server does not understand CIDR-style +# network notation unless the perl module Net::CIDR is installed. You +# may repeat the allow line as many times as you'd like <% real_munin_allow.split(':').each do |val| -%> allow <%= '^'+val.gsub(/\./, '\.')+'$' %> <% end -%> +# If you have installed the Net::CIDR perl module, you can use +# multiple cidr_allow and cidr_deny address/mask patterns. A +# connecting client must match any cidr_allow, and not match any +# cidr_deny. Example: + +# cidr_allow 127.0.0.1/32 +# cidr_allow 192.0.2.0/24 +# cidr_deny 192.0.2.42/32 + + # Which address to bind to; host <%= munin_host_real %> # host 127.0.0.1 -- cgit v1.2.3 From c1e5fe085837af4c5569404619c77310d4285253 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 7 Apr 2010 10:58:12 -0400 Subject: add ability to register a non-puppet-managed munin node --- manifests/register.pp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/manifests/register.pp b/manifests/register.pp index e1271e1..59500a0 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,10 +1,23 @@ -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 + $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}": -- cgit v1.2.3 From 4a3d25e393b2be1bea0d11ddc456ed3a7457d267 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 25 Apr 2010 13:24:40 +0200 Subject: update to new name --- templates/munin-node.conf.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default index afafa4b..e584df1 100644 --- a/templates/munin-node.conf.default +++ b/templates/munin-node.conf.default @@ -10,7 +10,7 @@ log_file /var/log/munin/munin-node.log pid_file /var/run/munin/munin-node.pid background 1 -setid 1 +setsid 1 user root group 0 -- cgit v1.2.3 From eef1345dd22c54b593966d0bede2d16747f01aa7 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 9 May 2010 23:45:06 +0200 Subject: adjust module_dir --- manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/init.pp b/manifests/init.pp index 578c4bb..5c4feeb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,5 +16,6 @@ # IP addresses and still be happy class munin { + include common::moduledir module_dir { [ "munin", "munin/nodes", "munin/plugins" ]: } } -- cgit v1.2.3 From 4591a91f7a8b169d0aa3ccb46357c60f8dcb7079 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Thu, 13 May 2010 14:12:07 -0400 Subject: remove tabs and trailing whitespaces in manifests --- manifests/client.pp | 12 +++++----- manifests/client/base.pp | 12 +++++----- manifests/client/centos.pp | 2 +- manifests/client/darwin.pp | 38 +++++++++++++++--------------- manifests/client/debian.pp | 18 +++++++------- manifests/client/gentoo.pp | 4 ++-- manifests/client/openbsd.pp | 2 +- manifests/client/package.pp | 8 +++---- manifests/host.pp | 16 ++++++------- manifests/init.pp | 10 ++++---- manifests/plugin.pp | 52 ++++++++++++++++++++--------------------- manifests/plugin/scriptpaths.pp | 10 ++++---- manifests/plugins/interfaces.pp | 6 ++--- manifests/plugins/linux.pp | 8 +++---- manifests/plugins/vserver.pp | 4 ++-- manifests/register.pp | 16 ++++++------- manifests/register_snmp.pp | 10 ++++---- manifests/remoteplugin.pp | 26 ++++++++++----------- manifests/snmp_collector.pp | 22 ++++++++--------- 19 files changed, 138 insertions(+), 138 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 24d84da..273070d 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -5,12 +5,12 @@ class munin::client inherits munin { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => '*', - 'fqdn' => '*', - default => $munin_host - } + $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 } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index b3fcc4a..afa12a0 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,6 +1,6 @@ class munin::client::base { service { 'munin-node': - ensure => running, + ensure => running, enable => true, hasstatus => true, hasrestart => true, @@ -14,10 +14,10 @@ class munin::client::base { default => $munin_allow } file {'/etc/munin/munin-node.conf': - content => template("munin/munin-node.conf.$operatingsystem"), + content => template("munin/munin-node.conf.$operatingsystem"), notify => Service['munin-node'], - mode => 0644, owner => root, group => 0, - } - munin::register { $fqdn: } - include munin::plugins::base + mode => 0644, owner => root, group => 0, + } + munin::register { $fqdn: } + include munin::plugins::base } diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp index 46a7e3f..42e8c59 100644 --- a/manifests/client/centos.pp +++ b/manifests/client/centos.pp @@ -1,3 +1,3 @@ class munin::client::centos inherits munin::client::package { - include munin::plugins::centos + include munin::plugins::centos } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index f6fc95f..369a605 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,21 +1,21 @@ 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 a6d677e..97f5fbf 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,15 +1,15 @@ class munin::client::debian inherits munin::client::package { # the plugin will need that - package { "iproute": ensure => installed } + package { "iproute": ensure => installed } - Service["munin-node"]{ - # sarge's munin-node init script has no status - hasstatus => $lsbdistcodename ? { sarge => false, default => true } - } + 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"), + content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"), } - # workaround bug in munin_node_configure - plugin { "postfix_mailvolume": ensure => absent } - include munin::plugins::debian + # workaround bug in munin_node_configure + plugin { "postfix_mailvolume": ensure => absent } + include munin::plugins::debian } diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index 53d472b..c24d317 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -3,6 +3,6 @@ class munin::client::gentoo inherits munin::client::package { 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..c10a474 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -5,7 +5,7 @@ class munin::client::openbsd inherits munin::client::base { 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', + 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, diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 84fcf5c..18566b8 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 } + 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'], + # this has to be installed before the package, so the postinst can + # boot the munin-node without failure! + before => Package['munin-node'], } } diff --git a/manifests/host.pp b/manifests/host.pp index 9fd637d..87d3255 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -4,9 +4,9 @@ class munin::host inherits munin { - package {"munin": ensure => installed, } + package {"munin": ensure => installed, } - File <<| tag == 'munin' |>> + File <<| tag == 'munin' |>> file{'/etc/munin/munin.conf.header': source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/munin.conf.header", @@ -18,12 +18,12 @@ class munin::host inherits munin 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", + 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; diff --git a/manifests/init.pp b/manifests/init.pp index 5c4feeb..bae83a4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -2,17 +2,17 @@ # munin module # munin.pp - everything a sitewide munin installation needs # Copyright (C) 2007 David Schmitt -# +# # Copyright 2008, Puzzle ITC GmbH # Marcel Härry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # -# This program is free software; you can redistribute -# it and/or modify it under the terms of the GNU -# General Public License version 3 as published by +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by # the Free Software Foundation. # -# the port is a parameter so vservers can share +# the port is a parameter so vservers can share # IP addresses and still be happy class munin { diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 1fa4651..cdaa17d 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -17,10 +17,10 @@ define munin::plugin ( $plugin = "/etc/munin/plugins/$name" $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf" case $ensure { - "absent": { - file { $plugin: ensure => absent, } - } - default: { + "absent": { + file { $plugin: ensure => absent, } + } + default: { case $kernel { openbsd: { $basic_require = File['/var/run/munin'] } default: { $basic_require = Package['munin-node'] } @@ -30,35 +30,35 @@ define munin::plugin ( } else { $real_require = $basic_require } - file { $plugin: - ensure => "${real_script_path}/${plugin_src}", - require => $real_require, - notify => Service['munin-node']; - } + file { $plugin: + ensure => "${real_script_path}/${plugin_src}", + require => $real_require, + notify => Service['munin-node']; + } - } + } } case $config { - '': { - file { $plugin_conf: ensure => absent } - } - default: { - case $ensure { - absent: { - file { $plugin_conf: ensure => absent } - } - default: { - file { $plugin_conf: - content => "[${name}]\n$config\n", - mode => 0644, owner => root, group => 0, - } + '': { + file { $plugin_conf: ensure => absent } + } + default: { + case $ensure { + absent: { + file { $plugin_conf: ensure => absent } + } + default: { + file { $plugin_conf: + content => "[${name}]\n$config\n", + mode => 0644, owner => root, group => 0, + } if $require { File[$plugin_conf]{ require +> $require, } } - } - } - } + } + } + } } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index ebaa6fa..ce27384 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,9 +1,9 @@ class munin::plugin::scriptpaths { case $operatingsystem { - gentoo: { $script_path = "/usr/libexec/munin/plugins" } - debian: { $script_path = "/usr/share/munin/plugins" } - centos: { $script_path = "/usr/share/munin/plugins" } - openbsd: { $script_path = "/opt/munin/lib/plugins/" } - default: { $script_path = "/usr/share/munin/plugins" } + gentoo: { $script_path = "/usr/libexec/munin/plugins" } + debian: { $script_path = "/usr/share/munin/plugins" } + centos: { $script_path = "/usr/share/munin/plugins" } + openbsd: { $script_path = "/opt/munin/lib/plugins/" } + default: { $script_path = "/usr/share/munin/plugins" } } } diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 99b85ba..df0828c 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -8,14 +8,14 @@ class munin::plugins::interfaces inherits munin::plugins::base { case $operatingsystem { openbsd: { $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") - munin::plugin{ + munin::plugin{ $if_errs: ensure => "if_errcoll_"; } } default: { $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1") - munin::plugin{ - $if_errs: ensure => "if_err_"; + munin::plugin{ + $if_errs: ensure => "if_err_"; } } } diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index c7beb59..86696cc 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,9 +1,9 @@ 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; + [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: + ensure => present; + acpi: + ensure => $acpi_available; } include munin::plugins::interfaces diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp index bce28a1..f24af07 100644 --- a/manifests/plugins/vserver.pp +++ b/manifests/plugins/vserver.pp @@ -1,7 +1,7 @@ class munin::plugins::vserver inherits munin::plugins::base { munin::plugin { - [ netstat, processes ]: - ensure => present; + [ netstat, processes ]: + ensure => present; } } diff --git a/manifests/register.pp b/manifests/register.pp index 59500a0..05d8f2a 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -3,7 +3,7 @@ define munin::register( $port = 'absent' ) { - $munin_port_real = $port ? { + $munin_port_real = $port ? { 'absent' => $munin_port ? { '' => 4949, default => $munin_port @@ -11,20 +11,20 @@ define munin::register( default => $port } - $munin_host_real = $host ? { + $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', - } + @@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..ebd494a 100644 --- a/manifests/register_snmp.pp +++ b/manifests/register_snmp.pp @@ -3,11 +3,11 @@ 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 + $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", diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp index 4bca235..ce87492 100644 --- a/manifests/remoteplugin.pp +++ b/manifests/remoteplugin.pp @@ -1,18 +1,18 @@ define munin::remoteplugin($ensure = "present", $source, $config = '') { case $ensure { - "absent": { munin::plugin{ $name: ensure => absent } } - default: { - file { - "/var/lib/puppet/modules/munin/plugins/${name}": - source => $source, - mode => 0755, owner => root, group => 0; - } - munin::plugin { $name: - ensure => $ensure, - config => $config, - script_path_in => "/var/lib/puppet/modules/munin/plugins", - } - } + "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..6f3fe34 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; - } + file { + "/var/lib/puppet/modules/munin/create_snmp_links": + source => "puppet://$server/modules/munin/create_snmp_links.sh", + mode => 755, owner => root, group => 0; + } - exec { "create_snmp_links": - command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes", - require => File["snmp_links"], - timeout => "2048", - schedule => daily - } + exec { "create_snmp_links": + command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes", + require => File["snmp_links"], + timeout => "2048", + schedule => daily + } } -- cgit v1.2.3 From f1586a7fbcc79fee6542790b1f4c930929af7e04 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 14 May 2010 11:02:03 -0400 Subject: refactor register class and client template --- manifests/client/base.pp | 4 +++- manifests/register.pp | 40 ++++++++++++++++++++++------------------ manifests/register/snmp.pp | 22 ++++++++++++++++++++++ manifests/register_snmp.pp | 21 --------------------- templates/client.erb | 18 ++++++++++++++++++ templates/defaultclient.erb | 15 --------------- templates/snmpclient.erb | 10 ---------- 7 files changed, 65 insertions(+), 65 deletions(-) create mode 100644 manifests/register/snmp.pp delete mode 100644 manifests/register_snmp.pp create mode 100644 templates/client.erb delete mode 100644 templates/defaultclient.erb delete mode 100644 templates/snmpclient.erb diff --git a/manifests/client/base.pp b/manifests/client/base.pp index afa12a0..17387e8 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -18,6 +18,8 @@ class munin::client::base { notify => Service['munin-node'], mode => 0644, owner => root, group => 0, } - munin::register { $fqdn: } + munin::register { $fqdn: + config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + } include munin::plugins::base } diff --git a/manifests/register.pp b/manifests/register.pp index 05d8f2a..21f1d35 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,30 +1,34 @@ -define munin::register( +define munin::register ( $host = 'absent', - $port = 'absent' + $port = 'absent', + $description = 'absent', + $config = [] ) { + $fhost = $name + $client_type = 'client' + $munin_port_real = $port ? { - 'absent' => $munin_port ? { - '' => 4949, - default => $munin_port - }, - default => $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 + 'absent' => $munin_host ? { + '' => $fqdn, + 'fqdn' => $fqdn, + default => $munin_host + }, + default => $host } - @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": + @@file { "munin_client_${fhost}_${munin_port_real}": ensure => present, - content => template("munin/defaultclient.erb"), + path => "/var/lib/puppet/modules/munin/nodes/${fhost}_${munin_port_real}", + content => template("munin/client.erb"), tag => 'munin', } } - - diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp new file mode 100644 index 0000000..c0d9279 --- /dev/null +++ b/manifests/register/snmp.pp @@ -0,0 +1,22 @@ +define munin::register::snmp ( + $community = 'public', + $description = 'absent' +) +{ + $fhost = $name + $munin_host_real = $fqdn + $client_type = 'snmp' + $config = [ 'use_node_name no' ] + + exec { "munin_register_snmp_${fhost}": + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh", + unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + } + + @@file { "munin_snmp_${fhost}": + ensure => present, + path => "/var/lib/puppet/modules/munin/nodes/${fhost}", + content => template("munin/client.erb"), + tag => 'munin', + } +} diff --git a/manifests/register_snmp.pp b/manifests/register_snmp.pp deleted file mode 100644 index ebd494a..0000000 --- a/manifests/register_snmp.pp +++ /dev/null @@ -1,21 +0,0 @@ -# snmp_testplugin: the plugin we use to test if it's set -define munin::register_snmp( - $snmpd_testplugin = 'load' -) -{ - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => '*', - 'fqdn' => '*', - default => $munin_host - } - exec{"register_snmp_munin_for_${name}": - command => "munin-node-configure-snmp ${name} | sh", - unless => "test -e /etc/munin/plugins/snmp_${name}_${snmpd_testplugin}", - } - @@file { "munin_snmp_${name}": path => "/var/lib/puppet/modules/munin/nodes/${name}", - ensure => present, - content => template("munin/snmpclient.erb"), - tag => 'munin', - } -} diff --git a/templates/client.erb b/templates/client.erb new file mode 100644 index 0000000..e7c6730 --- /dev/null +++ b/templates/client.erb @@ -0,0 +1,18 @@ +<% + # Downcase all information + dom = domain.downcase + host = hostname.downcase +%> + +### Munin client from Puppet template +# Domain: <%= dom %> +# Registered on: <%= host %> +# Type: <%= client_type %> +<% if description != 'absent' -%> +# Description: <%= description.gsub!(/\n/, ' ') %> +<% end -%> +[<%= fhost.downcase %>] + address <%= munin_host_real -%> +<% if config -%><% config.each do |val| -%> + <%= val -%> +<% end -%><% end -%> diff --git a/templates/defaultclient.erb b/templates/defaultclient.erb deleted file mode 100644 index 5611bf4..0000000 --- a/templates/defaultclient.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% - # Downcase all information - dom = domain.downcase - host = hostname.downcase - fhost = name.downcase -%> -### This syntax can be extended, it might get better ... -#+<%= dom %> -#-<%= host %>=<%= fhost %>:load.load -[<%= fhost %>] # linux box - address <%= munin_host_real %> - port <%= munin_port_real %> - use_node_name yes - load.load.warning 5 - load.load.critical 10 diff --git a/templates/snmpclient.erb b/templates/snmpclient.erb deleted file mode 100644 index 44ecc6d..0000000 --- a/templates/snmpclient.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% - # Downcase all information - dom = domain.downcase - host = hostname.downcase - fhost = name.downcase -%> -### This syntax can be extended, it might get better ... -#<%= dom %> snmp -> <%= fhost %> -[<%= fhost %>] # snmp box - address <%= munin_host_real %> -- cgit v1.2.3 From 95bae141ccac45f2658576c87e25af24c265cf97 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 22 May 2010 15:40:02 +0200 Subject: for new openbsd releases we can finally use a package --- manifests/client/openbsd.pp | 35 +++++++++++++++++++++++------------ manifests/plugin/scriptpaths.pp | 13 ++++++++----- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 90bf7df..2132f05 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,9 +1,21 @@ # currently we install munin on openbsd by targz # :( class munin::client::openbsd inherits munin::client::base { - file{'/usr/src/munin_openbsd.tar.gz': + if $operatingsystemrelease == '4.3' { + file{'/usr/src/munin_openbsd.tar.gz': source => "puppet://$server/modules/munin/openbsd/package/munin_openbsd.tar.gz", owner => root, group => 0, mode => 0600; + } + exec{'extract_openbsd': + command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz', + unless => 'test -d /opt/munin', + require => File['/usr/src/munin_openbsd.tar.gz'], + before => Exec['extract_openbsd'], + } + } else { + package{'munin-node': + ensure => installed, + } } package{ [ 'p5-Compress-Zlib', 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP', 'p5-LWP-UserAgent-Determined', @@ -11,29 +23,28 @@ class munin::client::openbsd inherits munin::client::base { 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; + ensure => directory, + owner => root, group => 0, mode => 0755; } openbsd::rc_local{'munin-node': - binary => '/opt/munin/sbin/munin-node', + binary => $operatingsystemrelease ? { + '4.3' => '/opt/munin/sbin/munin-node', + default => '/usr/local/sbin/munin-node' + }, require => File['/var/run/munin'], } Service['munin-node']{ restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`', stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`', - start => '/opt/munin/sbin/munin-node', + start => $operatingsystemrelease ? { + '4.3' => '/opt/munin/sbin/munin-node', + default => '/usr/local/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, diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index ebaa6fa..115644c 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,9 +1,12 @@ class munin::plugin::scriptpaths { case $operatingsystem { - gentoo: { $script_path = "/usr/libexec/munin/plugins" } - debian: { $script_path = "/usr/share/munin/plugins" } - centos: { $script_path = "/usr/share/munin/plugins" } - openbsd: { $script_path = "/opt/munin/lib/plugins/" } - default: { $script_path = "/usr/share/munin/plugins" } + gentoo: { $script_path = '/usr/libexec/munin/plugins' } + debian: { $script_path = '/usr/share/munin/plugins' } + centos: { $script_path = '/usr/share/munin/plugins' } + openbsd: { $script_path = $operatingsystemrelease ? { + '4.3' => '/opt/munin/lib/plugins/', + default => '/usr/local/libexec/munin/plugins/' + } } + default: { $script_path = '/usr/share/munin/plugins' } } } -- cgit v1.2.3 From 9ecc2313669ca80f30ae6a2b33308ffa062f9615 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 22 May 2010 15:51:14 +0200 Subject: this package is not anymore needed on latest openbsd --- manifests/client/openbsd.pp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 2132f05..31a9621 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -12,14 +12,18 @@ class munin::client::openbsd inherits munin::client::base { require => File['/usr/src/munin_openbsd.tar.gz'], before => Exec['extract_openbsd'], } + package{'p5-Compress-Zlib': + ensure => installed, + before => File['/var/run/munin'], + } } else { package{'munin-node': ensure => installed, } } - 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' ]: + package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP', + 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server', + 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]: ensure => installed, before => File['/var/run/munin'], } -- cgit v1.2.3 From 45c08416b675141f75a07bb0d918109fb0eb3581 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 22 May 2010 20:49:52 +0200 Subject: check status over pidfile --- manifests/client/openbsd.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 31a9621..3c65fbd 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -45,8 +45,9 @@ class munin::client::openbsd inherits munin::client::base { '4.3' => '/opt/munin/sbin/munin-node', default => '/usr/local/sbin/munin-node' }, - hasstatus => false, - hasrestart => false, + status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^$(cat /var/run/munin/munin-node.pid).*munin-node")', + hasstatus => true, + hasrestart => true, require => [ File['/var/run/munin'], File['/var/log/munin'] ], } cron{'clean_munin_logfile': -- cgit v1.2.3 From d63bc7ba3edc39e2fe7dbbefd87edac45176b13b Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 5 Jun 2010 12:20:24 +0200 Subject: fix dependency cycle --- manifests/client/openbsd.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 3c65fbd..8de025e 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -10,7 +10,7 @@ class munin::client::openbsd inherits munin::client::base { command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz', unless => 'test -d /opt/munin', require => File['/usr/src/munin_openbsd.tar.gz'], - before => Exec['extract_openbsd'], + before => File['/var/run/munin'], } package{'p5-Compress-Zlib': ensure => installed, -- cgit v1.2.3 From dab730ed6b0667d4356c0e8e21e37719ea977a93 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 15 Jul 2010 20:41:39 +0200 Subject: fixing weird class setup we had some weird class setup which caused some problems on 2.6 (see puppet bug #4242 for more info). This commit cleans that weird setup up and decouples a lot of things. --- manifests/plugin.pp | 2 ++ manifests/plugins/apache.pp | 8 ++---- manifests/plugins/base.pp | 63 +++++++++++++---------------------------- manifests/plugins/debian.pp | 3 +- manifests/plugins/djbdns.pp | 2 +- manifests/plugins/dom0.pp | 14 ++++----- manifests/plugins/gentoo.pp | 6 ++-- manifests/plugins/interfaces.pp | 32 ++++++++++----------- manifests/plugins/linux.pp | 16 +++++------ manifests/plugins/muninhost.pp | 5 ++-- manifests/plugins/openbsd.pp | 17 ++++------- manifests/plugins/physical.pp | 8 +++--- manifests/plugins/selinux.pp | 5 ++-- manifests/plugins/setup.pp | 27 ++++++++++++++++++ manifests/plugins/vserver.pp | 10 +++---- 15 files changed, 104 insertions(+), 114 deletions(-) create mode 100644 manifests/plugins/setup.pp diff --git a/manifests/plugin.pp b/manifests/plugin.pp index cdaa17d..52c77c2 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -16,6 +16,8 @@ define munin::plugin ( $plugin_src = $ensure ? { "present" => $name, default => $ensure } $plugin = "/etc/munin/plugins/$name" $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf" + + include munin::plugins::setup case $ensure { "absent": { file { $plugin: ensure => absent, } diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp index ee90de8..b3e7634 100644 --- a/manifests/plugins/apache.pp +++ b/manifests/plugins/apache.pp @@ -1,6 +1,4 @@ -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": } +class munin::plugins::apache { + munin::plugin{ [ 'apache_accesses', 'apache_processes',' apache_volume' ]: } + munin::plugin::deploy { "apache_activity": } } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 4658acc..bfccae5 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -1,50 +1,25 @@ 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, users, vmstat - ]: + # setup basic plugins + munin::plugin { + [ df, cpu, interrupts, load, memory, netstat, open_files, + processes, swap, uptime, users, vmstat ]: ensure => present, - } - include munin::plugins::interfaces + } + include munin::plugins::interfaces - 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'], - } - } - } - 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 } + case $kernel { + openbsd: { include munin::plugins::openbsd } + 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/debian.pp b/manifests/plugins/debian.pp index 6d2faef..f756150 100644 --- a/manifests/plugins/debian.pp +++ b/manifests/plugins/debian.pp @@ -1,2 +1 @@ -class munin::plugins::debian inherits munin::plugins::base { -} +class munin::plugins::debian { } diff --git a/manifests/plugins/djbdns.pp b/manifests/plugins/djbdns.pp index 37d8ed6..c0a5163 100644 --- a/manifests/plugins/djbdns.pp +++ b/manifests/plugins/djbdns.pp @@ -1,3 +1,3 @@ -class munin::plugins::djbdns inherits munin::plugins::base { +class munin::plugins::djbdns { munin::plugin::deploy { "tinydns": } } diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp index 8d919c3..3be3e3f 100644 --- a/manifests/plugins/dom0.pp +++ b/manifests/plugins/dom0.pp @@ -1,9 +1,7 @@ -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"} +class munin::plugins::dom0 { + munin::plugin::deploy { + [ 'xen', 'xen-cpu', 'xen_memory', 'xen_mem', + 'xen_vm', 'xen_vbd' 'xen_traffic_all' ]: + config => 'user root'; + } } diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp index 81d0e6b..25c1626 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"} +class munin::plugins::gentoo { + munin::plugin::deploy { 'gentoo_lastupdated': + config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep" + } } diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index df0828c..e0744a0 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 { +class munin::plugins::interfaces { - $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") - munin::plugin { + $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") + 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 86696cc..30e0af6 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,10 +1,8 @@ -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 +class munin::plugins::linux { + munin::plugin { + [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: + ensure => present; + acpi: + ensure => $acpi_available; + } } diff --git a/manifests/plugins/muninhost.pp b/manifests/plugins/muninhost.pp index 2af4897..e4fb87d 100644 --- a/manifests/plugins/muninhost.pp +++ b/manifests/plugins/muninhost.pp @@ -1,4 +1,3 @@ -class munin::plugins::muninhost inherits munin::plugins::base { - munin::plugin { munin_update: } - munin::plugin { munin_graph: } +class munin::plugins::muninhost { + munin::plugin { ['munin_update', 'munin_graph']: } } diff --git a/manifests/plugins/openbsd.pp b/manifests/plugins/openbsd.pp index 67cf32d..b549994 100644 --- a/manifests/plugins/openbsd.pp +++ b/manifests/plugins/openbsd.pp @@ -1,13 +1,6 @@ -class munin::plugins::openbsd inherits munin::plugins::base { - munin::plugin { - [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, users, vmstat - ]: - ensure => present, - } - munin::plugin { - [ memory_pools, memory_types ]: - ensure => present, - } - +class munin::plugins::openbsd { + munin::plugin { + [ memory_pools, memory_types ]: + ensure => present, + } } diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp index 6706711..ac050a5 100644 --- a/manifests/plugins/physical.pp +++ b/manifests/plugins/physical.pp @@ -1,5 +1,5 @@ -class munin::plugins::physical inherits munin::plugins::base { - case $kernel { - linux: { munin::plugin { iostat: } } - } +class munin::plugins::physical { + case $kernel { + linux: { munin::plugin { iostat: } } + } } diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp index 6affc86..faf610a 100644 --- a/manifests/plugins/selinux.pp +++ b/manifests/plugins/selinux.pp @@ -1,4 +1,3 @@ -class munin::plugins::selinux inherits munin::plugins::base { - munin::plugin::deploy { "selinuxenforced": } - munin::plugin::deploy { "selinux_avcstats": } +class munin::plugins::selinux { + munin::plugin::deploy { [ 'selinuxenforced', 'selinux_avcstats' ]: } } diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp new file mode 100644 index 0000000..f645f12 --- /dev/null +++ b/manifests/plugins/setup.pp @@ -0,0 +1,27 @@ +class munin::plugins::setup { + 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'], + } + 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'], + } + } + } +} diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp index f24af07..e3eec05 100644 --- a/manifests/plugins/vserver.pp +++ b/manifests/plugins/vserver.pp @@ -1,7 +1,7 @@ -class munin::plugins::vserver inherits munin::plugins::base { - munin::plugin { - [ netstat, processes ]: - ensure => present; - } +class munin::plugins::vserver { + munin::plugin { + [ netstat, processes ]: + ensure => present; + } } -- cgit v1.2.3 From 271fb020c2f0265cf4eeb82e79c8beab9eee14ff Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 19 Jul 2010 21:34:29 +0200 Subject: fixing a possible include problem --- manifests/plugins/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index bfccae5..2924599 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -20,6 +20,6 @@ class munin::plugins::base { case $virtual { physical: { include munin::plugins::physical } - xen0: { include munin::plugins::dom0 } + xen0: { include "munin::plugins::dom0" } } } -- cgit v1.2.3 From 002e6fb8f374de98a9532102248e0776ecfdb3c8 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 19 Jul 2010 21:41:05 +0200 Subject: another fix for inclusion --- manifests/plugins/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index 2924599..ff36a19 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -20,6 +20,6 @@ class munin::plugins::base { case $virtual { physical: { include munin::plugins::physical } - xen0: { include "munin::plugins::dom0" } + xen0: { include ::munin::plugins::dom0 } } } -- cgit v1.2.3 From 892232f7c419fed071b7b1bdb0e3a2b9482c7449 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 19 Jul 2010 21:41:55 +0200 Subject: fixing the actual problem --- manifests/plugins/base.pp | 2 +- manifests/plugins/dom0.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index ff36a19..bfccae5 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -20,6 +20,6 @@ class munin::plugins::base { case $virtual { physical: { include munin::plugins::physical } - xen0: { include ::munin::plugins::dom0 } + xen0: { include munin::plugins::dom0 } } } diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp index 3be3e3f..ed4f62c 100644 --- a/manifests/plugins/dom0.pp +++ b/manifests/plugins/dom0.pp @@ -1,7 +1,7 @@ class munin::plugins::dom0 { munin::plugin::deploy { [ 'xen', 'xen-cpu', 'xen_memory', 'xen_mem', - 'xen_vm', 'xen_vbd' 'xen_traffic_all' ]: + 'xen_vm', 'xen_vbd', 'xen_traffic_all' ]: config => 'user root'; } } -- cgit v1.2.3 From b491a012b6c2af328a782d27d8109aa282611f0c Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 20 Jul 2010 00:32:09 +0200 Subject: remove escaping --- manifests/plugins/setup.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index f645f12..e0d445c 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -2,7 +2,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: source => "puppet://$server/modules/common/empty", - ignore => [ '\.ignore', 'snmp_*' ], + ignore => [ '.ignore', 'snmp_*' ], ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0, -- cgit v1.2.3 From fc9a763859a4817a6f7ae06b3b3298e8325ff351 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 21 Jul 2010 07:53:05 +0200 Subject: Revert "remove escaping" This reverts commit b491a012b6c2af328a782d27d8109aa282611f0c. --- manifests/plugins/setup.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index e0d445c..f645f12 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -2,7 +2,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: source => "puppet://$server/modules/common/empty", - ignore => [ '.ignore', 'snmp_*' ], + ignore => [ '\.ignore', 'snmp_*' ], ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0, -- cgit v1.2.3 From dbcbf2607d52e922c20d0491400ab3099d0dba2a Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 2 Aug 2010 01:54:15 +0200 Subject: escaping --- manifests/plugins/setup.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index f645f12..e0d445c 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -2,7 +2,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: source => "puppet://$server/modules/common/empty", - ignore => [ '\.ignore', 'snmp_*' ], + ignore => [ '.ignore', 'snmp_*' ], ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0, -- cgit v1.2.3 From 3ccc8e2495a66ae9681bef64a4034a0e7828bf14 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 7 Aug 2010 02:12:20 +0200 Subject: remove unnecessary fileserver variable (#2460) --- manifests/client/openbsd.pp | 2 +- manifests/host.pp | 10 +++++----- manifests/host/cgi.pp | 10 +++++----- manifests/plugin/deploy.pp | 2 +- manifests/plugins/setup.pp | 2 +- manifests/snmp_collector.pp | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 8de025e..7012c00 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -3,7 +3,7 @@ class munin::client::openbsd inherits munin::client::base { if $operatingsystemrelease == '4.3' { file{'/usr/src/munin_openbsd.tar.gz': - source => "puppet://$server/modules/munin/openbsd/package/munin_openbsd.tar.gz", + source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz", owner => root, group => 0, mode => 0600; } exec{'extract_openbsd': diff --git a/manifests/host.pp b/manifests/host.pp index 87d3255..e038fd7 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -9,11 +9,11 @@ class munin::host inherits munin 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" ], + source => [ "puppet:///modules/site-munin/config/host/${fqdn}/munin.conf.header", + "puppet:///modules/site-munin/config/host/munin.conf.header.$operatingsystem", + "puppet:///modules/site-munin/config/host/munin.conf.header", + "puppet:///modules/munin/config/host/munin.conf.header.$operatingsystem", + "puppet:///modules/munin/config/host/munin.conf.header" ], notify => Exec['concat_/etc/munin/munin.conf'], owner => root, group => 0, mode => 0644; } diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index aeb0cdf..6fd50df 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -6,11 +6,11 @@ class munin::host::cgi { } 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" ], + source => [ "puppet:///modules/site-munin/config/host/${fqdn}/logrotate", + "puppet:///modules/site-munin/config/host/logrotate.$operatingsystem", + "puppet:///modules/site-munin/config/host/logrotate", + "puppet:///modules/munin/config/host/logrotate.$operatingsystem", + "puppet:///modules/munin/config/host/logrotate" ], owner => root, group => 0, mode => 0644; } } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 846a873..67cbfb8 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -11,7 +11,7 @@ define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') { include munin::plugin::scriptpaths file { "munin_plugin_${name}": path => "$munin::plugin::scriptpaths::script_path/${name}", - source => "puppet://$server/modules/$real_source", + source => "puppet:///modules/$real_source", mode => 0755, owner => root, group => 0; } diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index e0d445c..c2c5ed3 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,7 +1,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - source => "puppet://$server/modules/common/empty", + source => "puppet:///modules/common/empty", ignore => [ '.ignore', 'snmp_*' ], ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp index 6f3fe34..7bd8bba 100644 --- a/manifests/snmp_collector.pp +++ b/manifests/snmp_collector.pp @@ -1,7 +1,7 @@ class munin::snmp_collector{ file { "/var/lib/puppet/modules/munin/create_snmp_links": - source => "puppet://$server/modules/munin/create_snmp_links.sh", + source => "puppet:///modules/munin/create_snmp_links.sh", mode => 755, owner => root, group => 0; } -- cgit v1.2.3 From 0d5407168827cb293abd9f0b5ecd406b16783f01 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 11 Aug 2010 09:59:09 +0200 Subject: introduce caching for xen plugins calls to the xen binaries such as xm are quite heavy and we therefore cache now a lot of the data that is generated for these plugins and use them as well for the other ones. --- files/plugins/xen | 11 +++++---- files/plugins/xen-cpu | 20 +++++++--------- files/plugins/xen_mem | 9 ++++--- files/plugins/xen_traffic_all | 55 ++++++++++++++++++++++++++----------------- files/plugins/xen_vbd | 34 +++++++++++++++++--------- files/plugins/xen_vm | 7 +++++- 6 files changed, 84 insertions(+), 52 deletions(-) diff --git a/files/plugins/xen b/files/plugins/xen index 575cd3b..a9f1a1e 100755 --- a/files/plugins/xen +++ b/files/plugins/xen @@ -8,8 +8,6 @@ # autoconf (optinal - used by munin-config) # -MAXDOMAINS=16 - if [ "$1" = "autoconf" ]; then if which xm > /dev/null ; then echo yes @@ -19,6 +17,11 @@ if [ "$1" = "autoconf" ]; then exit 1 fi +# we cache xm list for 5 min for perfomance reasons +((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ + [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ + /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state + if [ "$1" = "config" ]; then echo 'graph_title Xen Domain Utilerisation' @@ -27,7 +30,7 @@ if [ "$1" = "config" ]; then echo 'graph_vlabel mS' echo 'graph_category xen' echo 'graph_info This graph shows of many mS wall time where used by a domain' - /usr/sbin/xm list | grep -v "^Name .* Console$" | \ + cat /var/lib/munin/plugin-state/xm_list.state | \ while read name domid mem cpu state time console; do name=`echo $name | sed -e"s/-/_/"` echo "$name.label $name" @@ -43,7 +46,7 @@ if [ "$1" = "config" ]; then exit 0 fi -/usr/sbin/xm list | grep -v "^Name" | grep -v "^Name .* Console$" | \ +cat /var/lib/munin/plugin-state/xm_list.state | \ while read name domid mem cpu state time console; do name=`echo $name | sed -e"s/-/_/"` time=`echo $time | sed -e "s/\.//"` diff --git a/files/plugins/xen-cpu b/files/plugins/xen-cpu index 0ef301e..b456a14 100755 --- a/files/plugins/xen-cpu +++ b/files/plugins/xen-cpu @@ -28,6 +28,10 @@ use strict; $ENV{PATH} = '/bin:/usr/bin:/usr/sbin'; +# we cache xm list for 5 min for perfomance reasons +system('((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_list\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state'); +system('((find /var/lib/munin/plugin-state/xm_top.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_top\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_top.state | wc -l` -gt 1 ]) || /usr/sbin/xentop -b -i1 > /var/lib/munin/plugin-state/xm_top.state'); + my $arg; undef($arg); if (defined($ARGV[0])) { $arg = 'config' if ($ARGV[0] eq 'config'); @@ -53,8 +57,9 @@ if (defined($ARGV[0])) { 'graph_info' => 'Display the % of CPU Usage for each domain', ); - my @domains = `$XM list`; - shift(@domains); # we dont need the header line + my @domains = `cat /var/lib/munin/plugin-state/xm_list.state`; + # the header line is not in the cached file + #shift(@domains); # we dont need the header line my $cnt = "0"; foreach my $domain ( @domains ) { my ($dom,undef) = split(/\s/, $domain, 2); @@ -81,16 +86,7 @@ if (defined($ARGV[0])) { # Nothing was passed as an argument, so let's just return the proper values -my @chunks; undef(@chunks); - -{ - # run the xentop command a few times because the first reading is not always accurate - local $/ = undef; - @chunks = split(/^xentop - .*$/m, `$XMTOP -b -i2 -d2`); -} - -# Take only the last run of xentop -my @stats = split (/\n/,pop(@chunks)); +my @stats = `cat /var/lib/munin/plugin-state/xm_top.state`; # remove the first 4 items that are junk that we don't need. shift(@stats); diff --git a/files/plugins/xen_mem b/files/plugins/xen_mem index 5e985a5..16d91cf 100644 --- a/files/plugins/xen_mem +++ b/files/plugins/xen_mem @@ -43,7 +43,10 @@ #%# family=auto #%# capabilities=autoconf -XM="/usr/sbin/xm" +# we cache xm list for 5 min for perfomance reasons +((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ + [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ + /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state if [ "$1" = "autoconf" ]; then echo yes @@ -60,7 +63,7 @@ if [ "$1" = "config" ]; then echo 'graph_info This graph shows affected memory for each domain.' echo 'Domain_0.label Domain-0' echo 'Domain_0.draw AREA' -$XM list | grep -v 'Mem' | grep -v 'Domain-0' | while read i; do +cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Mem' | grep -v 'Domain-0' | while read i; do name=`echo $i | awk '{ print $1 }' | sed 's/[\/.-]/_/g'` echo -n "$name.label " echo $i | awk '{ print $1 }' @@ -70,7 +73,7 @@ done exit 0 fi -$XM list | grep -v 'Mem' | while read i; do +cat /var/lib/munin/plugin-state/xm_list.state | grep -v 'Mem' | while read i; do name=`echo $i | awk '{ print $1 }' | sed 's/[\/.-]/_/g'` echo -n "$name.value " echo $i | awk '{ print $3 * 1024 * 1024 }' diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 76d4ded..c5bbfbb 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -11,6 +11,11 @@ #%# family=auto #%# capabilities=autoconf +# we cache xm list for 5 min for perfomance reasons +((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ + [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ + /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state + if [ "$1" = "autoconf" ]; then if which xm > /dev/null ; then echo yes @@ -32,34 +37,42 @@ if [ "$1" = "config" ]; then echo 'graph_vlabel bits received (-) / sent (+) per ${graph_period}' echo 'graph_args --base 1024 -l 0' echo 'graph_category xen' - DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)") + DOMAINS=$(cat /var/lib/munin/plugin-state/xm_list.state | awk '{print $1}' | egrep -v "^(Name|Domain-0)") for dom in $DOMAINS; do - devs=$( xm network-list $dom |\ - egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@') - real_name=$( echo $dom | sed -e's/-/_/g' ) - name=$real_name - for dev in $devs; do - if [ ${#devs} -gt 1 ]; then - name=$real_name"_"`echo $dev | sed 's/\./\_/'` - fi + # we update network devices only twice an hour + ((find /var/lib/munin/plugin-state/xm_net_$dom.state -mmin -30 > /dev/null 2>&1) && \ + [ `cat /var/lib/munin/plugin-state/xm_net_$dom.state | wc -l` -gt 0 ]) || \ + (/usr/sbin/xm network-list $dom |\ + egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@' > /var/lib/munin/plugin-state/xm_net_$dom.state) + devs=$(cat /var/lib/munin/plugin-state/xm_net_$dom.state) + real_name=$( echo $dom | sed -e's/-/_/g' ) + name=$real_name + for dev in $devs; do + if [ ${#devs} -gt 1 ]; then + name=$real_name"_"`echo $dev | sed 's/\./\_/'` + fi - echo $name'Down.label received' - echo $name'Down.type COUNTER' - echo $name'Down.graph no' - echo "${name}Down.cdef ${name}Down,8,*" - echo "${name}Up.label ${name}" - echo $name'Up.type COUNTER' - echo "${name}Up.negative ${name}Down" - echo "${name}Up.cdef ${name}Up,8,*" - done + echo $name'Down.label received' + echo $name'Down.type COUNTER' + echo $name'Down.graph no' + echo "${name}Down.cdef ${name}Down,8,*" + echo "${name}Up.label ${name}" + echo $name'Up.type COUNTER' + echo "${name}Up.negative ${name}Down" + echo "${name}Up.cdef ${name}Up,8,*" + done done exit 0 fi -DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)") +DOMAINS=$(cat /var/lib/munin/plugin-state/xm_list.state | awk '{print $1}' | egrep -v "^(Name|Domain-0)") for dom in $DOMAINS; do - devs=$( xm network-list $dom |\ - egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@') + # we update network devices only twice an hour + ((find /var/lib/munin/plugin-state/xm_net_$dom.state -mmin -30 > /dev/null 2>&1) && \ + [ `cat /var/lib/munin/plugin-state/xm_net_$dom.state | wc -l` -gt 0 ]) || \ + (/usr/sbin/xm network-list $dom |\ + egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@' > /var/lib/munin/plugin-state/xm_net_$dom.state) + devs=$(cat /var/lib/munin/plugin-state/xm_net_$dom.state) real_name=$( echo $dom | sed -e's/-/_/g' ) name=$real_name for dev in $devs; do diff --git a/files/plugins/xen_vbd b/files/plugins/xen_vbd index 238bf08..4eca5a6 100755 --- a/files/plugins/xen_vbd +++ b/files/plugins/xen_vbd @@ -16,6 +16,10 @@ $XM = '/usr/sbin/xm'; $XMTOP = '/usr/sbin/xentop'; +# we cache xm list for 5 min for perfomance reasons +system('((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_list\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state'); +system('((find /var/lib/munin/plugin-state/xm_top.state -mmin -5 2>&1 | grep -qE \'^\/var\/lib\/munin\/plugin-state\/xm_top\.state$\') && [ `cat /var/lib/munin/plugin-state/xm_top.state | wc -l` -gt 1 ]) || /usr/sbin/xentop -b -i1 > /var/lib/munin/plugin-state/xm_top.state'); + # ah, parameters coming in if ( defined($ARGV[0])) { @@ -46,7 +50,7 @@ if ( defined($ARGV[0])) 'graph_info' => 'Display the I/O operations for each domain', ); - @domains = `$XM list`; + @domains = `cat /var/lib/munin/plugin-state/xm_list.state`; shift(@domains); # we don't need the header line foreach $domain ( @domains ) @@ -82,16 +86,24 @@ if ( defined($ARGV[0])) # No args, get rolling -# NAME STATE CPU(sec) CPU(%) MEM(k) MEM(%) MAXMEM(k) MAXMEM(%) VCPUS NETS NETTX(k) NETRX(k) VBDS VBD_OO VBD_RD VBD_WR SSID -$tmpfile = "/tmp/munin_xen_vbd_tmp"; - -system("$XMTOP -b -i1 > $tmpfile"); -open(I,"$tmpfile"); -while(){ - chomp; - s/^\s*//g; - @tmp=split(/\s+/, $_); - next if $tmp[0] eq "NAME"; +my @stats = `cat /var/lib/munin/plugin-state/xm_top.state`; + +# remove the first 4 items that are junk that we don't need. +shift(@stats); +shift(@stats); +shift(@stats); +shift(@stats); + +my %vals; undef(%vals); + +foreach my $domain (@stats) { + # trim the leading whitespace + $domain =~ s/^\s+//; + my @tmp = split(/\s+/, $domain); + + # we need to change - and . to _ or things get weird with the graphs + # some decent quoting would probably fix this, but this works for now + $tmp[0] =~ s/[-.]/_/g; $domname = $tmp[0]; $domname =~ s/[-.]/_/g; diff --git a/files/plugins/xen_vm b/files/plugins/xen_vm index a0dc0b7..a69b5fe 100644 --- a/files/plugins/xen_vm +++ b/files/plugins/xen_vm @@ -45,6 +45,11 @@ XM="/usr/sbin/xm" +# we cache xm list for 5 min for perfomance reasons +((find /var/lib/munin/plugin-state/xm_list.state -mmin -5 2>&1 | grep -qE '^\/var\/lib\/munin\/plugin-state\/xm_list\.state$') && \ + [ `cat /var/lib/munin/plugin-state/xm_list.state | wc -l` -gt 1 ]) || \ + /usr/sbin/xm list | grep -v "^Name .* Console$" > /var/lib/munin/plugin-state/xm_list.state + if [ "$1" = "autoconf" ]; then echo yes exit 0 @@ -61,7 +66,7 @@ if [ "$1" = "config" ]; then exit 0 fi -domains=`$XM list | wc -l` +domains=`cat /var/lib/munin/plugin-state/xm_list.state | wc -l` echo -n "domains.value " echo $(($domains-2)) -- cgit v1.2.3 From 022eb852e772afb07541866291ad20ff978ac912 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 12:29:31 +0200 Subject: use shell so we can actually pipe that command --- manifests/register/snmp.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index c0d9279..0c3ac5c 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -9,7 +9,7 @@ define munin::register::snmp ( $config = [ 'use_node_name no' ] exec { "munin_register_snmp_${fhost}": - command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh", + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", } -- cgit v1.2.3 From 0e23402c1146edcbf1d6fcce6fdfc654d661db33 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 30 Sep 2010 12:39:42 +0200 Subject: restore munin port in template --- templates/client.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/client.erb b/templates/client.erb index e7c6730..15e05c6 100644 --- a/templates/client.erb +++ b/templates/client.erb @@ -12,7 +12,8 @@ # Description: <%= description.gsub!(/\n/, ' ') %> <% end -%> [<%= fhost.downcase %>] - address <%= munin_host_real -%> + address <%= munin_host_real %> + port <%= munin_port_real %> <% if config -%><% config.each do |val| -%> <%= val -%> <% end -%><% end -%> -- cgit v1.2.3 From 17df63f17e1aab4c15584b41fbe7fe925503e054 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 9 Dec 2010 23:32:53 +0100 Subject: replace gsub with builtin regsubst --- manifests/plugins/interfaces.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index e0744a0..18a713b 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,19 +1,19 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces { - $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1") + $ifs = regsubst(split($interfaces, " |,"), "(.+)", "if_\\1") munin::plugin { $ifs: ensure => "if_"; } case $operatingsystem { openbsd: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") + $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1") munin::plugin{ $if_errs: ensure => "if_errcoll_"; } } default: { - $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1") + $if_errs = regsubst(split($interfaces, " |,"), "(.+)", "if_err_\\1") munin::plugin{ $if_errs: ensure => "if_err_"; } -- cgit v1.2.3 From 7a13b36953cc4e359a37c0e7fa80a6ee3b452766 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 31 May 2011 19:30:04 +0200 Subject: no need to manage logfiles, this should be done by the package --- manifests/host.pp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/manifests/host.pp b/manifests/host.pp index e038fd7..69cc7da 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -23,12 +23,6 @@ class munin::host inherits munin 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 { -- cgit v1.2.3 From c88a6c4879e13b95e4fff00ec956557dd5be5689 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 31 May 2011 19:39:20 +0200 Subject: make cgi graphing optional --- manifests/host.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/host.pp b/manifests/host.pp index 69cc7da..3e4f5ea 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -25,8 +25,8 @@ class munin::host inherits munin include munin::plugins::muninhost - case $operatingsystem { - centos: { include munin::host::cgi } + if $munin_do_cgi_graphing { + include munin::host::cgi } # from time to time we cleanup hanging munin-runs -- cgit v1.2.3 From 1d33fc714f1ab1c672aca6e6aecb2327332033ec Mon Sep 17 00:00:00 2001 From: Benjamin Krause Date: Tue, 31 May 2011 11:24:26 +0200 Subject: added lucid debian symlink --- templates/munin-node.conf.Debian.lucid | 1 + 1 file changed, 1 insertion(+) create mode 120000 templates/munin-node.conf.Debian.lucid diff --git a/templates/munin-node.conf.Debian.lucid b/templates/munin-node.conf.Debian.lucid new file mode 120000 index 0000000..e0646b9 --- /dev/null +++ b/templates/munin-node.conf.Debian.lucid @@ -0,0 +1 @@ +munin-node.conf.Debian.etch \ No newline at end of file -- cgit v1.2.3 From 5049ee5adee3642bf1ccae40ade1c79e6e301832 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 15 Jul 2011 17:40:31 +0200 Subject: it is not anymore necessary to add an empty source to purge directories --- manifests/plugins/setup.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index c2c5ed3..c88f9e0 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,8 +1,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - source => "puppet:///modules/common/empty", - ignore => [ '.ignore', 'snmp_*' ], + ignore => 'snmp_*', ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0, -- cgit v1.2.3 From eb953716cd545f86972e85d983b5862c194f5aed Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 22 Jul 2011 13:04:38 +0200 Subject: fix typo --- manifests/plugins/apache.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp index b3e7634..dca3cea 100644 --- a/manifests/plugins/apache.pp +++ b/manifests/plugins/apache.pp @@ -1,4 +1,4 @@ class munin::plugins::apache { - munin::plugin{ [ 'apache_accesses', 'apache_processes',' apache_volume' ]: } - munin::plugin::deploy { "apache_activity": } + munin::plugin{ [ 'apache_accesses', 'apache_processes', 'apache_volume' ]: } + munin::plugin::deploy { 'apache_activity': } } -- cgit v1.2.3