aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-12 12:31:25 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-12 12:31:25 -0300
commit7beae39bc53042b9fbf214653d390c988a03ad1b (patch)
tree1d69809367a8dde2bcdf9ea4d1275f779eab98b5
parent276e6c4762ba971d3bc86a9072c474251df56441 (diff)
downloadpuppet-nodo-7beae39bc53042b9fbf214653d390c988a03ad1b.tar.gz
puppet-nodo-7beae39bc53042b9fbf214653d390c988a03ad1b.tar.bz2
Split munin-update and munin-graph on different cronjobs
-rw-r--r--files/bin/munin-cron20
-rw-r--r--files/bin/munin-graph8
-rw-r--r--files/etc/cron.d/munin9
-rw-r--r--manifests/subsystem/monitor/master.pp36
4 files changed, 73 insertions, 0 deletions
diff --git a/files/bin/munin-cron b/files/bin/munin-cron
new file mode 100644
index 0000000..052ea2d
--- /dev/null
+++ b/files/bin/munin-cron
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# This used to test if the executables were installed. But that is
+# perfectly redundant and supresses errors that the admin should see.
+
+/usr/share/munin/munin-update $@ || exit 1
+
+# The result of munin-limits is needed by munin-html but not by
+# munin-graph. So run it in the background now, it will be done
+# before munin-graph.
+
+/usr/share/munin/munin-limits $@
+
+# We always launch munin-html.
+# It is a noop if html_strategy is "cgi"
+#nice /usr/share/munin/munin-html $@ || exit 1
+
+# The result of munin-html is needed for munin-graph.
+# It is a noop if graph_strategy is "cgi"
+#nice /usr/share/munin/munin-graph --cron $@ || exit 1
diff --git a/files/bin/munin-graph b/files/bin/munin-graph
new file mode 100644
index 0000000..b8d8c21
--- /dev/null
+++ b/files/bin/munin-graph
@@ -0,0 +1,8 @@
+#!/bin/bash
+# We always launch munin-html.
+# It is a noop if html_strategy is "cgi"
+nice /usr/share/munin/munin-html $@ || exit 1
+
+# The result of munin-html is needed for munin-graph.
+# It is a noop if graph_strategy is "cgi"
+nice /usr/share/munin/munin-graph --cron $@ || exit 1
diff --git a/files/etc/cron.d/munin b/files/etc/cron.d/munin
new file mode 100644
index 0000000..6b44a40
--- /dev/null
+++ b/files/etc/cron.d/munin
@@ -0,0 +1,9 @@
+#
+# cron-jobs for munin
+#
+
+MAILTO=""
+
+@reboot root if [ ! -d /var/run/munin ]; then /bin/bash -c 'perms=(`/usr/sbin/dpkg-statoverride --list /var/run/munin`); mkdir /var/run/munin; chown ${perms[0]:-munin}:${perms[1]:-root} /var/run/munin; chmod ${perms[2]:-0755} /var/run/munin'; fi
+*/5 * * * * munin if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron &> /dev/null; fi
+14 10 * * * munin if [ -x /usr/share/munin/munin-limits ]; then /usr/share/munin/munin-limits --force --contact nagios --contact old-nagios; fi
diff --git a/manifests/subsystem/monitor/master.pp b/manifests/subsystem/monitor/master.pp
index c7241b3..c93ec0e 100644
--- a/manifests/subsystem/monitor/master.pp
+++ b/manifests/subsystem/monitor/master.pp
@@ -24,6 +24,42 @@ class nodo::subsystem::monitor::master {
},
}
+ # See https://raymii.org/s/tutorials/Munin_optimalization_on_Debian.html
+ file { '/usr/local/bin/munin-graph':
+ ensure => $ensure,
+ owner => root,
+ group => root,
+ mode => 0755,
+ source => 'puppet:///modules/nodo/bin/munin-graph',
+ }
+
+ file { '/etc/cron.d/munin-graph':
+ ensure => $ensure,
+ owner => root,
+ group => root,
+ mode => 0644,
+ content => "10 * * * * munin if [ -x /usr/local/bin/munin-graph ]; then /usr/local/bin/munin-graph; fi\n",
+ require => File['/usr/local/bin/munin-graph'],
+ }
+
+ # We won't mess with the package, so we distribute our own munin-cron
+ file { '/usr/local/bin/munin-cron':
+ ensure => $ensure,
+ owner => root,
+ group => root,
+ mode => 0755,
+ source => 'puppet:///modules/nodo/bin/munin-cron',
+ }
+
+ file { '/etc/cron.d/munin':
+ ensure => $ensure,
+ owner => root,
+ group => root,
+ mode => 0644,
+ source => 'puppet:///modules/nodo/etc/cron.d/munin',
+ require => File['/usr/local/bin/munin-cron'],
+ }
+
#
# See https://raymii.org/s/tutorials/Munin_optimalization_on_Debian.html
# https://munin.readthedocs.org/en/latest/master/rrdcached.html