First-pass at a 'running VMs' graph

This commit is contained in:
Scott Schneider 2014-02-11 11:40:26 -08:00
parent ac52d0df3e
commit b775579c6a
3 changed files with 148 additions and 0 deletions

View file

@ -110,6 +110,21 @@ get '/dashboard/stats/vcloud/pool' do
JSON.pretty_generate(result)
end
get '/dashboard/stats/vcloud/running' do
result = Hash.new
config[:pools].each do |pool|
running = $redis.scard( 'vmware_host_pool__running__' + pool['name'] )
pool['major'] = $1 if pool['name'] =~ /^(\w+)\-/
result[pool['major']] = result[pool['major']].to_i + running.to_i
end
content_type :json
JSON.pretty_generate(result)
end
get '/status' do
content_type :json