Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mongo_btree

  • Loading branch information...
commit 017ecadffb0e66ab678dfb1ffcefff8296f491f0 1 parent 3db95c7
@erh authored
Showing with 95 additions and 0 deletions.
  1. +19 −0 build.bash
  2. +50 −0 mongo_btree
  3. +26 −0 src/body_btree.py
View
19 build.bash
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+for out in `ls src/body_*.py`
+do
+ echo $out
+ x=${out#src/body_}
+ x=${x%.py}
+
+ out=mongo_$x
+
+ echo "#!"`which python` > $out
+ echo "" >> $out
+ echo "## GENERATED FILE - DO NOT EDIT" >> $out
+ cat src/header.py >> $out
+ cat src/body_$x.py >> $out
+ cat src/footer.py >> $out
+ chmod 755 $out
+
+done
View
50 mongo_btree
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+## GENERATED FILE - DO NOT EDIT
+
+import urllib2
+import sys
+
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+
+def getServerStatus():
+ raw = urllib2.urlopen( "http://127.0.0.1:28017/_status" ).read()
+ return json.loads( raw )["serverStatus"]
+
+def get():
+ return getServerStatus()["indexCounters"]["btree"]
+
+def doData():
+ for k,v in get().iteritems():
+ print( str(k) + ".value " + str(v) )
+
+def doConfig():
+
+ print "graph_title MongoDB memory usage"
+ print "graph_args --base 1000"
+ print "graph_vlabel mb ${graph_period}"
+ print "graph_category MongoDB"
+
+ for k in get():
+ print k + ".label " + k
+ print k + ".min 0"
+ print k + ".type COUNTER"
+ print k + ".max 500000"
+ print k + ".draw AREA"
+
+
+
+
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1 and sys.argv[1] == "config":
+ doConfig()
+ else:
+ doData()
+
+
View
26 src/body_btree.py
@@ -0,0 +1,26 @@
+
+def get():
+ return getServerStatus()["indexCounters"]["btree"]
+
+def doData():
+ for k,v in get().iteritems():
+ print( str(k) + ".value " + str(v) )
+
+def doConfig():
+
+ print "graph_title MongoDB memory usage"
+ print "graph_args --base 1000"
+ print "graph_vlabel mb ${graph_period}"
+ print "graph_category MongoDB"
+
+ for k in get():
+ print k + ".label " + k
+ print k + ".min 0"
+ print k + ".type COUNTER"
+ print k + ".max 500000"
+ print k + ".draw AREA"
+
+
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.