Class: What::Monitor
- Inherits:
-
Object
- Object
- What::Monitor
- Defined in:
- lib/what/monitor.rb
Class Method Summary collapse
Class Method Details
.do_it(modules) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/what/monitor.rb', line 12 def self.do_it(modules) loop do overall = :ok modules.each do |mod| mod.check! case mod.health when :ok when :warning overall = :warning if overall != :alert else overall = :alert end What::Status[mod.name] = mod.status end What::Status[:health] = overall sleep What::Config['interval'] end end |
.go! ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/what/monitor.rb', line 2 def self.go! @modules = What::Config['modules'].map do |m| name = What::Helpers.camelize(m) What::Modules.const_get(name).new end Thread.abort_on_exception = true @thread = Thread.new(@modules) { |modules| self.do_it(modules) } end |