class Avalon::Node
Node
is a single object to be monitored It should implement simple interface, only 2 required methods: poll
and report
Attributes
data[R]
ip[R]
Public Class Methods
create(monitor, *args)
click to toggle source
Builder method for creating Node
subclasses from config arrays
# File lib/avalon/node.rb, line 9 def Node.create monitor, *args subclass = Avalon.const_get(args.first.capitalize) subclass.new monitor, *args.drop(1) end
new()
click to toggle source
# File lib/avalon/node.rb, line 16 def initialize @data = {} end
Public Instance Methods
[](key)
click to toggle source
Get a specific data point about this Node
# File lib/avalon/node.rb, line 25 def [] key @data[key] end
[]=(key, value)
click to toggle source
Set a specific data point
# File lib/avalon/node.rb, line 30 def []= key, value @data[key] = value end
num()
click to toggle source
# File lib/avalon/node.rb, line 20 def num @num ||= @ip ? @ip.split('.').last.to_i : "" end
poll(verbose)
click to toggle source
Abstract: Check node status If verbose, the Node
should print out its state after the status update
# File lib/avalon/node.rb, line 44 def poll verbose raise "#{self.class} should implement #poll" end
pool_hash()
click to toggle source
# File lib/avalon/node.rb, line 39 def pool_hash end
report()
click to toggle source
Abstract: Report node errors or special situations (if any)
# File lib/avalon/node.rb, line 49 def report raise "#{self.class} should implement #report" end
reset()
click to toggle source
Abstract: Reset or reboot node
# File lib/avalon/node.rb, line 54 def reset raise "#{self.class} should implement #report" end
unit_hash()
click to toggle source
Node
API: following methods should be defined:
# File lib/avalon/node.rb, line 36 def unit_hash end