Skipped resources in summary report

Any way to ignore skipped resources in the daily summary report? We have
every host reporting skips so the report includes every host Foreman is
managing.

Thanks,

This is a known issue - Puppet creates six default schedules by default,
and you cannot turn them off. Since very few people use schedules, Puppet
skips them, and Foreman reports that. I've been meaning to write a
pull-request to Puppetlabs to make an option for it in puppet.conf, but
haven't got to it yet :wink:

You can disable it in Puppet with a oneline patch to schedules.rb. In
Puppet 3.1 its:

— lib/puppet/type/schedule.rb.orig 2013-02-14 16:04:31.322672059 +0000
+++ lib/puppet/type/schedule.rb 2013-02-14 16:04:47.019766612 +0000
@@ -421,6 +421,7 @@

 def self.mkdefaultschedules
   result = []
  •  return result
     Puppet.debug "Creating default schedules"
    
           result << self.new(
    

This will disable the schedules. How you get that fix out to all your
puppet clients is left as an excerise for the reader - I rebuilt my debs
with this patch :wink:

Hope that helps,

Greg

··· On 14 February 2013 15:42, Roger wrote:

Any way to ignore skipped resources in the daily summary report? We have
every host reporting skips so the report includes every host Foreman is
managing.

Thanks,


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

I actually have those default schedules removed. But we create our own
schedules since we don't want certain items touched during critical hours
so there are always skips anyway.

The reports section of Foreman (1.1) ignores these reports and doesn't list
them as "eventful". Was hoping to find a way to have the daily email
reports do the same.

··· On Thursday, February 14, 2013 11:06:02 AM UTC-5, Greg Sutcliffe wrote: > > On 14 February 2013 15:42, Roger <rojsp...@gmail.com > wrote: > >> Any way to ignore skipped resources in the daily summary report? We have >> every host reporting skips so the report includes every host Foreman is >> managing. >> >> Thanks, >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Foreman users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/foreman-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > This is a known issue - Puppet creates six default schedules by default, > and you cannot turn them off. Since very few people use schedules, Puppet > skips them, and Foreman reports that. I've been meaning to write a > pull-request to Puppetlabs to make an option for it in puppet.conf, but > haven't got to it yet ;) > > You can disable it in Puppet with a oneline patch to schedules.rb. In > Puppet 3.1 its: > > --- lib/puppet/type/schedule.rb.orig 2013-02-14 16:04:31.322672059 +0000 > +++ lib/puppet/type/schedule.rb 2013-02-14 16:04:47.019766612 +0000 > @@ -421,6 +421,7 @@ > > def self.mkdefaultschedules > result = [] > + return result > Puppet.debug "Creating default schedules" > > result < > This will disable the schedules. How you get that fix out to all your > puppet clients is left as an excerise for the reader - I rebuilt my debs > with this patch ;) > > Hope that helps, > > Greg >

Ah I misunderstood, sorry about that.

I don't think the rake task for the email report supports that at the
moment. Shouldn't be too hard to add though - raise a feature request, and
we can take a look :slight_smile:

··· On 14 February 2013 16:57, Roger wrote:

I actually have those default schedules removed. But we create our own
schedules since we don’t want certain items touched during critical hours
so there are always skips anyway.

The reports section of Foreman (1.1) ignores these reports and doesn’t
list them as “eventful”. Was hoping to find a way to have the daily email
reports do the same.

Request in: Feature #2210: Ignore skipped in email reports - Foreman

··· On Thursday, February 14, 2013 12:10:54 PM UTC-5, Greg Sutcliffe wrote: > > > On 14 February 2013 16:57, Roger <rojsp...@gmail.com > wrote: > >> I actually have those default schedules removed. But we create our own >> schedules since we don't want certain items touched during critical hours >> so there are always skips anyway. >> >> The reports section of Foreman (1.1) ignores these reports and doesn't >> list them as "eventful". Was hoping to find a way to have the daily email >> reports do the same. >> > > Ah I misunderstood, sorry about that. > > I don't think the rake task for the email report supports that at the > moment. Shouldn't be too hard to add though - raise a feature request, and > we can take a look :) >

I'd really like to get the daily reports useful again. Don't mind doing it
myself just that I don't quite understand the code well enough to filter
the skipped items out.

Pretty sure I found the function pulling the report data in
app/models/report.rb:

returns a hash of hosts and their recent reports metric counts which

have values

e.g. non zero metrics.

first argument is time range, everything afterwards is a host list.

TODO: improve SQL query (so its not N+1 queries)

