diff --git a/README.md b/README.md index 4a91fd0..d0127e7 100644 --- a/README.md +++ b/README.md @@ -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 ----------- diff --git a/mongo_conn b/mongo_conn new file mode 100755 index 0000000..2ce6a40 --- /dev/null +++ b/mongo_conn @@ -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() + + diff --git a/mongo_lock b/mongo_lock new file mode 100755 index 0000000..ee513e3 --- /dev/null +++ b/mongo_lock @@ -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() + + diff --git a/src/body_conn.py b/src/body_conn.py new file mode 100644 index 0000000..a26b343 --- /dev/null +++ b/src/body_conn.py @@ -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" + + + + + diff --git a/src/body_lock.py b/src/body_lock.py new file mode 100644 index 0000000..595c9d4 --- /dev/null +++ b/src/body_lock.py @@ -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" + + + + +