Révision 0eedb04a
Added some documentation and handling of RIAK_URL environment variable.
| plugins/other/riak_memory | ||
|---|---|---|
| 1 | 1 |
#!/usr/bin/python |
| 2 | 2 |
|
| 3 | 3 |
|
| 4 |
# This is monitoring plugin for riak Developer's website: http://wiki.basho.com/Riak.html |
|
| 5 |
# sample config in /etc/munin/plugin-conf.d/riak |
|
| 6 |
# |
|
| 7 |
# [riak_*] |
|
| 8 |
# RIAK_URL=http://127.0.0.1:8091/stats |
|
| 9 |
# any questions to fygrave at o0o dot nu |
|
| 10 |
# |
|
| 11 |
# This plugin monitors memory allocation on each node. |
|
| 12 |
# |
|
| 13 |
|
|
| 4 | 14 |
import urllib2 |
| 5 | 15 |
import sys |
| 16 |
import os |
|
| 6 | 17 |
|
| 7 | 18 |
try: |
| 8 | 19 |
import json |
| ... | ... | |
| 13 | 24 |
names = ["memory_total","memory_processes","memory_processes_used","memory_system","memory_atom","memory_atom_used","memory_binary","memory_code","memory_ets"] |
| 14 | 25 |
|
| 15 | 26 |
def getServerStatus(): |
| 16 |
raw = urllib2.urlopen( "http://127.0.0.1:8091/stats" ).read()
|
|
| 27 |
raw = urllib2.urlopen( os.environ.get('RIAK_URL', "http://127.0.0.1:8097/stats") ).read()
|
|
| 17 | 28 |
return json.loads( raw ) |
| 18 | 29 |
|
| 19 | 30 |
|
Formats disponibles : Unified diff