Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
Munin Plugins for MongoDB | ||
|
||
Requires | ||
- simplejson or python >= 2.6 | ||
- MongoDB 1.4+ running on normal port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
|
||
|