Class: Nutcracker::Graphite::Agent
- Inherits:
-
Object
- Object
- Nutcracker::Graphite::Agent
- Defined in:
- lib/nutcracker/graphite.rb
Constant Summary collapse
- INTERVAL =
60
Instance Attribute Summary collapse
-
#graphite ⇒ Object
readonly
Returns the value of attribute graphite.
-
#nutcracker ⇒ Object
readonly
Returns the value of attribute nutcracker.
Instance Method Summary collapse
-
#initialize(nutcracker, options) ⇒ Agent
constructor
A new instance of Agent.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
Instance Attribute Details
#graphite ⇒ Object (readonly)
Returns the value of attribute graphite.
15 16 17 |
# File 'lib/nutcracker/graphite.rb', line 15 def graphite @graphite end |
#nutcracker ⇒ Object (readonly)
Returns the value of attribute nutcracker.
15 16 17 |
# File 'lib/nutcracker/graphite.rb', line 15 def nutcracker @nutcracker end |
Instance Method Details
#start ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nutcracker/graphite.rb', line 22 def start @task ||= graphite.every(INTERVAL) do |client| begin client.metrics metrics nutcracker.overview rescue Exception => e STDERR.puts [e.,e.backtrace.join("\n")] end end self end |
#stop ⇒ Object
33 34 35 |
# File 'lib/nutcracker/graphite.rb', line 33 def stop @task and @task.cancel end |