From 2c530ac300a57c54ce55dce73481693f93cc6e38 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2008 20:02:00 +0000 Subject: added readme title git-svn-id: https://svn/ipuppet/trunk/modules/munin@1599 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 762a802..f7ecba6 100644 --- a/README +++ b/README @@ -1,3 +1,4 @@ +== Munin == Munin is a performance monitoring system which creates nice RRD graphs and has a very easy plugin interface. The munin homepage is http://munin.projects.linpro.no/ -- cgit v1.2.3 From 4f8fbfcc736d02ec0528b0df571d5d4a458c261e Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2008 20:02:35 +0000 Subject: Merge commit 'puzzle/development' git-svn-id: https://svn/ipuppet/trunk/modules/munin@1600 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- README | 4 ++++ files/empty/.git_placeholder | 1 + manifests/client.pp | 5 +++++ manifests/init.pp | 16 +++++++++++++--- manifests/plugin.pp | 25 +++++++++++++++++++++---- templates/munin-node.conf.Debian.etch | 6 ++++-- templates/munin-node.conf.default | 7 +++---- 7 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 files/empty/.git_placeholder diff --git a/README b/README index f7ecba6..5384c30 100644 --- a/README +++ b/README @@ -46,6 +46,10 @@ To use this module, follow these directions: connect to your individual munin-nodes (this is typically your main munin host's IP): $munin_allow = '192.168.0.1' + + If you want to define more than one host, you can seperate them by colon: + + $munin_allow = '127.0.0.1:192.168.0.1' e. In the node definition in your site.pp for your main munin host, add the following: diff --git a/files/empty/.git_placeholder b/files/empty/.git_placeholder new file mode 100644 index 0000000..91162ec --- /dev/null +++ b/files/empty/.git_placeholder @@ -0,0 +1 @@ +# just used for git diff --git a/manifests/client.pp b/manifests/client.pp index 8305bf0..59b6980 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -51,6 +51,7 @@ class munin::client::base { package { "munin-node": ensure => installed } service { "munin-node": ensure => running, + enable => true, hasstatus => true, hasrestart => true, require => Package[munin-node], @@ -59,6 +60,10 @@ class munin::client::base { ensure => directory, mode => 0755, owner => root, group => 0; } + $real_munin_allow = $munin_allow ? { + '' => '127.0.0.1', + default => $munin_allow + } file {"/etc/munin/munin-node.conf": content => template("munin/munin-node.conf.$operatingsystem"), mode => 0644, owner => root, group => 0, diff --git a/manifests/init.pp b/manifests/init.pp index 6b6cd08..b0c2ba1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,9 +1,19 @@ +# +# munin module # munin.pp - everything a sitewide munin installation needs # Copyright (C) 2007 David Schmitt -# See LICENSE for the full license granted to you. -# adapted by Puzzle ITC - haerry+puppet(at)puzzle.ch +# +# 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 +# the Free Software Foundation. # -# the port is a parameter so vservers can share IP addresses and still be happy +# the port is a parameter so vservers can share +# IP addresses and still be happy # Define where the individual nodes' configs are stored $NODESDIR="/var/lib/puppet/modules/munin/nodes" diff --git a/manifests/plugin.pp b/manifests/plugin.pp index d24b580..76d12a0 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -45,11 +45,17 @@ define munin::plugin ( } default: { debug ( "munin_plugin: making $plugin using src: $plugin_src" ) + if $require { + $real_require = [ $require, Package['munin-node'] ] + } else { + $real_require = Package['munin-node'] + } file { $plugin: ensure => "${real_script_path}/${plugin_src}", - require => Package['munin-node'], + require => $real_require, notify => Service['munin-node']; } + } } case $config { @@ -69,6 +75,11 @@ define munin::plugin ( content => "[${name}]\n$config\n", mode => 0644, owner => root, group => 0, } + if $require { + File[$plugin_conf]{ + require +> $require, + } + } } } } @@ -107,11 +118,17 @@ define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') { file { "munin_plugin_${name}": path => "$munin::plugin::scriptpaths::script_path/${name}", source => "puppet://$server/$real_source", - ensure => file, + require => Package['munin-node'], mode => 0755, owner => root, group => 0; } - - munin::plugin{$name: ensure => $ensure, config => $config } + if $require { + File["munin_plugin_${name}"]{ + require +> $require, + } + munin::plugin{$name: ensure => $ensure, config => $config, require => $require } + } else { + munin::plugin{$name: ensure => $ensure, config => $config } + } } ### clases for plugins diff --git a/templates/munin-node.conf.Debian.etch b/templates/munin-node.conf.Debian.etch index 0f0f568..56da89d 100644 --- a/templates/munin-node.conf.Debian.etch +++ b/templates/munin-node.conf.Debian.etch @@ -33,5 +33,7 @@ host_name <%= fqdn %> # 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 -allow <%= munin_allow1 %> -allow <%= munin_allow2 %> +<% real_munin_allow.split(':').each do |val| -%> +allow <%= '^'+val.gsub(/\./, '\.')+'$' %> +<% end -%> + diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default index f10349e..5eed749 100644 --- a/templates/munin-node.conf.default +++ b/templates/munin-node.conf.default @@ -33,7 +33,6 @@ host_name <%= fqdn %> # 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 -allow ^127\.0\.0\.1$ -allow <%= munin_allow1 %> -allow <%= munin_allow2 %> - +<% real_munin_allow.split(':').each do |val| -%> +allow <%= '^'+val.gsub(/\./, '\.')+'$' %> +<% end -%> -- cgit v1.2.3 From 12f797a7968d5adc27de20c6651a56594fb4fa36 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 8 Jul 2008 18:41:50 +0000 Subject: if the munin node config file is changed it should notify the service git-svn-id: https://svn/ipuppet/trunk/modules/munin@1777 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- manifests/client.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/client.pp b/manifests/client.pp index 59b6980..9a7b772 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -66,10 +66,11 @@ class munin::client::base { } file {"/etc/munin/munin-node.conf": content => template("munin/munin-node.conf.$operatingsystem"), - mode => 0644, owner => root, group => 0, # this has to be installed before the package, so the postinst can # boot the munin-node without failure! before => Package["munin-node"], + notify => Service['munin-node'], + mode => 0644, owner => root, group => 0, } munin::register { $fqdn: } include munin::plugins::base -- cgit v1.2.3 From 9da545785dca34eb9e76321bf3a2396521e3ac45 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 8 Jul 2008 18:41:55 +0000 Subject: merged with davids and removed a case statement, which made no sense git-svn-id: https://svn/ipuppet/trunk/modules/munin@1778 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/modules_dir/.ignore | 0 manifests/plugin.pp | 41 ++++++++++++----------------------------- 2 files changed, 12 insertions(+), 29 deletions(-) create mode 100644 files/modules_dir/.ignore diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore new file mode 100644 index 0000000..e69de29 diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 76d12a0..2c64482 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -134,35 +134,18 @@ define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') { ### clases for plugins class munin::plugins::base { - case $operatingsystem { - centos: { - file { - [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: - source => "puppet://$server/munin/empty", - ensure => directory, checksum => mtime, - recurse => true, purge => true, force => true, - mode => 0755, owner => root, group => 0; - "/etc/munin/plugin-conf.d/munin-node": - ensure => present, - mode => 0644, owner => root, group => 0; - } - } - - default: { - file { - [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: - source => "puppet://$server/munin/empty", - 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'], - before => Package['munin-node']; - } - } + file { + [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: + source => "puppet://$server/common/empty", + 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'], + before => Package['munin-node']; } case $kernel { linux: { -- cgit v1.2.3 From f15a82d411de4fa50262efa7d16e8b1d7f2b7886 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 8 Jul 2008 21:36:57 +0000 Subject: added ignore for empty git-svn-id: https://svn/ipuppet/trunk/modules/munin@1785 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- manifests/plugin.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 2c64482..9111aec 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -137,6 +137,7 @@ class munin::plugins::base { file { [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: source => "puppet://$server/common/empty", + ignore => '.ignore', ensure => directory, checksum => mtime, recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0, -- cgit v1.2.3 From cf9b3c380fbef1ff10f5e40f22bb2d3ef436c077 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 17 Jul 2008 12:58:47 +0000 Subject: Merge commit 'puzzle/development' git-svn-id: https://svn/ipuppet/trunk/modules/munin@1863 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/xen_traffic_all | 63 +++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 1216a7d..3fcb508 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -1,6 +1,12 @@ #!/bin/sh # Author: mario manno # Description: measure traffic for all xen hosts +# +# 16.07.2008: improved the Plugin by Puzzle ITC to +# enable the traffic monitoring for domains +# with more than 1 one interface +# If there is more than one device, the domainname +# will get the vif name appended. # #%# family=auto #%# capabilities=autoconf @@ -28,36 +34,47 @@ if [ "$1" = "config" ]; then echo 'graph_category xen' DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)") for dom in $DOMAINS; do - name=$( echo $dom | sed -e's/-/_/g' ) - #echo $name"UP.label $name" - #echo $name"DOWN.label $name" + 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 + #echo $name"UP.label $name" + #echo $name"DOWN.label $name" - 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,*" + 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)") for dom in $DOMAINS; do - dev=$( xm network-list $dom |\ + devs=$( xm network-list $dom |\ egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@') - name=$( echo $dom | sed -e's/-/_/g' ) - #awk -v name="$name" -v interface="$dev" -F'[: \t]+' \ - #'{ sub(/^ */,""); if ($1 == interface) \ - #print name"DOWN.value "$2"\n"name"UP.value "$10; }' /proc/net/dev - awk -v name="$name" -v interface="$dev" \ - 'BEGIN { gsub(/\./, "\\.", interface) } \ - $1 ~ "^" interface ":" { - split($0, a, /: */); $0 = a[2]; \ - print name"Down.value " $1 "\n"name"Up.value " $9 \ - }' \ - /proc/net/dev + 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 + awk -v name="$name" -v interface="$dev" \ + 'BEGIN { gsub(/\./, "\\.", interface) } \ + $1 ~ "^" interface ":" { + split($0, a, /: */); $0 = a[2]; \ + print name"Down.value " $1 "\n"name"Up.value " $9 \ + }' \ + /proc/net/dev + done done -- cgit v1.2.3 From 205a022c2d3edcfdb59c994bcff4845e8615ba20 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 17 Jul 2008 18:48:39 +0000 Subject: added cgi graph note git-svn-id: https://svn/ipuppet/trunk/modules/munin@1878 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 5384c30..12b73e8 100644 --- a/README +++ b/README @@ -86,3 +86,5 @@ To use this module, follow these directions: $munin_port = 4948 + i. if you'd like to do cgi graphing, please note the following page: http://munin.projects.linpro.no/wiki/CgiHowto + ToDo: implement this in puppet -- cgit v1.2.3 From a0eba1c444207b6fad449e3de61d60fcdd6994d9 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Jul 2008 15:12:10 +0000 Subject: factored out squid munin plugin, cleaned up some whitespaces in xen plugin git-svn-id: https://svn/ipuppet/trunk/modules/munin@1909 d66ca3ae-40d7-4aa7-90d4-87d79ca94279 --- files/plugins/xen_traffic_all | 12 ++++++------ manifests/plugin.pp | 7 ------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/files/plugins/xen_traffic_all b/files/plugins/xen_traffic_all index 3fcb508..1e9b06e 100644 --- a/files/plugins/xen_traffic_all +++ b/files/plugins/xen_traffic_all @@ -43,17 +43,17 @@ if [ "$1" = "config" ]; then name=$real_name"_"`echo $dev | sed 's/\./\_/'` fi #echo $name"UP.label $name" - #echo $name"DOWN.label $name" + #echo $name"DOWN.label $name" echo $name'Down.label received' - echo $name'Down.type COUNTER' + echo $name'Down.type COUNTER' echo $name'Down.graph no' - echo "${name}Down.cdef ${name}Down,8,*" + echo "${name}Down.cdef ${name}Down,8,*" echo "${name}Up.label ${name}" - echo $name'Up.type COUNTER' + echo $name'Up.type COUNTER' echo "${name}Up.negative ${name}Down" - echo "${name}Up.cdef ${name}Up,8,*" - done + echo "${name}Up.cdef ${name}Up,8,*" + done done exit 0 fi diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 9111aec..2065c79 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -246,13 +246,6 @@ class munin::plugins::selinux inherits munin::plugins::base { munin::plugin::deploy { "selinux_avcstats": } } -class munin::plugins::squid inherits munin::plugins::base { - munin::plugin{ 'squid_cache': config => "user root\nenv.squidhost localhost\nenv.squidport 80"} - munin::plugin{ 'squid_icp': } - munin::plugin{ 'squid_requests': } - munin::plugin{ 'squid_traffic': } -} - class munin::plugins::postgres inherits munin::plugins::base { munin::plugin::deploy { "pg_conn": } munin::plugin::deploy { "pg__connections": ensure => 'absent' } -- cgit v1.2.3