Class: Battlestation::Operations::ProcessCheck

Inherits:
Base
  • Object
show all
Defined in:
lib/battlestation/operations/process_check.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#name, #opts, #type

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

#initialize(identifier, opts = {}) ⇒ ProcessCheck

Returns a new instance of ProcessCheck.



6
7
8
9
10
11
# File 'lib/battlestation/operations/process_check.rb', line 6

def initialize(identifier, opts = {})
  @identifier = identifier
  @type       = :process
  @name       = "process-#{identifier}"
  @opts       = opts
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



4
5
6
# File 'lib/battlestation/operations/process_check.rb', line 4

def identifier
  @identifier
end

Instance Method Details

#statusObject



13
14
15
16
17
18
19
# File 'lib/battlestation/operations/process_check.rb', line 13

def status
  if process_running?
    { status: :okay, msg: "#{identifier} up and running", name: name }
  else
    { status: opts[:force_failure] ? :fail : :warn, msg: "#{identifier} not running", resolution: opts[:resolution], name: name }
  end
end