Class: CirconusMunin

Inherits:
Object
  • Object
show all
Defined in:
lib/circonus-munin.rb

Instance Method Summary collapse

Constructor Details

#initialize(host = 'localhost', port = 4949) ⇒ CirconusMunin

Returns a new instance of CirconusMunin.



26
27
28
29
# File 'lib/circonus-munin.rb', line 26

def initialize(host='localhost', port=4949)
  @munin = TCPSocket.new(host, port)
  @munin.gets
end

Instance Method Details

#closeObject



48
49
50
# File 'lib/circonus-munin.rb', line 48

def close
  @munin.close
end

#get_response(cmd) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/circonus-munin.rb', line 31

def get_response(cmd)
  @munin.puts(cmd)
  stop = false 
  response = Array.new
  while stop == false
    line = @munin.gets
    line.chomp!
    if line == '.'
      stop = true
    else
      response << line 
      stop = true if cmd == "list"
    end
  end
  response
end