Class: Steto::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/steto/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(engine) ⇒ Config

Returns a new instance of Config.



5
6
7
# File 'lib/steto/config.rb', line 5

def initialize(engine)
  @engine = engine
end

Instance Attribute Details

#engineObject

Returns the value of attribute engine.



3
4
5
# File 'lib/steto/config.rb', line 3

def engine
  @engine
end

Instance Method Details

#check(name, check_class = nil, attributes = {}, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/steto/config.rb', line 13

def check(name, check_class = nil, attributes = {}, &block)
  name = name.to_sym
  check =
    if check_class
      check_class.new attributes.merge(:name => name)
    else
      ProcCheck.new :name => name, &block
    end
  engine.checks << check
end

#configure(&block) ⇒ Object



9
10
11
# File 'lib/steto/config.rb', line 9

def configure(&block)
  instance_eval &block
end

#nagios(name, command, options = {}) ⇒ Object



24
25
26
# File 'lib/steto/config.rb', line 24

def nagios(name, command, options = {})
  check name, Steto::NagiosCheck, :command => "/usr/lib/nagios/plugins/#{command}", :options => options
end

#report(reporter_class = nil, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/steto/config.rb', line 28

def report(reporter_class = nil, &block)
  reporter =
    if reporter_class
      reporter_class.new
    else
      ProcReporter.new &block
    end
  engine.reporters << reporter
end