Puppet Reports

Version 19 (Florian Koch, 12/08/2011 01:02 am)

1 2 Ohad Levy
h1. Puppet Reports integration 
2 2 Ohad Levy
3 14 Ohad Levy
*Note* You need Foreman 0.1-1 or newer to support Puppet Reports and the puppet version installed on your foreman host should match the version on your master.
4 1
5 2 Ohad Levy
h2. Overview
6 1
7 1
Foreman uses a custom puppet reports (similar to tagmail or store) which simply upload the puppet report to Foreman.
8 8 Ohad Levy
This enables you to see the reports through the web interface as soon as the client finish its run.
9 12 Ohad Levy
10 2 Ohad Levy
h2. Configuration
11 1
12 3 Ohad Levy
h3. client
13 3 Ohad Levy
14 3 Ohad Levy
Ensure that the puppet clients has the following option in their puppet.conf:
15 3 Ohad Levy
<pre>
16 3 Ohad Levy
report = true
17 3 Ohad Levy
</pre>
18 3 Ohad Levy
19 3 Ohad Levy
Without it, no reports will be sent.
20 3 Ohad Levy
21 3 Ohad Levy
h3. puppetmaster
22 3 Ohad Levy
23 15 Alexander Rusa
# copy *extras/puppet/foreman/files/foreman-report.rb* to your report directory
24 15 Alexander Rusa
# e.g. /usr/lib/ruby/1.8/puppet/reports/foreman.rb or /var/lib/gems/1.8/gems/puppet-2.6.4/lib/puppet/reports/foreman.rb
25 15 Alexander Rusa
# make sure you copied the foreman-report.rb to *foreman.rb* so puppet can find it!
26 1
# open the new file with your favorite editor
27 1
# edit the URL (unless you have a DNS alias for foreman already) to point to foreman.
28 11 Ohad Levy
# add this report in your puppetmaster reports - e.g, in your master puppet.conf under the main section add:
29 3 Ohad Levy
30 3 Ohad Levy
<pre>reports=log, foreman</pre>
31 3 Ohad Levy
32 3 Ohad Levy
and restart your puppetmaster
33 1
34 1
You should start seeing reports coming in under the reports link.
35 1
36 7 Ohad Levy
h2. Expire Reports automatically
37 7 Ohad Levy
 
38 7 Ohad Levy
You would probably want to delete your reports after some time, in order to do so, you would need to set a cronjob:
39 7 Ohad Levy
40 7 Ohad Levy
Available conditions:
41 7 Ohad Levy
* days => number of days to keep reports (defaults to 7)
42 7 Ohad Levy
* status => status of the report (defaults to 0 --> "reports with no errors")
43 7 Ohad Levy
 
44 7 Ohad Levy
Example:
45 7 Ohad Levy
# Expires all reports regardless of their status
46 7 Ohad Levy
<pre>
47 18 khomkrit viangvises
rake reports:expire days=7 RAILS_ENV="production"
48 7 Ohad Levy
</pre> 
49 7 Ohad Levy
# expires all non interesting reports after one day
50 7 Ohad Levy
<pre>
51 19 Florian Koch
rake reports:expire days=1 status=0 RAILS_ENV="production"
52 9 Ohad Levy
</pre>