Feature #124

Support run interval other than default 30 minutes

Added by John Warburton about 2 years ago. Updated about 2 years ago.

Status:Closed Start:12/10/2009
Priority:Normal Due date:
Assigned to:Ohad Levy % Done:

100%

Category:Puppet integeration
Target version:0.1-4
Backlog: Difficulity:
Votes: 0

Description

Our run interval is set to 1 hour rather than the puppet default of 30 minutes. It is currently hardwired in foreman rather than a global variable

This means the foreman dashboard shows servers as being out of sync half the time.

I have made changes locally to the following files but my ruby is very poor, so I really shouldn't submit a patch, but more like pseudo code:

need to define runinterval global variable - default to 30

./app/controllers/dashboard_controller.rb

<     time = Time.now.utc - 35.minutes
>     time = Time.now.utc - (@runinterval+5).minutes

./app/views/dashboard/index.html.erb

<   <p>Good Host Reports in the last 30 minutes <%= "#{@good_hosts} / #{@total_hosts}" %> hosts</p>
---
>   <p>Good Host Reports in the last <%= "#{@runinterval}" %> minutes <%= "#{@good_hosts} / #{@total_hosts}" %> hosts</p>
10,12c10,12
<   <%= graph("bar",:title => "Run Distribution in the last 30 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")
---
>   <%= graph("bar",:title => "Run Distribution in the last #{@runinterval} minutes", :data =>  @puppet_runs,
>             :line_colors => '0077CC', :bar_width_and_spacing => 20,:axis_with_labels => ["x","y"],
>             :axis_labels => [(1..(@runinterval/@interval)).map{|t| t*@interval}, @puppet_runs.sort.uniq], :legend => "Clients")

./app/models/report.rb

<       no_report       = (host.puppet_status & 0x40000000) >> 30
---
>       no_report       = (host.puppet_status & 0x40000000) >> @runinterval
99c99
<     (1..(30 / interval)).each do |i|
---
>     (1..(@runinterval / interval)).each do |i|

I can't find the code in the "Hosts" view which determines whether the "Last report" should be a green tick or red cross, but it looks time dependent too.

Thanks

John

Associated revisions

Revision e386628ada2fde87b4bad0497652c79f889a120b
Added by Ohad Levy about 2 years ago

fixes #124 - Support run interval other than default 30 minutes

History

Updated by Ohad Levy about 2 years ago

yes, this makes a lot of sense. I'll try to get it in 0-1.4

Updated by Karl Pietri about 2 years ago

the image that was mentioned is fixed by changing no_report method in app/models/host.rb

just a helpful note as i don't have a patch i just changed the hard coded value =)

Updated by Ohad Levy about 2 years ago

  • Target version set to 0.1-3

Updated by Ohad Levy about 2 years ago

  • Category changed from Dashboard to Puppet integeration
  • Status changed from New to Assigned
  • Assigned to set to Ohad Levy

Updated by Ohad Levy about 2 years ago

  • Target version changed from 0.1-3 to 0.1-4

Updated by Ohad Levy about 2 years ago

  • Status changed from Assigned to Ready For Testing
  • % Done changed from 0 to 100

Updated by Ohad Levy about 2 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF