Pool stats should still work without graphite

This commit is contained in:
Scott Schneider 2013-12-12 11:22:52 -08:00
parent c795880535
commit 45ab2455cf

View file

@ -59,6 +59,7 @@ get '/dashboard/stats/vcloud/pool' do
end
if ( params[:history] )
if ( config[:config]['graphite'] )
history ||= Hash.new
buffer = open( 'http://'+config[:config]['graphite']+'/render?target=vcloud.ready.*&from=-1hour&format=json' ).read
@ -82,6 +83,12 @@ get '/dashboard/stats/vcloud/pool' do
end
end
end
else
config[:pools].each do |pool|
result[pool['name']] ||= Hash.new
result[pool['name']]['history'] = [ $redis.scard( 'vmware_host_pool__ready__' + pool['name'] ) ]
end
end
end
content_type :json