Sha256: 3e8fb7bf73b533b54f12251017bf2cb99db8ad6e80fc977d23990b144a48c3de

Contents?: true

Size: 950 Bytes

Versions: 1

Compression:

Stored size: 950 Bytes

Contents

<%
  state_counts = @rollup_alerts.inject({}) do |memo, alert|
    memo[alert[1]['state']] = (memo[alert[1]['state']] || 0) + 1
    memo
  end

  states_summary = ['critical', 'warning', 'unknown'].inject([]) do |memo, state|
    next memo unless state_counts[state]
    memo << "#{state.titleize}: #{state_counts[state]}"
    memo
  end.join(', ')

  states_detail = ['critical', 'warning', 'unknown'].inject([]) do |memo, state|

    alerts = @rollup_alerts.find_all {|alert| alert[1]['state'] == state}
    next memo if alerts.to_a.empty?

    memo << "#{state.titleize}: " + alerts.inject([]) do |ret, alert|
      entity, check = alert[0].split(':', 2)
      ret << "'#{check}' on #{entity}"
      ret
    end.join(', ')

    memo
  end.join('; ')

-%>
<% case @rollup -%>
<% when "problem" -%>
<%=  "Problem summary: " -%>
<% when "recovery" -%>
<%=  "Problem summaries finishing: " -%>
<% end -%>
<%= states_summary %> (<%= states_detail -%>)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flapjack-0.7.28 lib/flapjack/gateways/sms_messagenet/rollup.text.erb