Nerdier

Adjective: Comparative form of nerdy: more nerdy.

The foreman out of sync duration.

The default out of sync duration is the puppet run duration + 5 minutes, as we run the puppet default it makes it 35 minutes. This however means that there are ~15 out of sync hosts at any time that just haven’t ran in an hour which isn’t a huge problem for us.

I wanted to change the out of sync duration to 90 minutes, so if they have missed three runs we would get notified.

My solution is as follows, and is a bit of a hack.

./app/models/host/managed.rb

scope :out_of_sync, lambda { |*args| {:conditions => ["last_report < ? and enabled != ?", (args.first || (Setting[:puppet_interval] + 60).minutes.ago), false]} }

./app/views/dashboard/_status_widget.html.erb

<%= searchable_links _('Out of sync hosts'),
                         "last_report < \"#{Setting[:puppet_interval] + 60} minutes ago\" and status.enabled = true",
                         :out_of_sync_hosts_enabled
%>

./app/controllers/hosts_controller.rb

def out_of_sync
  merge_search_filter("last_report < \"#{Setting[:puppet_interval] + 60} minutes ago\" and status.enabled = true")
  index _("Hosts which didn't run puppet in the last %s") % (view_context.time_ago_in_words((Setting[:puppet_interval]+60).minutes.ago))
end

 

Leave a Reply

Your email address will not be published. Required fields are marked *