Class: WatchmonkeyCli::Checkers::UnixDefaults
- Inherits:
-
WatchmonkeyCli::Checker
- Object
- WatchmonkeyCli::Checker
- WatchmonkeyCli::Checkers::UnixDefaults
- Defined in:
- lib/watchmonkey_cli/checkers/unix_defaults.rb
Instance Attribute Summary
Attributes inherited from WatchmonkeyCli::Checker
Instance Method Summary collapse
Methods inherited from WatchmonkeyCli::Checker
#_tolog, checker_name, checker_name=, #debug, descendants, #error, #info, inherited, #init, #initialize, #local, #rsafe, #safe, #spawn_sub, #start, #stop
Constructor Details
This class inherits a constructor from WatchmonkeyCli::Checker
Instance Method Details
#check!(result, host, opts = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/watchmonkey_cli/checkers/unix_defaults.rb', line 29 def check! result, host, opts = {} [:unix_load, :unix_memory, :unix_df, :unix_mdadm].each do |which| # if opts[which] && sec = app.checkers[which.to_s] # sec.check!(result, host, opts[which]) # end # app.enqueue_sub(self, which, host, opts[which]) if opts[which] spawn_sub(which, host, opts[which].is_a?(Hash) ? opts[which] : {}) end end |
#enqueue(host, opts = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/watchmonkey_cli/checkers/unix_defaults.rb', line 6 def enqueue host, opts = {} return if app.running? # we only ever want to run this once to spawn sub checkers opts = { unix_load: {}, unix_memory: {}, unix_df: {}, unix_mdadm: {} }.merge(opts) host = app.fetch_connection(:loopback, :local) if !host || host == :local host = app.fetch_connection(:ssh, host) if host.is_a?(Symbol) # option shortcuts opts[:unix_load][:limits] = opts[:load] if opts[:load] opts[:unix_load] = false if opts[:load] == false opts[:unix_memory][:min_percent] = opts[:memory_min] if opts[:memory_min] opts[:unix_memory] = false if opts[:memory_min] == false opts[:unix_df][:min_percent] = opts[:df_min] if opts[:df_min] opts[:unix_df] = false if opts[:df_min] == false opts[:unix_mdadm] = false if opts[:mdadm] == false opts.delete(:load) opts.delete(:memory_min) opts.delete(:df_min) opts.delete(:mdadm) app.enqueue(self, host, opts) end |