Puppet Reports

Version 10 (Ohad Levy, 04/12/2010 09:56 am)

1 2 Ohad Levy
h1. Puppet Reports integration 
2 2 Ohad Levy
3 5 Ohad Levy
*Note* You need Foreman 0.1-1 or newer to support Puppet Reports.
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 2 Ohad Levy
h2. Configuration
10 1
11 3 Ohad Levy
h3. client
12 3 Ohad Levy
13 3 Ohad Levy
Ensure that the puppet clients has the following option in their puppet.conf:
14 3 Ohad Levy
<pre>
15 3 Ohad Levy
report = true
16 3 Ohad Levy
</pre>
17 3 Ohad Levy
18 3 Ohad Levy
Without it, no reports will be sent.
19 3 Ohad Levy
20 3 Ohad Levy
h3. puppetmaster
21 3 Ohad Levy
22 6 Ohad Levy
# copy *extras/puppet/foreman/files/foreman-report.rb* to your report directory - e.g. /usr/lib/ruby/1.8/puppet/reports/foreman.rb
23 1
# open the new file with your favorite editor
24 1
# edit the URL (unless you have a DNS alias for foreman already) to point to foreman.
25 10 Ohad Levy
# add this report in your puppetmaster reports - e.g, in your master puppet.conf under the puppetmaster section add:
26 3 Ohad Levy
27 3 Ohad Levy
<pre>reports=log, foreman</pre>
28 3 Ohad Levy
29 3 Ohad Levy
and restart your puppetmaster
30 1
31 1
You should start seeing reports coming in under the reports link.
32 1
33 7 Ohad Levy
h2. Expire Reports automatically
34 7 Ohad Levy
 
35 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:
36 7 Ohad Levy
37 7 Ohad Levy
Available conditions:
38 7 Ohad Levy
* days => number of days to keep reports (defaults to 7)
39 7 Ohad Levy
* status => status of the report (defaults to 0 --> "reports with no errors")
40 7 Ohad Levy
 
41 7 Ohad Levy
Example:
42 7 Ohad Levy
# Expires all reports regardless of their status
43 7 Ohad Levy
<pre>
44 7 Ohad Levy
rake reports:expire days=7 RAILS_ENV="production"
45 7 Ohad Levy
</pre> 
46 7 Ohad Levy
# expires all non interesting reports after one day
47 7 Ohad Levy
<pre>
48 7 Ohad Levy
rake reports:expire days=1 status=0 RAILS_ENV="production"
49 7 Ohad Levy
</pre> 
50 7 Ohad Levy
51 1
h2. Todo:
52 1
53 1
# Associate Users with Hosts, this will allow to send notifications (e.g. email) to the right users
54 9 Ohad Levy
# -Send out a summary of all of yours hosts status per day- done see [[Summarized E-Mail Reports]]