Class: Updawg::Monitor
- Inherits:
-
Object
- Object
- Updawg::Monitor
- Defined in:
- lib/updawg/monitor.rb
Instance Attribute Summary collapse
-
#checks ⇒ Object
Returns the value of attribute checks.
Instance Method Summary collapse
- #check(name, options = {}, &block) ⇒ Object
- #deviation(name, options = {}, &block) ⇒ Object
-
#initialize ⇒ Monitor
constructor
A new instance of Monitor.
- #perform ⇒ Object
- #threshold(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize ⇒ Monitor
Returns a new instance of Monitor.
5 6 7 |
# File 'lib/updawg/monitor.rb', line 5 def initialize self.checks = [] end |
Instance Attribute Details
#checks ⇒ Object
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, = {}, &block) check = Updawg::Check.new(name, , &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, = {}, &block) Updawg::DeviationCheck.new(name, , &block).tap do |check| self.checks << check end end |
#perform ⇒ Object
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, = {}, &block) check = Updawg::ThresholdCheck.new(name, , &block).tap do |check| self.checks << check end end |