Sha256: ac391878d542ada135401ec92ad56f1375b15ef35e33efbd9c434bf49a56aae3

Contents?: true

Size: 519 Bytes

Versions: 3

Compression:

Stored size: 519 Bytes

Contents

class Nagios::CheckEM < Nagios::Check

  def run
    safe do
      execute
    end
  end

  def execute
    send_result
  end

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

  # synchrony check, for manually calls
  # do not call in thin!!!
  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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios_helper-0.2.2 lib/nagios/check_em.rb
nagios_helper-0.2.1 lib/nagios/check_em.rb
nagios_helper-0.2 lib/nagios/check_em.rb