Skip to content

Commit

Permalink
basics working
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Mar 23, 2010
1 parent a1342c9 commit c35501b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*~
6 changes: 6 additions & 0 deletions README
@@ -0,0 +1,6 @@

Munin Plugins for MongoDB

Requires
- simplejson or python >= 2.6
- MongoDB 1.4+ running on normal port
43 changes: 43 additions & 0 deletions mongo_ops
@@ -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.