merged with immerda
authormh <mh@d66ca3ae-40d7-4aa7-90d4-87d79ca94279>
Tue, 22 Jul 2008 21:14:46 +0000 (21:14 +0000)
committermh <mh@d66ca3ae-40d7-4aa7-90d4-87d79ca94279>
Tue, 22 Jul 2008 21:14:46 +0000 (21:14 +0000)
git-svn-id: https://svn/ipuppet/trunk/modules/munin@1915 d66ca3ae-40d7-4aa7-90d4-87d79ca94279

README
files/config/host/logrotate.CentOS [new file with mode: 0644]
files/config/host/munin.conf.header.CentOS [new file with mode: 0644]
files/plugins/xen_traffic_all
manifests/host.pp
manifests/plugin.pp

diff --git a/README b/README
index 12b73e8..5964b21 100644 (file)
--- a/README
+++ b/README
@@ -86,5 +86,7 @@ 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
+   i. If you'd like to do cgi graphing, please note the following page: http://munin.projects.linpro.no/wiki/CgiHowto
+      For CentOS this is enabled in the default header config
+
+   j. Per default (on CentOS) munin will send warnings and critical messages to root
diff --git a/files/config/host/logrotate.CentOS b/files/config/host/logrotate.CentOS
new file mode 100644 (file)
index 0000000..411de3f
--- /dev/null
@@ -0,0 +1,35 @@
+/var/log/munin/munin-update.log {
+        daily
+        missingok
+        rotate 7
+        compress
+        notifempty
+        create 640 munin adm
+}
+
+/var/log/munin/munin-graph.log {
+        daily
+        missingok
+        rotate 7
+        compress
+        notifempty
+        create 660 munin apache
+}
+
+/var/log/munin/munin-html.log {
+        daily
+        missingok
+        rotate 7
+        compress
+        notifempty
+        create 640 munin adm
+}
+
+/var/log/munin/munin-limits.log {
+        daily
+        missingok
+        rotate 7
+        compress
+        notifempty
+        create 640 munin adm
+}
diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS
new file mode 100644 (file)
index 0000000..dcadd6b
--- /dev/null
@@ -0,0 +1,77 @@
+# 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
+
+# Where to look for the HTML templates
+tmpldir /etc/munin/templates
+
+# Make graphs show values per minute instead of per second
+#graph_period minute
+
+graph_strategy cgi
+
+# 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
+#
+
index 1e9b06e..76d4ded 100644 (file)
@@ -42,8 +42,6 @@ if [ "$1" = "config" ]; then
             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'
index 8f79020..fdaa255 100644 (file)
@@ -8,6 +8,16 @@ 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",
+                    "puppet://$server/munin/config/host/munin.conf.header.$operatingsystem",
+                    "puppet://$server/munin/config/host/munin.conf.header" ],
+        notify => Exec['concat_/etc/munin/munin.conf'],
+        owner => root, group => 0, mode => 0644;
+    }
+
        concatenated_file { "/etc/munin/munin.conf":
                dir => $NODESDIR,
                header => "/etc/munin/munin.conf.header",
@@ -20,6 +30,27 @@ class munin::host
     }
 
     include munin::plugins::muninhost
+
+    case $operatingsystem {
+        centos: { include munin::host::cgi }
+    }
+}
+
+class munin::host::cgi {
+    exec{'set_modes_for_cgi':
+        command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;',
+        refreshonly => true,
+        subscribe => File['/etc/munin/munin.conf.header'],
+    }
+
+    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",
+                    "puppet://$server/munin/config/host/logrotate.$operatingsystem",
+                    "puppet://$server/munin/config/host/logrotate" ],
+        owner => root, group => 0, mode => 0644;
+    }
 }
 
 class munin::snmp_collector
index 2065c79..4940eaf 100644 (file)
@@ -137,7 +137,7 @@ class munin::plugins::base {
     file {
            [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]:
                source => "puppet://$server/common/empty",
-            ignore => '.ignore',
+            ignore => '\.ignore',
                        ensure => directory, checksum => mtime,
                        recurse => true, purge => true, force => true, 
                        mode => 0755, owner => root, group => 0,