Sha256: 8dfcee69212c3e8ae17cd8ec5eab9826d11e036a0b7389b5970715224ff2d3eb

Contents?: true

Size: 796 Bytes

Versions: 13

Compression:

Stored size: 796 Bytes

Contents

module BigBrother
  class Nagios
    module Code
      Ok       = 0
      Warning  = 1
      Critical = 2
      Unknown  = 3
    end

    def initialize(executor = ShellExecutor.new)
      @executor = executor
    end

    def send_critical(host, check, message, server)
      _send_passive(host, check, Code::Critical, "CRITICAL #{message}", server)
    end

    def send_ok(host, check, message, server)
      _send_passive(host, check, Code::Ok, "OK #{message}", server)
    end

    def send_warning(host, check, message, server)
      _send_passive(host, check, Code::Warning, "WARNING #{message}", server)
    end

    def _send_passive(host, check, code, message, server)
      @executor.invoke("echo '#{host},#{check},#{code},#{message}' | send_nsca -H #{server} -d ,")
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
big_brother-0.8.8.1 lib/big_brother/nagios.rb
big_brother-0.8.8 lib/big_brother/nagios.rb
big_brother-0.8.7 lib/big_brother/nagios.rb
big_brother-0.6.8 lib/big_brother/nagios.rb
big_brother-0.6.7 lib/big_brother/nagios.rb
big_brother-0.6.6 lib/big_brother/nagios.rb
big_brother-0.6.5 lib/big_brother/nagios.rb
big_brother-0.6.4 lib/big_brother/nagios.rb
big_brother-0.6.3 lib/big_brother/nagios.rb
big_brother-0.6.2 lib/big_brother/nagios.rb
big_brother-0.6.1 lib/big_brother/nagios.rb
big_brother-0.6.0 lib/big_brother/nagios.rb
big_brother-0.5.0 lib/big_brother/nagios.rb