From 71af409b3dd31ba830e0b843b457b191661ad153 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 21 May 2013 21:20:10 +0800 Subject: [PATCH] [stormondemand|compute] Add stats graph API --- lib/fog/storm_on_demand/compute.rb | 2 ++ lib/fog/storm_on_demand/models/compute/stat.rb | 2 +- lib/fog/storm_on_demand/models/compute/stats.rb | 4 ++++ .../requests/compute/get_stats.rb | 2 +- .../requests/compute/get_stats_graph.rb | 16 ++++++++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 lib/fog/storm_on_demand/requests/compute/get_stats_graph.rb diff --git a/lib/fog/storm_on_demand/compute.rb b/lib/fog/storm_on_demand/compute.rb index 63312a4c3..90e5aa454 100644 --- a/lib/fog/storm_on_demand/compute.rb +++ b/lib/fog/storm_on_demand/compute.rb @@ -69,6 +69,8 @@ module Fog request :restore_image request :get_stats + request :get_stats_graph + request :list_private_ips class Mock diff --git a/lib/fog/storm_on_demand/models/compute/stat.rb b/lib/fog/storm_on_demand/models/compute/stat.rb index 348815981..c62c3385e 100644 --- a/lib/fog/storm_on_demand/models/compute/stat.rb +++ b/lib/fog/storm_on_demand/models/compute/stat.rb @@ -7,7 +7,7 @@ module Fog class Stat < Fog::Model attribute :loadavg attribute :memory - attribute :virtual + attribute :proc attribute :domain attribute :disk attribute :uptime diff --git a/lib/fog/storm_on_demand/models/compute/stats.rb b/lib/fog/storm_on_demand/models/compute/stats.rb index 8b0a99ef5..d53b5fd38 100644 --- a/lib/fog/storm_on_demand/models/compute/stats.rb +++ b/lib/fog/storm_on_demand/models/compute/stats.rb @@ -15,6 +15,10 @@ module Fog nil end + def graph(options) + service.get_stats_graph(options).body + end + end end diff --git a/lib/fog/storm_on_demand/requests/compute/get_stats.rb b/lib/fog/storm_on_demand/requests/compute/get_stats.rb index c982d59e9..d5f511114 100644 --- a/lib/fog/storm_on_demand/requests/compute/get_stats.rb +++ b/lib/fog/storm_on_demand/requests/compute/get_stats.rb @@ -5,7 +5,7 @@ module Fog def get_stats(options = {}) request( - :path => "/monitoring/load/stats", + :path => "/Monitoring/Load/stats", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/get_stats_graph.rb b/lib/fog/storm_on_demand/requests/compute/get_stats_graph.rb new file mode 100644 index 000000000..2d6b0346a --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/get_stats_graph.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def get_stats_graph(options={}) + request( + :path => '/Monitoring/Load/graph', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end