Class: Vmpooler::API::Dashboard
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Vmpooler::API::Dashboard
- Defined in:
- lib/vmpooler/api/dashboard.rb
Instance Method Summary collapse
- #backend ⇒ Object
-
#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
#backend ⇒ Object
14 15 16 |
# File 'lib/vmpooler/api/dashboard.rb', line 14 def backend Vmpooler::API.settings.redis end |
#config ⇒ Object
handle to the App’s configuration information
10 11 12 |
# File 'lib/vmpooler/api/dashboard.rb', line 10 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)
55 56 57 58 |
# File 'lib/vmpooler/api/dashboard.rb', line 55 def graph_link(target = '') return '' unless graph_url graph_url + target end |
#graph_prefix ⇒ Object
configuration setting for URL prefix for graphs to view
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vmpooler/api/dashboard.rb', line 34 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
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vmpooler/api/dashboard.rb', line 19 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?
49 50 51 52 |
# File 'lib/vmpooler/api/dashboard.rb', line 49 def graph_url return false unless graph_server && graph_prefix @graph_url ||= "http://#{graph_server}/render?target=#{graph_prefix}" end |