<% nav = render_erb('_nav.html.erb', binding) %> <% head = render_erb('_head.html.erb', binding) %> <% foot = render_erb('_foot.html.erb', binding) %> <% check_path_escaped = u(@entity) << '/' << u(@check) %> <% current_time = Time.now %> Flapjack - Check: <%= h @entity %>:<%= h @check %> <%= head %>
<% state_qualifier = @check_enabled ? '' : "DISABLED. Last " %>

<%= state_qualifier %>State: <%= @check_state ? h(@check_state.upcase) : '' %>

<% if (['warning', 'critical', 'unknown'].include?(@check_state) and !@current_scheduled_maintenance) %>
with e.g. "5 hours"
<% end %> <% if @current_unscheduled_maintenance %>

(Acknowledged - <%= h @current_unscheduled_maintenance[:summary] %>)

<% start = Time.at(@current_unscheduled_maintenance[:start_time]) %> <% finish = Time.at(@current_unscheduled_maintenance[:start_time] + @current_unscheduled_maintenance[:duration]) %> <% remain = time_period_in_words( (finish - current_time).ceil ) %>

<%= h start.to_s %> -> <%= h finish.to_s %> (<%= h remain %> remaining)

<% end %> <% if @current_scheduled_maintenance %>

(Scheduled Maintenance - <%= h @current_scheduled_maintenance[:summary] %>

<% start = Time.at(@current_scheduled_maintenance[:start_time]) %> <% finish = Time.at(@current_scheduled_maintenance[:start_time] + @current_scheduled_maintenance[:duration]) %> <% remain = time_period_in_words( (finish - current_time).ceil ) %>

<%= h start.to_s %> -> <%= h finish.to_s %> (<%= h remain %> 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]) : ' ' %>
<% if @check_enabled %> Enabled ...
<% else %> Disabled <% 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] %> <% end %>
Start End Duration Summary Actions
<%= h Time.at(start_time).to_s %> <%= h Time.at(end_time).to_s %> <%= h ChronicDuration.output(duration) %> <%= h summary %> <% if end_time > current_time.to_i %> <% label = (start_time > current_time.to_i) ? 'Delete' : 'End Now' %>
<% else %>   <% 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 %>

<% if @state_changes && !@state_changes.empty? %>

Recent state changes

<% @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] %>
<% end %>

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 %>

No contacts

<% end %>