Permalink
Browse files

basics working

  • Loading branch information...
1 parent a1342c9 commit c35501b1c4a2f9847adf66d47eeb0896c8f782d6 @erh committed Mar 23, 2010
Showing with 50 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +6 −0 README
  3. +43 −0 mongo_ops
View
@@ -0,0 +1 @@
+*~
View
@@ -0,0 +1,6 @@
+
+Munin Plugins for MongoDB
+
+Requires
+ - simplejson or python >= 2.6
+ - MongoDB 1.4+ running on normal port
View
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+import urllib2
+import sys
+
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+
+def getParsed():
+ raw = urllib2.urlopen( "http://127.0.0.1:28017/_status" ).read()
+ return json.loads( raw )
+
+def data():
+ parsed = getParsed()
+ for k,v in parsed["serverStatus"]["opcounters"].iteritems():
+ print( str(k) + ".value " + str(v) )
+
+def config():
+
+ print "graph_title MongoDB ops"
+ print "graph_args --base 1000"
+ print "graph_vlabel ops / ${graph_period}"
+ print "graph_category MongoDB"
+ print "graph_total total"
+
+ for k in getParsed()["serverStatus"]["opcounters"]:
+ print k + ".label " + k
+ print k + ".min 0"
+ print k + ".type DERIVE"
+ print k + ".max 500000"
+ print k + ".draw AREA"
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1 and sys.argv[1] == "config":
+ config()
+ else:
+ data()
+
+

0 comments on commit c35501b

Please sign in to comment.