Skip to content

Instantly share code, notes, and snippets.

@AMeng
Created July 11, 2014 15:50
Show Gist options
  • Save AMeng/3f7a89a0f7888569d8a3 to your computer and use it in GitHub Desktop.
Save AMeng/3f7a89a0f7888569d8a3 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import json
import urllib2
url = 'http://192.168.3.14:9200/_cluster/health?pretty=true'
results = urllib2.urlopen(url).read()
stats = json.loads(results)
print "metric cluster_status string {0}".format(stats['status'])
print "metric number_of_nodes int {0}".format(stats['number_of_nodes'])
print "metric active_shards int {0}".format(stats['active_shards'])
print "metric relocating_shards int {0}".format(stats['relocating_shards'])
print "metric initializing_shards int {0}".format(stats['initializing_shards'])
print "metric unassigned_shards int {0}".format(stats['unassigned_shards'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment