Class: Updawg::Monitor

Inherits:
Object
  • Object
show all
Defined in:
lib/updawg/monitor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMonitor

Returns a new instance of Monitor.



5
6
7
# File 'lib/updawg/monitor.rb', line 5

def initialize
  self.checks = []
end

Instance Attribute Details

#checksObject

Returns the value of attribute checks.



3
4
5
# File 'lib/updawg/monitor.rb', line 3

def checks
  @checks
end

Instance Method Details

#check(name, options = {}, &block) ⇒ Object



9
10
11
12
13
# File 'lib/updawg/monitor.rb', line 9

def check(name, options = {}, &block)
  check = Updawg::Check.new(name, options, &block).tap do |check|
    self.checks << check
  end
end

#deviation(name, options = {}, &block) ⇒ Object



21
22
23
24
25
# File 'lib/updawg/monitor.rb', line 21

def deviation(name, options = {}, &block)
  Updawg::DeviationCheck.new(name, options, &block).tap do |check|
    self.checks << check
  end
end

#performObject



27
28
29
30
31
# File 'lib/updawg/monitor.rb', line 27

def perform
  results = ResultSet.new
  checks.each{|c| results << c.perform}
  results
end

#threshold(name, options = {}, &block) ⇒ Object



15
16
17
18
19
# File 'lib/updawg/monitor.rb', line 15

def threshold(name, options = {}, &block)
  check = Updawg::ThresholdCheck.new(name, options, &block).tap do |check|
    self.checks << check
  end
end