Class: Nagios::CheckEM

Inherits:
Check
  • Object
show all
Defined in:
lib/nagios/check_em.rb

Constant Summary

Constants inherited from Check

Nagios::Check::TYPES

Instance Attribute Summary

Attributes inherited from Check

#check_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Check

check_name, default_error, #initialize, #result

Constructor Details

This class inherits a constructor from Nagios::Check

Class Method Details

.check(params = {}) ⇒ Object

synchrony check, for manually calls do not call in thin!!!



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/nagios/check_em.rb', line 23

def self.check(params = {})
  result = nil

  EM.run do
    inst = self.new(params) do |res|
      begin
        result = res
      ensure
        EM.stop
      end
    end

    inst.run
  end

  result
end

Instance Method Details

#executeObject



9
10
11
# File 'lib/nagios/check_em.rb', line 9

def execute
  send_result
end

#runObject



3
4
5
6
7
# File 'lib/nagios/check_em.rb', line 3

def run
  safe do
    execute
  end
end

#safe_deferObject



13
14
15
16
17
18
19
# File 'lib/nagios/check_em.rb', line 13

def safe_defer
  EM.defer do
    safe do
      yield
    end
  end
end