Class: Rearview::AlertsHandler
- Inherits:
-
Object
- Object
- Rearview::AlertsHandler
- Includes:
- Logger
- Defined in:
- lib/rearview/alerts_handler.rb
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#monitor_result ⇒ Object
readonly
Returns the value of attribute monitor_result.
Instance Method Summary collapse
-
#initialize(job, monitor_results) ⇒ AlertsHandler
constructor
A new instance of AlertsHandler.
- #run ⇒ Object
Methods included from Logger
Constructor Details
#initialize(job, monitor_results) ⇒ AlertsHandler
Returns a new instance of AlertsHandler.
6 7 8 9 |
# File 'lib/rearview/alerts_handler.rb', line 6 def initialize(job,monitor_results) @job = job @monitor_results = monitor_results end |
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
5 6 7 |
# File 'lib/rearview/alerts_handler.rb', line 5 def job @job end |
#monitor_result ⇒ Object (readonly)
Returns the value of attribute monitor_result.
5 6 7 |
# File 'lib/rearview/alerts_handler.rb', line 5 def monitor_result @monitor_result end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rearview/alerts_handler.rb', line 10 def run if Rearview.config.alerts_enabled? Rearview.alert_clients.each do |client| begin alert_agent = client.new alert_agent.alert(@job,@monitor_results) rescue logger.error "#{self} #{client} failed: #{$!}\n#{$@.join("\n")}" end end end self end |