Class: Slurry::Graphite
- Inherits:
-
Object
- Object
- Slurry::Graphite
- Defined in:
- lib/slurry/graphite.rb
Overview
Handles connection details to the graphite server.
Instance Method Summary collapse
-
#close ⇒ Object
Close the open socket to the graphite server.
-
#initialize(server, port) ⇒ Graphite
constructor
Opens a socket with the specified graphite server.
-
#send(target, value, time) ⇒ Object
Puts the graphite formatted string into the open socket.
Constructor Details
#initialize(server, port) ⇒ Graphite
Opens a socket with the specified graphite server.
9 10 11 12 |
# File 'lib/slurry/graphite.rb', line 9 def initialize(server,port) @server, @port = server, port @s = TCPSocket.open(server,port) end |
Instance Method Details
#close ⇒ Object
Close the open socket to the graphite server.
25 26 27 |
# File 'lib/slurry/graphite.rb', line 25 def close @s.close end |
#send(target, value, time) ⇒ Object
Puts the graphite formatted string into the open socket.
19 20 21 22 |
# File 'lib/slurry/graphite.rb', line 19 def send (target,value,time) line = [target,value,time].join(" ") @s.puts(line) end |