root / plugins / mongodb / mongo_btree @ 9f85e0ae
Historique | Voir | Annoter | Télécharger (1,06 ko)
| 1 | a200e01f | Eliot Horowitz | #!/usr/bin/python |
|---|---|---|---|
| 2 | |||
| 3 | ## GENERATED FILE - DO NOT EDIT |
||
| 4 | |||
| 5 | import urllib2 |
||
| 6 | import sys |
||
| 7 | |||
| 8 | try: |
||
| 9 | import json |
||
| 10 | except ImportError: |
||
| 11 | import simplejson as json |
||
| 12 | |||
| 13 | |||
| 14 | def getServerStatus(): |
||
| 15 | raw = urllib2.urlopen( "http://127.0.0.1:28017/_status" ).read() |
||
| 16 | return json.loads( raw )["serverStatus"] |
||
| 17 | |||
| 18 | def get(): |
||
| 19 | 271a38f0 | Dimitri Savineau | status = getServerStatus() |
| 20 | if status["version"] >= "2.4.0": |
||
| 21 | return getServerStatus()["indexCounters"] |
||
| 22 | else: |
||
| 23 | return getServerStatus()["indexCounters"]["btree"] |
||
| 24 | a200e01f | Eliot Horowitz | |
| 25 | def doData(): |
||
| 26 | for k,v in get().iteritems(): |
||
| 27 | print( str(k) + ".value " + str(int(v)) ) |
||
| 28 | |||
| 29 | def doConfig(): |
||
| 30 | |||
| 31 | print "graph_title MongoDB btree stats" |
||
| 32 | print "graph_args --base 1000 -l 0" |
||
| 33 | print "graph_vlabel mb ${graph_period}"
|
||
| 34 | print "graph_category MongoDB" |
||
| 35 | |||
| 36 | for k in get(): |
||
| 37 | print k + ".label " + k |
||
| 38 | print k + ".min 0" |
||
| 39 | print k + ".type COUNTER" |
||
| 40 | print k + ".max 500000" |
||
| 41 | print k + ".draw LINE1" |
||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | if __name__ == "__main__": |
||
| 49 | if len(sys.argv) > 1 and sys.argv[1] == "config": |
||
| 50 | doConfig() |
||
| 51 | else: |
||
| 52 | doData() |
||
| 53 |
