Permalink
Browse files

conn and lock tests

  • Loading branch information...
1 parent 0e27c76 commit 8c3a663fcc9905f01e3ba845a6762fae51aa17c7 @erh committed Mar 24, 2010
Showing with 139 additions and 3 deletions.
  1. +5 −3 README.md
  2. +45 −0 mongo_conn
  3. +46 −0 mongo_lock
  4. +21 −0 src/body_conn.py
  5. +22 −0 src/body_lock.py
View
@@ -4,9 +4,11 @@ Munin Plugins for MongoDB
Plugins
----------
-* mongo_ops : graphs operations/second
-* mongo_mem : graphs mapped, virtual and resident memory usage
-* mongo_btree : graphs btree access/misses/etc...
+* mongo_ops : operations/second
+* mongo_mem : mapped, virtual and resident memory usage
+* mongo_btree : btree access/misses/etc...
+* mongo_conn : current connections
+* mongo_lock : write lock info
Requirements
-----------
View
@@ -0,0 +1,45 @@
+#!/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"]
+
+name = "connections"
+
+
+def doData():
+ print name + ".value " + str( getServerStatus()["connections"]["current"] )
+
+def doConfig():
+
+ print "graph_title MongoDB current connections"
+ print "graph_vlabel connections ${graph_period}"
+ print "graph_category MongoDB"
+
+ print name + ".label " + name
+ print name + ".type GAUGE"
+ print name + ".draw AREA"
+
+
+
+
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1 and sys.argv[1] == "config":
+ doConfig()
+ else:
+ doData()
+
+
View
@@ -0,0 +1,46 @@
+#!/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"]
+
+name = "locked"
+
+def doData():
+ print name + ".value " + str( 100 * getServerStatus()["globalLock"]["ratio"] )
+
+def doConfig():
+
+ print "graph_title MongoDB write lock percentage"
+ print "graph_vlabel percentage ${graph_period}"
+ print "graph_category MongoDB"
+
+ print name + ".label " + name
+ print name + ".type GAUGE"
+ print name + ".draw AREA"
+ print name + ".min 0"
+ print name + ".max 100"
+
+
+
+
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1 and sys.argv[1] == "config":
+ doConfig()
+ else:
+ doData()
+
+
View
@@ -0,0 +1,21 @@
+
+name = "connections"
+
+
+def doData():
+ print name + ".value " + str( getServerStatus()["connections"]["current"] )
+
+def doConfig():
+
+ print "graph_title MongoDB current connections"
+ print "graph_vlabel connections ${graph_period}"
+ print "graph_category MongoDB"
+
+ print name + ".label " + name
+ print name + ".type GAUGE"
+ print name + ".draw AREA"
+
+
+
+
+
View
@@ -0,0 +1,22 @@
+
+name = "locked"
+
+def doData():
+ print name + ".value " + str( 100 * getServerStatus()["globalLock"]["ratio"] )
+
+def doConfig():
+
+ print "graph_title MongoDB write lock percentage"
+ print "graph_vlabel percentage ${graph_period}"
+ print "graph_category MongoDB"
+
+ print name + ".label " + name
+ print name + ".type GAUGE"
+ print name + ".draw AREA"
+ print name + ".min 0"
+ print name + ".max 100"
+
+
+
+
+

0 comments on commit 8c3a663

Please sign in to comment.