Alexandros Kosiaris has submitted this change and it was merged. Change subject: diamond: Introduce an etherpad plugin ......................................................................
diamond: Introduce an etherpad plugin Provide an etherpad diamond plugin, that uses the "stats" URL provided by etherpad to ship a number of configurable metrics to graphite. Those are memory, users, edits, requests Change-Id: Ie7abf5c3a5749c5489dcbb9b5870c3e30dae5be2 --- A files/etherpad/etherpad.py M manifests/role/etherpad.pp 2 files changed, 56 insertions(+), 0 deletions(-) Approvals: Alexandros Kosiaris: Verified; Looks good to me, approved diff --git a/files/etherpad/etherpad.py b/files/etherpad/etherpad.py new file mode 100644 index 0000000..6770bdc --- /dev/null +++ b/files/etherpad/etherpad.py @@ -0,0 +1,52 @@ +''' +Collect request status code metrics from etherad + +#### Dependencies + + * subprocess +''' + +from diamond.collector import Collector +import urllib2 +import json + + +class EtherpadStatusCollector(Collector): + + def get_default_config(self): + ''' + Returns the default collector settings + ''' + config = super(EtherpadStatusCollector, self).get_default_config() + config.update({ + 'url': 'http://localhost:9001/stats', + 'path_prefix': 'etherpad', + 'gauges': ['memoryUsage', 'totalUsers', 'pendingEdits'], + 'counters': [ + 'connects/count', + 'disconnects/count', + 'httpRequests/meter/count', + 'edits/meter/count', + 'failedChangesets/meter/count', + ], + }) + return config + + def collect(self): + ''' + Publishes stats to the configured path. + ''' + url = urllib2.urlopen(self.config['url']) + if url.code != 200: + return + stats = json.loads(url.read()) + for gauge in self.config['gauges']: + self.publish_gauge(gauge, stats[gauge]) + # Use the / character as a split character + for counter in self.config['counters']: + parts = counter.split('/') + name = parts[0] + t = stats + for part in parts: + t = t.get(part) + self.publish_counter(name, t) diff --git a/manifests/role/etherpad.pp b/manifests/role/etherpad.pp index c17327c..8ffd9e2 100644 --- a/manifests/role/etherpad.pp +++ b/manifests/role/etherpad.pp @@ -68,4 +68,8 @@ proto => 'tcp', port => '9001', } + + diamond::collector { 'EtherpadStatus': + source => 'puppet:///files/etherpad/etherpad.py', + } } -- To view, visit https://gerrit.wikimedia.org/r/263149 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie7abf5c3a5749c5489dcbb9b5870c3e30dae5be2 Gerrit-PatchSet: 5 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org> Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits