Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
conn and lock tests
  • Loading branch information
erh committed Mar 24, 2010
1 parent 0e27c76 commit 8c3a663
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -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
-----------
Expand Down
45 changes: 45 additions & 0 deletions 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()


46 changes: 46 additions & 0 deletions 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()


21 changes: 21 additions & 0 deletions 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"





22 changes: 22 additions & 0 deletions 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"





0 comments on commit 8c3a663

Please sign in to comment.