Ori.livneh has submitted this change and it was merged.

Change subject: ganglia wrapper for py plugins
......................................................................


ganglia wrapper for py plugins

There are several python plugins in our repository and we end up
writing the same puppet glue every time: install the python script and
its default configuration file, making sure gmond is notified.

This patch introduces a ganglia::python::plugin define taking the plugin name
as title. One can optionally pass a hash 'opts' that can be reused in the
template. See define documentation.

Change-Id: If2f001ffa296dc7b67f53c56d9fbcf96cb5dba2a
---
M manifests/ganglia.pp
A templates/ganglia/plugins/README
2 files changed, 35 insertions(+), 0 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/ganglia.pp b/manifests/ganglia.pp
index cb40fc3..3fe66ff 100644
--- a/manifests/ganglia.pp
+++ b/manifests/ganglia.pp
@@ -644,6 +644,37 @@
     }
 }
 
+# == Define ganglia::plugin::python
+#
+# Installs a Ganglia python plugin
+#
+# == Parameters:
+#
+# $plugins - the plugin name (ex: 'diskstat'), will install the Python file
+# located in files/ganglia/plugins/${name}.py and expand the template from
+# templates/ganglia/plugins/${name}.pyconf.erb.
+# Defaults to $title as a convenience
+#
+# $opts - optional hash which can be used in the template. The defaults are
+# hardcoded in the templates. Default to {}
+#
+# == Examples:
+#
+# ganglia::plugin::python {'diskstat': }
+#
+# ganglia::python::plugin {'diskstat': opts => { 'devices' => ['sda', 'sdb'] }}
+#
+define ganglia::python::plugin( $plugin = $title, $opts = {} ) {
+    file { "/usr/lib/ganglia/python_modules/${plugin}.py":
+        source => "puppet:///files/ganglia/plugins/${plugin}.py",
+        notify => Service['gmond'],
+    }
+    file { "/etc/ganglia/conf.d/${plugin}.pyconf":
+        content => template("ganglia/plugins/${plugin}.pyconf.erb"),
+        notify  => Service['gmond'],
+    }
+}
+
 # Copied from nagios::ganglia::monitor::enwiki
 # Will run on hume to use the local MediaWiki install so that we can use
 # maintenance scripts recycling DB connections and taking a few secs, not mins
diff --git a/templates/ganglia/plugins/README b/templates/ganglia/plugins/README
new file mode 100644
index 0000000..6bf51d5
--- /dev/null
+++ b/templates/ganglia/plugins/README
@@ -0,0 +1,4 @@
+Placeholder holding Ganglia plugins
+
+This directory holds python plugins for Ganglia as expected by our define
+ganglia::plugin::python().

-- 
To view, visit https://gerrit.wikimedia.org/r/85669
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If2f001ffa296dc7b67f53c56d9fbcf96cb5dba2a
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Diederik <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Lcarr <[email protected]>
Gerrit-Reviewer: Mark Bergsma <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: Ryan Lane <[email protected]>
Gerrit-Reviewer: coren <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to