Class: Opstat::Plugins::Haproxy
- Inherits:
-
Task
- Object
- Task
- Opstat::Plugins::Haproxy
- Defined in:
- lib/plugins/haproxy.rb
Instance Method Summary collapse
-
#initialize(name, queue, config) ⇒ Haproxy
constructor
A new instance of Haproxy.
- #parse ⇒ Object
Constructor Details
#initialize(name, queue, config) ⇒ Haproxy
Returns a new instance of Haproxy.
6 7 8 9 10 |
# File 'lib/plugins/haproxy.rb', line 6 def initialize (name, queue, config) super(name, queue, config) @haproxy_url = "#{config['url']}/;up/stats;csv;norefresh'" self end |
Instance Method Details
#parse ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/plugins/haproxy.rb', line 11 def parse report = [] begin source = open(@haproxy_url,open_timeout: 1, read_timeout: 1).each do |line| report << line end rescue nil end return report end |