Class: Nagios::Runner
- Inherits:
-
Object
- Object
- Nagios::Runner
- Defined in:
- lib/nagios_helper/runner.rb
Direct Known Subclasses
Class Method Summary collapse
-
.check(params = {}) ⇒ Object
synchrony check, for manual call.
Instance Method Summary collapse
-
#initialize(params, &callback) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(params, &callback) ⇒ Runner
Returns a new instance of Runner.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nagios_helper/runner.rb', line 3 def initialize(params, &callback) @params = params.with_indifferent_access @callback = callback @method = @params.delete(:method).to_s @method = @method.gsub(/[^_\.\-a-z0-9]/i, '') @klass_name = "Nagios::#{@method.camelize}" raise "method should be" if @method.blank? Nagios.mutex.synchronize{ load_initializers } load_class run rescue Exception, Timeout::Error => ex Nagios.logger.info "T= #{params.inspect} #{ex.} (#{ex.backtrace.inspect})" callback[ Nagios::Check.default_error(ex.) ] end |
Class Method Details
.check(params = {}) ⇒ Object
synchrony check, for manual call
22 23 24 25 26 27 28 29 30 |
# File 'lib/nagios_helper/runner.rb', line 22 def self.check(params = {}) result = nil self.new(params) do |res| result = res end result end |