!!! 5 %html %head :css * { margin: 0; padding: 0; } html { font-size: 62.5%; } body { font-size: 16px; } div#wrapper { margin: 24px auto; width: 1000px; } h1, h2, h3, h4, h5 { font-family: Helvetica Neue, sans-serif; margin-bottom: 12px; } table { text-align: left; width: 100%; } table th { font-family: Helvetica Neue, sans-serif; background-color: #eee; } table td, table th { padding: 4px; } table td.critical { background-color: #fb9a99; } table td.down { background-color: #fb9a99; } table td.warning { background-color: #f9bb34; } table td.ok { background-color: #B2DF8A; } table td.up { background-color: #B2DF8A; } %body %div#wrapper %p %a(title='Dashboard' href='/') All Checks | %a(title='Dashboard' href='/failing') Failing Checks %h1 #{@check} on #{@entity} %form{:action => "/acknowledgements/#{@entity}/#{@check}", :method => "post"} %h2 State: #{@check_state ? @check_state.upcase : ''} - if (['warning', 'critical'].include?(@check_state) and !(@in_unscheduled_maintenance || @in_scheduled_maintenance)) %input{:type => 'hidden', :name => 'acknowledgement_id', :value => "#{@acknowledgement_id}"} %input{:type => 'submit', :value => 'Acknowledge', :class => 'button'} with %label{:for => 'summary'} summary: %input{:type => 'text', :name => 'summary', :value => ''} %label{:for => 'duration'} duration: %input{:type => 'text', :name => 'duration', :value => ''} - if @in_unscheduled_maintenance %h3 (Acknowledged) - if @in_scheduled_maintenance %h3 (Scheduled Maintenance) - if @in_unscheduled_maintenance %form{:action => "/end_unscheduled_maintenance/#{@entity}/#{@check}", :method => "post"} %p %input{:type => 'submit', :value => 'End Unscheduled Maintenance (Unacknowledge)', :class => 'button'} %h3 Output: #{@check_summary} %table %tr %td Last state change: %td #{relative_time_ago(Time.at(@check_last_change.to_i))} ago %td #{Time.at(@check_last_change.to_i)} %tr %td Last update: %td #{relative_time_ago(Time.at(@check_last_update.to_i))} ago %td #{Time.at(@check_last_update.to_i)} - if @last_notifications[:problem] - last_problem_relative = relative_time_ago(Time.at(@last_notifications[:problem])) + " ago" - last_problem = Time.at(@last_notifications[:problem]).to_s - else - last_problem_relative = 'never' - last_problem = '' %tr %td Last problem notification: %td= last_problem_relative %td= last_problem - if @last_notifications[:recovery] - last_recovery_relative = relative_time_ago(Time.at(@last_notifications[:recovery])) + " ago" - last_recovery = Time.at(@last_notifications[:recovery]).to_s - else - last_recovery_relative = 'never' - last_recovery = '' %tr %td Last recovery notification: %td= last_recovery_relative %td= last_recovery - if @last_notifications[:acknowledgement] - last_ack_relative = relative_time_ago(Time.at(@last_notifications[:acknowledgement])) + " ago" - last_ack = Time.at(@last_notifications[:acknowledgement]).to_s - else - last_ack_relative = 'never' - last_ack = '' %tr %td Last acknowledgement notification: %td= last_ack_relative %td= last_ack %h3 Scheduled Maintenance Periods - if @scheduled_maintenances && (@scheduled_maintenances.length > 0) %table %tr %th Start %th End %th Duration %th Summary %th Actions - @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] %tr %td= Time.at(start_time).to_s %td= Time.at(end_time).to_s %td= ChronicDuration.output(duration) %td= summary %td - if end_time > Time.now.to_i %form{ :action => "/scheduled_maintenances/#{@entity}/#{@check}", :method => "post"} %input{:type => 'hidden', :name => '_method', :value => 'delete'} %input{:type => 'hidden', :name => 'start_time', :value => start_time} %input{:type => 'submit', :value => 'Delete', :class => 'button'} - else %p No scheduled maintenance %h4 Add Scheduled Maintenace %form{:action => "/scheduled_maintenances/#{@entity}/#{@check}", :method => "post"} %fieldset %table %tr %td %label{:for => 'start_time'} Start time: %td %input{:type => 'text', :name => 'start_time', :class => 'text', :size => '20', :maxlength => '80'} %p uses chronic, so eg "today 4pm", "two hours hence", "friday 2pm", "2012-01-28 13:00", etc. Times are taken to be in #{local_timezone} %tr %td %label{:for => 'duration'} Duration: %td %input{:type => 'text', :name => 'duration', :class => 'text', :size => '20', :maxlength => '80'} %p uses chronic_duration, so eg "1 hour", "2:30:00", "three days", etc %tr %td %label{:for => 'summary'} Summary: %td %input{:type => 'text', :name => 'summary', :class => 'text', :size => '80', :maxlength => '160'} %tr %td %td %input{:type => 'submit', :value => 'Save', :class => 'button'}