class EzNemo::Monitor
Maintains an array of all the monitor plugins
Public Class Methods
new()
click to toggle source
# File lib/eznemo/monitor.rb, line 12 def initialize @plugins = {} end
Public Instance Methods
register(plugin)
click to toggle source
Registers a plugin; usually called by the plugin itself @param plugin [Object]
# File lib/eznemo/monitor.rb, line 18 def register(plugin) @plugins[plugin.name] = plugin plugin.registered(self) end
report(result)
click to toggle source
Report result; usually called by the plugin @param result [EzNemo::Result]
# File lib/eznemo/monitor.rb, line 37 def report(result) EzNemo.datastore.store_result(result) end
start_checks(checks)
click to toggle source
Starts check loops in the reactor @param checks [Array<Hash, …>]
# File lib/eznemo/monitor.rb, line 25 def start_checks(checks) i = 0 checks.each do |c| p = @plugins[c[:type].to_sym] p.add_check(c) i += 1 end EzNemo.logger.info "#{i} checks activated." end