Sha256: 7bab45800e0a39cfaa02c7c0213440f2a8d28791160c78e1b7db92065404eae3

Contents?: true

Size: 1019 Bytes

Versions: 3

Compression:

Stored size: 1019 Bytes

Contents

require 'spec_helper'

class Nagios::Bla < Nagios::Check
  params :s

  def execute
    crit 'a1' if s == 'crit' || s == 'crit_warn'
    warn 'a2' if s == 'warn' || s == 'crit_warn'
    raise 'a3' if s == 'raise'
    other 'a4' if s == 'other'
    ok 'a5'
  end

end

class Nagios::BlaEm < Nagios::CheckEM

  params :s

  def execute
    crit 'b1' if s == 'crit' || s == 'crit_warn'
    warn 'b2' if s == 'warn' || s == 'crit_warn'
    raise 'b3' if s == 'raise'
    other 'b4' if s == 'other'
    ok 'b5'

    send_result
  end

end


# block parameter
class Nagios::BlockObj < Nagios::Check
  params :s

  def execute
    crit("2") { s == '2' }
    ok "1"
  end
end

class Nagios::Prefix < Nagios::Check
  params :s

  def message_prefix
    'some '
  end

  def execute
    s == '1' ? crit('1') : ok('2')
  end
end

class Nagios::Tresh < Nagios::Check
  params :s, :c

  def some_m
    s && s.to_i
  end

  def criti
    c && c.to_i
  end

  def execute
    tresholds(:some_m, 5, criti) { |x| "msg #{x}" }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios_helper-0.2.2 spec/nagios_support.rb
nagios_helper-0.2.1 spec/nagios_support.rb
nagios_helper-0.2 spec/nagios_support.rb