Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 57 lines (38 sloc) 1.23 KB
# This is monitoring plugin for riak Developer's website:
# sample config in /etc/munin/plugin-conf.d/riak
# [riak_*]
# env.RIAK_URL
# any questions to fygrave at o0o dot nu
# This plugin monitors memory allocation on each node.
import urllib2
import sys
import os
import json
except ImportError:
import simplejson as json
names = ["memory_total","memory_processes","memory_processes_used","memory_system","memory_atom","memory_atom_used","memory_binary","memory_code","memory_ets"]
def getServerStatus():
raw = urllib2.urlopen( os.environ.get('RIAK_URL', "") ).read()
return json.loads( raw )
def doData():
for name in names:
print name + ".value " + str( getServerStatus()[name] )
def doConfig():
print "graph_title Riak memory"
print "graph_args --base 1000 -l 0"
print "graph_vlabel memory"
print "graph_category Riak"
for name in names:
print name + ".label " + name
print name + ".type GAUGE"
print name + "draw LINE1"
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "config":