Class: Pandur::Check
Instance Method Summary collapse
- #check(ssh) ⇒ Object
-
#initialize(target) ⇒ Check
constructor
A new instance of Check.
Methods included from Config
#config, #load_config, #logger
Constructor Details
#initialize(target) ⇒ Check
Returns a new instance of Check.
5 6 7 |
# File 'lib/pandur/check.rb', line 5 def initialize(target) @config = target end |
Instance Method Details
#check(ssh) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pandur/check.rb', line 9 def check(ssh) logger.debug("Checking #{@config['name']}") if @config['pid_file'] print "Checking #{@config['name']}: " escaped_pid_file = @config['pid_file'].gsub('\'', '\\\'') if(ssh_exec!(ssh, "test -r '#{escaped_pid_file}' && test -n '`ps -ef | grep -v grep | grep \`cat '#{escaped_pid_file}'\``'")[2] > 0) puts "FAIL" else puts "OK" end else logger.debug("cannot check #{@config.inspect}") end end |