summaryrefslogtreecommitdiff
path: root/manifests/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/plugin')
-rw-r--r--manifests/plugin/deploy.pp37
-rw-r--r--manifests/plugin/scriptpaths.pp9
2 files changed, 46 insertions, 0 deletions
diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp
new file mode 100644
index 0000000..846a873
--- /dev/null
+++ b/manifests/plugin/deploy.pp
@@ -0,0 +1,37 @@
+define munin::plugin::deploy($source = '', $ensure = 'present', $config = '') {
+ $plugin_src = $ensure ? {
+ 'present' => $name,
+ 'absent' => $name,
+ default => $ensure
+ }
+ $real_source = $source ? {
+ '' => "munin/plugins/$plugin_src",
+ default => $source
+ }
+ include munin::plugin::scriptpaths
+ file { "munin_plugin_${name}":
+ path => "$munin::plugin::scriptpaths::script_path/${name}",
+ source => "puppet://$server/modules/$real_source",
+ mode => 0755, owner => root, group => 0;
+ }
+
+ case $kernel {
+ openbsd: { $basic_require = File['/var/run/munin'] }
+ default: { $basic_require = Package['munin-node'] }
+ }
+ if $require {
+ File["munin_plugin_${name}"]{
+ require => [ $basic_require, $require ],
+ }
+ } else {
+ File["munin_plugin_${name}"]{
+ require => $basic_require,
+ }
+ }
+ # register the plugin
+ if $require {
+ munin::plugin{$name: ensure => $ensure, config => $config, require => $require }
+ } else {
+ munin::plugin{$name: ensure => $ensure, config => $config }
+ }
+}
diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp
new file mode 100644
index 0000000..ebaa6fa
--- /dev/null
+++ b/manifests/plugin/scriptpaths.pp
@@ -0,0 +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" }
+ }
+}