Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 18 lines (13 sloc) 0.596 kb
b91ebdc Add ElasticSearch plugin
John Watson authored
1 import json
2 import requests
3 from porkchop.plugin import PorkchopPlugin
4
5 class ElasticSearchPlugin(PorkchopPlugin):
6 def get_data(self):
7 stats_url = self.config.get('elasticsearch', {}).get('stats_url',
8 'http://localhost:9200/_cluster/nodes/_local/stats')
9
10 raw_stats = json.loads(requests.get(stats_url).content)
11
12 # raw_stats['nodes'][<HASH>]
13 # The <HASH> is generated at server start and since it is the only key
14 # just list keys and grab the first one
15 stats = { raw_stats['cluster_name']: raw_stats['nodes'][raw_stats['nodes'].keys()[0]] }
16
17 return stats
Something went wrong with that request. Please try again.