Class: Vmpooler::API::Dashboard
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Vmpooler::API::Dashboard
- Defined in:
- lib/vmpooler/api/dashboard.rb
Instance Method Summary collapse
-
#config ⇒ Object
handle to the App’s configuration information.
-
#graph_link(target = '') ⇒ Object
return a full URL to a viewable graph for a given metrics target (graphite syntax).
-
#graph_prefix ⇒ Object
configuration setting for URL prefix for graphs to view.
-
#graph_server ⇒ Object
configuration setting for server hosting graph URLs to view.
-
#graph_url ⇒ Object
what is the base URL for viewable graphs?.
Instance Method Details
#config ⇒ Object
handle to the App’s configuration information
5 6 7 |
# File 'lib/vmpooler/api/dashboard.rb', line 5 def config @config ||= Vmpooler::API.settings.config end |
#graph_link(target = '') ⇒ Object
return a full URL to a viewable graph for a given metrics target (graphite syntax)
46 47 48 49 |
# File 'lib/vmpooler/api/dashboard.rb', line 46 def graph_link(target = '') return '' unless graph_url graph_url + target end |
#graph_prefix ⇒ Object
configuration setting for URL prefix for graphs to view
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vmpooler/api/dashboard.rb', line 25 def graph_prefix return @graph_prefix if @graph_prefix if config[:graphs] return 'vmpooler' unless config[:graphs]['prefix'] @graph_prefix = config[:graphs]['prefix'] elsif config[:graphite] return false unless config[:graphite]['prefix'] @graph_prefix = config[:graphite]['prefix'] else false end end |
#graph_server ⇒ Object
configuration setting for server hosting graph URLs to view
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vmpooler/api/dashboard.rb', line 10 def graph_server return @graph_server if @graph_server if config[:graphs] return false unless config[:graphs]['server'] @graph_server = config[:graphs]['server'] elsif config[:graphite] return false unless config[:graphite]['server'] @graph_server = config[:graphite]['server'] else false end end |
#graph_url ⇒ Object
what is the base URL for viewable graphs?
40 41 42 43 |
# File 'lib/vmpooler/api/dashboard.rb', line 40 def graph_url return false unless graph_server && graph_prefix @graph_url ||= "http://#{graph_server}/render?target=#{graph_prefix}" end |