Class: PingMon::Monitor
- Inherits:
-
Object
- Object
- PingMon::Monitor
- Defined in:
- lib/pingmon/monitor.rb
Instance Method Summary collapse
-
#initialize(configuration = Config.new) ⇒ Monitor
constructor
A new instance of Monitor.
- #monitor ⇒ Object
Constructor Details
#initialize(configuration = Config.new) ⇒ Monitor
3 4 5 |
# File 'lib/pingmon/monitor.rb', line 3 def initialize(configuration=Config.new) @config = configuration end |
Instance Method Details
#monitor ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pingmon/monitor.rb', line 7 def monitor @config.load unless @config.loaded? PingMon.log << "Monitoring host '#{@config.host}'. Will ping every '#{@config.monitor_interval}'." if PingMon.log EM.run { pinger = Pinger.new(@config) scheduler = Rufus::Scheduler::EmScheduler.start_new scheduler.every @config.monitor_interval do pinger.ping end } end |