Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/81149
Change subject: Add pystatsd module; provision on hafnium
......................................................................
Add pystatsd module; provision on hafnium
This patch adds a module for pystatsd, a Python implementation of a StatsD
server. It also adds a misc class that configures a pystatsd instance that
flushes metrics to professor. Finally, it applies this class to hafnium.
Change-Id: I88b3388e50c9915e47bc2b75e3692108e883b8c3
---
M manifests/misc/graphite.pp
M manifests/site.pp
A modules/pystatsd/manifests/init.pp
A modules/pystatsd/templates/pystatsd.conf.erb
4 files changed, 72 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/49/81149/1
diff --git a/manifests/misc/graphite.pp b/manifests/misc/graphite.pp
index fec54dd..ed99e1a 100644
--- a/manifests/misc/graphite.pp
+++ b/manifests/misc/graphite.pp
@@ -107,3 +107,14 @@
recurse => remote;
}
}
+
+class misc::graphite::pystatsd {
+ class { 'pystatsd':
+ settings => {
+ name => '127.0.0.1', # only listen on loopback for now.
+ transport => 'graphite',
+ graphite_host => 'professor.pmtpa.wmnet',
+ graphite_port => 2003,
+ },
+ }
+}
diff --git a/manifests/site.pp b/manifests/site.pp
index d405883..ee2cffc 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2836,7 +2836,8 @@
node 'hafnium.wikimedia.org' {
include standard,
groups::wikidev,
- accounts::olivneh
+ accounts::olivneh,
+ misc::graphite::pystatsd
sudo_user { 'olivneh':
privileges => ['ALL = (ALL) NOPASSWD: ALL'],
diff --git a/modules/pystatsd/manifests/init.pp
b/modules/pystatsd/manifests/init.pp
new file mode 100644
index 0000000..59dd188
--- /dev/null
+++ b/modules/pystatsd/manifests/init.pp
@@ -0,0 +1,40 @@
+# == Class: pystatsd
+#
+# Provisions pystatsd, an implementation of StatsD in Python. pystatsd
+# listens on a network interface for metric data. It computes roll-ups
+# and flushes them to Graphite or Ganglia.
+#
+# === Parameters
+#
+# [*settings*]
+# A hash of configuration options. For a full listing of options,
+# see <http://tinyurl.com/pystatsd-args>.
+#
+# === Example
+#
+# class { 'pystatsd':
+# settings => {
+# transport => 'graphite',
+# graphite_host => 'professor.pmtpa.wmnet',
+# graphite_port => 2003,
+# },
+# }
+#
+class pystatsd(
+ $settings = {},
+) {
+ package { 'python-ss-statsd':
+ ensure => present,
+ before => File['/etc/init/pystatsd.conf'],
+ }
+
+ file { '/etc/init/pystatsd.conf':
+ content => template('pystatsd/pystatsd.conf.erb'),
+ before => Service['pystatsd'],
+ }
+
+ service { 'pystatsd':
+ ensure => running,
+ provider => upstart,
+ }
+}
diff --git a/modules/pystatsd/templates/pystatsd.conf.erb
b/modules/pystatsd/templates/pystatsd.conf.erb
new file mode 100644
index 0000000..74ab1e7
--- /dev/null
+++ b/modules/pystatsd/templates/pystatsd.conf.erb
@@ -0,0 +1,19 @@
+# pystatsd
+#
+# This is an Upstart job configuration file for pystatsd. pystatsd
+# listens on a network interface for metric data. It computes roll-ups
+# and flushes them to Graphite.
+#
+description "pystatsd metric server"
+author "Ori Livneh <[email protected]>"
+
+respawn limit 15 5
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+
+setuid nobody
+setgid nogroup
+
+respawn
+
+exec /usr/bin/pystatsd-server <%= @settings.sort.map { |k,v| "--#{k.tr('_',
'-')} #{v}" }.join(' ') %>
--
To view, visit https://gerrit.wikimedia.org/r/81149
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I88b3388e50c9915e47bc2b75e3692108e883b8c3
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits