Class: Synapse::Easy::Section::Stats
- Defined in:
- lib/synapse/easy/section/stats.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#hide_version ⇒ Object
Returns the value of attribute hide_version.
-
#node ⇒ Object
Returns the value of attribute node.
-
#password ⇒ Object
Returns the value of attribute password.
-
#realm ⇒ Object
Returns the value of attribute realm.
-
#refresh ⇒ Object
Returns the value of attribute refresh.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#show_node ⇒ Object
Returns the value of attribute show_node.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#username ⇒ Object
Returns the value of attribute username.
Attributes inherited from Base
#address, #mode, #name, #options, #port, #type
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Stats
constructor
A new instance of Stats.
- #label ⇒ Object
- #section_options ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(params = {}) ⇒ Stats
Returns a new instance of Stats.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/synapse/easy/section/stats.rb', line 11 def initialize params={} super @uri = params[:uri] @uri ||= "/" @enabled = params[:enabled] @enabled ||= true if @enabled.nil? @refresh = params[:refresh] @refresh ||= 5 @realm = params[:realm] @realm ||= "HAProxy\\ Stats" @hide_version = params[:hide_version] @hide_version ||= true if @hide_version.nil? @username = params[:username] @password = params[:password] @scope = params[:scope] @show_node = params[:show_node] @show_node ||= false if @show_node.nil? @node = params[:node] @node ||= Socket.gethostname end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def enabled @enabled end |
#hide_version ⇒ Object
Returns the value of attribute hide_version.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def hide_version @hide_version end |
#node ⇒ Object
Returns the value of attribute node.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def node @node end |
#password ⇒ Object
Returns the value of attribute password.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def password @password end |
#realm ⇒ Object
Returns the value of attribute realm.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def realm @realm end |
#refresh ⇒ Object
Returns the value of attribute refresh.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def refresh @refresh end |
#scope ⇒ Object
Returns the value of attribute scope.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def scope @scope end |
#show_node ⇒ Object
Returns the value of attribute show_node.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def show_node @show_node end |
#uri ⇒ Object
Returns the value of attribute uri.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def uri @uri end |
#username ⇒ Object
Returns the value of attribute username.
9 10 11 |
# File 'lib/synapse/easy/section/stats.rb', line 9 def username @username end |
Instance Method Details
#label ⇒ Object
44 45 46 |
# File 'lib/synapse/easy/section/stats.rb', line 44 def label "listen stats #{bind}" end |
#section_options ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/synapse/easy/section/stats.rb', line 31 def @options + [ "mode http", ( "stats enable" if enabled ), "stats uri #{uri}", "stats refresh #{refresh}", "stats realm #{realm}", ( "stats hide-version" if hide_version), ( "stats auth #{username}:#{password}" if username and password ), ( "stats scope #{scope}" if scope ), ( "stats show-node #{node}" if show_node ), ].compact end |