Project

General

Profile

Bug #192 ยป fixchart.diff

Patch - Dis Connect, 03/24/2010 01:51 PM

View differences:

app/controllers/dashboard_controller.rb
@out_of_sync_hosts = Host.out_of_sync.count
@intersting_reports = Report.with_changes.count
# the run interval to show in the dashboard graph
@puppet_runs = Report.count_puppet_runs(@interval = 3)
@interval = (SETTINGS[:puppet_interval] / 10)
@puppet_runs = Report.count_puppet_runs(@interval)
end
def errors
app/models/report.rb
def self.count_puppet_runs(interval = 5)
counter = []
now=Time.now.utc
(1..(30 / interval)).each do |i|
(1..(SETTINGS[:puppet_interval] / interval)).each do |i|
ago = now - interval.minutes
counter << Report.count(:all, :conditions => {:reported_at => ago..(now-1.second)})
now = ago
app/views/dashboard/index.html.erb
<%= graph("bar",:title => "Run Distribution in the last #{SETTINGS[:puppet_interval]} minutes", :data => @puppet_runs,
:line_colors => '0077CC', :bar_width_and_spacing => 25,:axis_with_labels => ["x","y"],
:axis_labels => [(1..(30/@interval)).map{|t| t*@interval}, @puppet_runs.sort.uniq], :legend => "Clients")
:axis_labels => [(1..(SETTINGS[:puppet_interval]/@interval)).map{|t| t*@interval}, @puppet_runs.sort.uniq], :legend => "Clients")
-%>
<h2>Summary</h2>
    (1-1/1)