From 0eedb04aac5cced2d4d045a17c9c93e1a007c437 Mon Sep 17 00:00:00 2001 From: Fyodor Yarochkin Date: Mon, 16 Jan 2012 23:47:19 +0800 Subject: [PATCH] Added some documentation and handling of RIAK_URL environment variable. --- plugins/other/riak_memory | 13 ++++++++++++- plugins/other/riak_node | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/plugins/other/riak_memory b/plugins/other/riak_memory index e35b1f68..25fe4764 100755 --- a/plugins/other/riak_memory +++ b/plugins/other/riak_memory @@ -1,8 +1,19 @@ #!/usr/bin/python +# This is monitoring plugin for riak Developer's website: http://wiki.basho.com/Riak.html +# sample config in /etc/munin/plugin-conf.d/riak +# +# [riak_*] +# RIAK_URL=http://127.0.0.1:8091/stats +# any questions to fygrave at o0o dot nu +# +# This plugin monitors memory allocation on each node. +# + import urllib2 import sys +import os try: import json @@ -13,7 +24,7 @@ except ImportError: 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( "http://127.0.0.1:8091/stats" ).read() + raw = urllib2.urlopen( os.environ.get('RIAK_URL', "http://127.0.0.1:8097/stats") ).read() return json.loads( raw ) diff --git a/plugins/other/riak_node b/plugins/other/riak_node index 948a4eec..0ac851f8 100755 --- a/plugins/other/riak_node +++ b/plugins/other/riak_node @@ -1,8 +1,19 @@ #!/usr/bin/python +# This is monitoring plugin for riak Developer's website: http://wiki.basho.com/Riak.html +# sample config in /etc/munin/plugin-conf.d/riak +# +# [riak_*] +# RIAK_URL=http://127.0.0.1:8091/stats +# any questions to fygrave at o0o dot nu +# +# This plugin monitors put/get rate at each node. +# + import urllib2 import sys +import os try: import json @@ -13,7 +24,7 @@ except ImportError: names = ["node_gets_total", "node_puts_total"] def getServerStatus(): - raw = urllib2.urlopen( "http://127.0.0.1:8091/stats" ).read() + raw = urllib2.urlopen( os.environ.get('RIAK_URL', "http://127.0.0.1:8097/stats") ).read() return json.loads( raw )