Created
July 9, 2012 09:51
-
-
Save sawanoboly/3075462 to your computer and use it in GitHub Desktop.
Riak status to GrowthForeCast
This file contains hidden or 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
require 'json' | |
gf_1 = "locate_name" | |
gf_2 = "riak_stat" | |
gfcast = "http://user:password@your_gfcast_address/api/#{gf_1}/#{gf_2}" | |
r_add = "your_riak_address:8098/stats" | |
r_stats = JSON.load(`curl -s #{r_add} | json`) | |
keys = [ "mem_total", | |
"mem_allocated", | |
"vnode_gets_total", | |
"vnode_puts_total", | |
"node_gets_total", | |
"node_puts_total", | |
"read_repairs_total", | |
"cpu_nprocs", | |
"cpu_avg1", | |
"cpu_avg5", | |
"cpu_avg15", ] | |
keys.each do |key| | |
r_stats[key] = r_stats[key]/1024/1024 if key =~ /^mem_/ | |
`curl -s -f -X POST #{gfcast}/#{key} -d "number=#{r_stats[key]}"` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment