diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index c8f1cd6..1690a23 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -18,7 +18,8 @@ class DashboardController < ApplicationController @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 diff --git a/app/models/report.rb b/app/models/report.rb index 9b62a1a..80b824f 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -150,7 +150,7 @@ class Report < ActiveRecord::Base 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 diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 5a8d451..e788c76 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -10,7 +10,7 @@ <%= 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") -%>

Summary