Class: Procmon::ProcessConditions::ProcessHealth
- Inherits:
-
ProcessCondition
- Object
- ProcessCondition
- Procmon::ProcessConditions::ProcessHealth
- Defined in:
- lib/procmon/process_conditions/process_health.rb
Instance Attribute Summary
Attributes inherited from ProcessCondition
Instance Method Summary collapse
- #check(value) ⇒ Object
- #description ⇒ Object
-
#initialize(options = {}) ⇒ ProcessHealth
constructor
A new instance of ProcessHealth.
- #run(pid) ⇒ Object
Methods inherited from ProcessCondition
Constructor Details
#initialize(options = {}) ⇒ ProcessHealth
Returns a new instance of ProcessHealth.
4 5 6 7 8 9 10 |
# File 'lib/procmon/process_conditions/process_health.rb', line 4 def initialize( = {}) super() @status = [:status] if @status != "up" and @status != "down" raise "Don't know what to do for process_health check. You need to specify :status => \"down\" or :status => \"up\"" end end |
Instance Method Details
#check(value) ⇒ Object
17 18 19 |
# File 'lib/procmon/process_conditions/process_health.rb', line 17 def check(value) !(value ^ (@status == "up")) end |
#description ⇒ Object
21 22 23 |
# File 'lib/procmon/process_conditions/process_health.rb', line 21 def description "Checking to see if is_up = #{@is_up}" end |
#run(pid) ⇒ Object
12 13 14 15 |
# File 'lib/procmon/process_conditions/process_health.rb', line 12 def run(pid) return false if pid.nil? System.pid_alive?(pid) end |