Project

General

Profile

« Previous | Next » 

Revision 4bdd27e1

Added by Ohad Levy over 14 years ago

  • ID 4bdd27e1b1993fe1afe07434e64921f812287cb5

fixes #70 - shows hosts in error state in the dashboard

View differences:

app/controllers/dashboard_controller.rb
def index
@total_hosts = Host.count
@good_hosts = Host.count(:all, :conditions => @good_reports)
@bad_hosts = Host.count(:all, :conditions => @host_conditions)
@out_of_sync_hosts = Host.count(:all, :conditions => @sync_conditions)
@intersting_reports = Report.count(:all, :conditions => @report_conditions)
end
......
@sync_conditions = ["last_report < ? or last_report is ?", time, nil]
@report_conditions = "status > 0"
@good_reports = ["last_report > ? and puppet_status = ?", time, 0]
@host_conditions = ["puppet_status > ?", 0]
end
end
app/views/dashboard/errors.html.erb
<%= render :active_scaffold => :hosts, :conditions => @host_conditions, :label => "Hosts with errors" %>
<%= link_to "Back", :back %>
app/views/dashboard/index.html.erb
<h3>Errors</h3>
<p>Out Of Sync Hosts <%= link_to @out_of_sync_hosts, :action => "OutOfSync" %></p>
<p>Hosts in Error State <%= link_to @bad_hosts, :action => "errors" %></p>
<p>Reports to Review <%= link_to @intersting_reports, :action => "reports" %></p>
</center>
<p>Total hosts <%= @total_hosts %></p>

Also available in: Unified diff