def self.summarise(time = 1.day.ago, *hosts)
list = {}
raise ::Foreman::Exception.new(N_("invalid host list")) unless hosts
hosts.flatten.each do |host|
# set default of 0 per metric
metrics = {}
METRIC.each {|m| metrics[m] = 0 }
host.reports.recent(time).all(:select => "status").each do |r|
metrics.each_key do |m|
metrics[m] += r.status(m)
end
end
list[host.name] = {:metrics => metrics, :id => host.id} if
metrics.values.sum > 0
end
return list
end

Pretty sure adding an "unless r.something == 'skipped'" to the metrics[m]
+= r.status(m) line would do it. Just no idea what's available on the r
variable.

Anyone with better ruby skills than I have an idea?

Thank you.

··· On Thursday, February 14, 2013 1:36:11 PM UTC-5, Roger wrote: > > Request in: http://projects.theforeman.org/issues/2210 > > > On Thursday, February 14, 2013 12:10:54 PM UTC-5, Greg Sutcliffe wrote: >> >> >> On 14 February 2013 16:57, Roger wrote: >> >>> I actually have those default schedules removed. But we create our own >>> schedules since we don't want certain items touched during critical hours >>> so there are always skips anyway. >>> >>> The reports section of Foreman (1.1) ignores these reports and doesn't >>> list them as "eventful". Was hoping to find a way to have the daily email >>> reports do the same. >>> >> >> Ah I misunderstood, sorry about that. >> >> I don't think the rake task for the email report supports that at the >> moment. Shouldn't be too hard to add though - raise a feature request, and >> we can take a look :) >> >

Depending on the constraints of your production environment, it seems like
skipped schedule resources are not contained in Puppet 3.3 - so you could
test an upgrade and see if it also applies for your custom schedules.

··· On 3 October 2013 19:50, Roger wrote:

I’d really like to get the daily reports useful again. Don’t mind doing
it myself just that I don’t quite understand the code well enough to filter
the skipped items out.

OK. I tested this out.

We have a puppet 2.7 master and a 3.2 master (in the middle of migrating to
puppet 3). I upgraded the puppet 3 master to 3.3 and a few clients to 3.3.

Findings:
Default skipped resources disappeared. For a server config with no
schedules configured for it, no skips in the report.
Servers with manifests that contain explicit schedules – skips still
appear but only for resources using a schedule – so number of skips
dropped from 9 to 1.

Since resources with an explicit schedule still show up as skipped, not
really going to be a solution for us. And even for hosts that don't use
schedules, getting them upgraded to 3.3 is at least a 3 - 6 month project.
Would be much easier to get the foreman report to ignore skipped resources
as eventful.

Other annoyances:

Our puppet 3.2 master had a clean syslog. We've been cleaning up the
manifests so they are fully 3 compliant as we move hosts over to it. Now
that's it 3.3 it's littered with crap messages.

For example, a file resource like:

file {'/some/file':
ensure => file,
source => ["puppet:///modules/mymodule/file.conf.{$::hostname}",
'puppet:///modules/mymodule/file.conf'],
}

now results in a syslog entry for every catalog complilation of:

Not Found: Could not find file_metadata
modules/mymodule/file.conf.myservername

I'm sure that's a bug in puppet but that's latest bleeding edge for you.
Still works like it should but syslog is a pain to dig through.

··· On Thursday, October 3, 2013 6:07:49 PM UTC-4, Greg Sutcliffe wrote: > > On 3 October 2013 19:50, Roger <rojsp...@gmail.com > wrote: > >> I'd really like to get the daily reports useful again. Don't mind doing >> it myself just that I don't quite understand the code well enough to filter >> the skipped items out. >> > > Depending on the constraints of your production environment, it seems like > skipped schedule resources are not contained in Puppet 3.3 - so you could > test an upgrade and see if it also applies for your custom schedules. > > >

Interesting, I guess they just stopped the default ones from being
reported. I couldn;t find the exact commit which did it, so I wasn't sure.

Separating out skipped schedules from other skipper resources could be very
difficult though, do to how the reports are stored. Dropping all skipped
resources is probably doable, but then you lose some potentially relevant
information in your email.

Report#summarize is indeed a good place to modify the code, if you still
want to go down that line. Try something like "METRIC.reject { |k| k ==
"skipped" }.each …" on this line:


(disclaimer:
untested code :P)

HTH
Greg

··· On 4 October 2013 22:59, Roger wrote:

OK. I tested this out.

We have a puppet 2.7 master and a 3.2 master (in the middle of migrating
to puppet 3). I upgraded the puppet 3 master to 3.3 and a few clients to
3.3.

Findings:
Default skipped resources disappeared. For a server config with no
schedules configured for it, no skips in the report.
Servers with manifests that contain explicit schedules – skips still
appear but only for resources using a schedule – so number of skips
dropped from 9 to 1.