Class: EY::Stonith::Commands::Check
- Defined in:
- lib/ey_stonith/commands/check.rb
Constant Summary
Constants inherited from Abstract
Abstract::DEFAULT_CONFIG_PATH, Abstract::SCRIPT_NAME
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Abstract
#call, #command_options, #config, #execute, #history, #init_logger, #initialize, #parse!, #parser, #script
Constructor Details
This class inherits a constructor from EY::Stonith::Commands::Abstract
Class Method Details
.banner ⇒ Object
10 11 12 |
# File 'lib/ey_stonith/commands/check.rb', line 10 def self. "Check the remote master haproxy" end |
.command ⇒ Object
6 7 8 |
# File 'lib/ey_stonith/commands/check.rb', line 6 def self.command 'check' end |
Instance Method Details
#invoke ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ey_stonith/commands/check.rb', line 14 def invoke history << :check begin timeout(config.monitor_timeout) do open("http://#{config.monitor_host}#{config.monitor_path}").read end rescue StandardError, Timeout::Error => e Stonith.logger.error "Got error when checking master: #{e.class}: #{e.}" if config.success_path.exist? execute :notify else Stonith.logger.error "No successful check against master yet. Not notifying." end else config.success_path.open('w') {} end exit end |