Class: Refinery::Monitor
- Inherits:
-
Object
- Object
- Refinery::Monitor
- Includes:
- Configurable, Loggable, Queueable, Utilities
- Defined in:
- lib/refinery/monitor.rb
Overview
The monitor is responsible for monitoring the health of the various components of refinery.
Instance Method Summary collapse
-
#initialize(options) ⇒ Monitor
constructor
Initialize the monitor.
-
#run ⇒ Object
Execute the monitor.
Methods included from Utilities
#camelize, #decode_message, #encode_message, #host_info
Methods included from Queueable
Methods included from Configurable
Methods included from Loggable
Constructor Details
#initialize(options) ⇒ Monitor
Initialize the monitor.
Options:
-
:verbose
: Enable INFO level logging -
:debug
: Enable DEBUG level logging -
:config
: The config file
16 17 18 19 20 21 |
# File 'lib/refinery/monitor.rb', line 16 def initialize() logger.level = Logger::INFO if [:verbose] logger.level = Logger::DEBUG if [:debug] config.load_file([:config]) if [:config] @queue_prefix = config['prefix'] || '' end |
Instance Method Details
#run ⇒ Object
Execute the monitor. The monitor will start one heartbeat monitor thread and one thread for each done queue and error queue as specified in the configuration.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/refinery/monitor.rb', line 26 def run logger.info "Starting up monitor" heartbeat_monitor_thread = run_heartbeat_monitor done_monitor_threads = run_done_monitors error_monitor_threads = run_error_monitors logger.info "Monitor running" Refinery::StatsServer.new.run begin heartbeat_monitor_thread.join done_monitor_threads.each { |t| t.join } error_monitor_threads.each { |t| t.join } rescue Interrupt => e end logger.info "Monitor is exiting" end |