Class: Nagios::NagiosFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/project/features/support/nagios.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, step_mother, options = {}) ⇒ NagiosFormatter

Returns a new instance of NagiosFormatter.



6
7
8
9
# File 'lib/generators/project/features/support/nagios.rb', line 6

def initialize(io, step_mother, options={})
  @failed = []
  @passed = []
end

Instance Method Details

#scenario_executed(scenario) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/project/features/support/nagios.rb', line 19

def scenario_executed(scenario)
  @total = @failed.size + @passed.size
  message = ""
  message += "Critical: #{@failed.size}, "
  message += "Warning: 0, "
  message += "#{@passed.size} okay"
  # nagios performance data
  message += " | passed=#{@passed.size}"
  message += ", failed=#{@failed.size}, total=#{@total}"
  puts message
end

#step_failed(step, name, params) ⇒ Object



15
16
17
# File 'lib/generators/project/features/support/nagios.rb', line 15

def step_failed(step, name, params)
  @failed << step
end

#step_passed(step, name, params) ⇒ Object



11
12
13
# File 'lib/generators/project/features/support/nagios.rb', line 11

def step_passed(step, name, params)
  @passed << step
end