<% page_title "#{h(@check)} on #{h(@entity)}" %> <% check_path_escaped = u(@entity) << '/' << u(@check) current_time = Time.now %>
<% state_qualifier = @check_enabled ? '' : "DISABLED. Last " state_class = case @check_state when 'ok' 'success' when 'warning' 'warning' when 'critical' 'danger' else "info #{@check_state}" end %>
<%= state_qualifier %>State: <%= @check_state ? h(@check_state.upcase) : '' %>
<% if !@current_scheduled_maintenance and !@current_unscheduled_maintenance and !(['warning', 'critical', 'unknown'].include?(@check_state)) %>

Not in scheduled or unscheduled maintenance.

<% end %> <% if @current_unscheduled_maintenance %>

Acknowledged

<% ack_msg = @current_unscheduled_maintenance[:summary] ack_msg ||= 'No summary given' %> <%= h(ack_msg) %>

<% start = Time.at(@current_unscheduled_maintenance[:start_time]).to_s %> <%= h(start) %>

<% finish = Time.at(@current_unscheduled_maintenance[:start_time] + @current_unscheduled_maintenance[:duration]) %> <%= h(finish) %>

<% remaining = time_period_in_words( (finish - current_time).ceil ) %> <%= h(remaining) %>

<% end %> <% if (['warning', 'critical', 'unknown'].include?(@check_state) and !@current_scheduled_maintenance) %>
<% action = @current_unscheduled_maintenance ? "Re-acknowledge" : "Acknowledge" %>

<%= action %> alert

e.g. "5 hours"
<% end %> <% if @current_scheduled_maintenance %>
Reason
<% maint_msg = "#{@current_scheduled_maintenance[:summary]}" maint_msg = maint_msg.length > 0 ? maint_msg : 'No summary given' %> <%= h maint_msg %>
Started
<% start = Time.at(@current_scheduled_maintenance[:start_time]).to_s %> <%= h(start) %>
Finishing
<% finish = Time.at(@current_scheduled_maintenance[:start_time] + @current_scheduled_maintenance[:duration]) %> <%= h(finish) %>
Remaining
<% remaining = time_period_in_words( (finish - current_time).ceil ) %> <%= h(remaining) %>
<% end %>

Output: <%= h @check_summary %>

<%= h @check_details %>

<% [:critical, :warning, :unknown, :recovery, :acknowledgement].each do |type| %> <% end %>
Last state change: <%= h relative_time_ago(Time.at(@check_last_change.to_i)) %> ago <%= h Time.at(@check_last_change.to_i).to_s %>  
Last update: <%= h relative_time_ago(Time.at(@check_last_update.to_i)) %> ago <%= h Time.at(@check_last_update.to_i).to_s %>  
Last <%= h type.to_s %> notification: <%= @last_notifications[type] ? h(@last_notifications[type][:relative]) : 'never' %> <%= @last_notifications[type] ? h(@last_notifications[type][:time].to_s) : ' ' %> <%= @last_notifications[type] ? h(@last_notifications[type][:summary]) : ' ' %>

Recent state changes

<% if @state_changes && !@state_changes.empty? %> <% @state_changes.each do |state_change| %> <% end %>
Timestamp State Summary
<%= h Time.at(state_change[:timestamp]).to_s %> <%= h state_change[:state] %> <%= h state_change[:summary] %>
<% else %>

No state changes recorded for this check.

<% end %>

Scheduled Maintenance Periods

<% if @scheduled_maintenances && !@scheduled_maintenances.empty? %> <% @scheduled_maintenances.sort_by {|s| s[:start_time]}.each do |scheduled_maintenance| %> <% start_time = scheduled_maintenance[:start_time] end_time = scheduled_maintenance[:end_time] duration = scheduled_maintenance[:duration] summary = scheduled_maintenance[:summary] %>
Start End Duration Summary Actions
<%= h Time.at(start_time).to_s %> <%= h Time.at(end_time).to_s %> <%= h(ChronicDuration.output(duration, :keep_zero => true) || '0 secs') %> <%= h summary %> <% if end_time > current_time.to_i %> <% label = (start_time > current_time.to_i) ? 'Delete' : 'End Now' %>
<% else %>   <% end %>
<% end %> <% else %>

No maintenance is scheduled

<% end %>

Add Scheduled Maintenance

e.g. "today 4pm", "two hours hence", "friday 2pm", "2012-01-28 13:00"
e.g. "1 hour", "2:30:00", "three days", etc
Times given will be interpreted in the local timezone of <%= h(local_timezone) %>

Contacts

<% if @contacts && !@contacts.empty? %> <% @contacts.sort_by {|c| [c.first_name, c.last_name] }.each do |contact| %> <% end %>
Name Media
<%= h contact.name %> <% if contact.media && !contact.media.empty? %>

<%= h contact.media.keys.collect(&:capitalize).join(", ") %>

<% else %>

No media

<% end %>
<% else %>

There are no contacts associated with this check.

<% end %>

Zone of Surprise

<% if @check_enabled %>

Decommission check

Hide the check from the Flapjack web interface. Use this if you are no longer actively running this check.

Flapjack will automatically re-commission this check if it receives another event for it.

<% else %>

This check has been decommissioned.

Flapjack will re-commission this check if it receives another event for it.

<% end %>