Puppet Reports

Version 12 (Ohad Levy, 06/02/2010 05:57 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 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 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
24 1
# open the new file with your favorite editor
25 1
# edit the URL (unless you have a DNS alias for foreman already) to point to foreman.
26 11 Ohad Levy
# add this report in your puppetmaster reports - e.g, in your master puppet.conf under the main section add:
27 3 Ohad Levy
28 3 Ohad Levy
<pre>reports=log, foreman</pre>
29 3 Ohad Levy
30 3 Ohad Levy
and restart your puppetmaster
31 1
32 1
You should start seeing reports coming in under the reports link.
33 1
34 7 Ohad Levy
h2. Expire Reports automatically
35 7 Ohad Levy
 
36 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:
37 7 Ohad Levy
38 7 Ohad Levy
Available conditions:
39 7 Ohad Levy
* days => number of days to keep reports (defaults to 7)
40 7 Ohad Levy
* status => status of the report (defaults to 0 --> "reports with no errors")
41 7 Ohad Levy
 
42 7 Ohad Levy
Example:
43 7 Ohad Levy
# Expires all reports regardless of their status
44 7 Ohad Levy
<pre>
45 7 Ohad Levy
rake reports:expire days=7 RAILS_ENV="production"
46 7 Ohad Levy
</pre> 
47 7 Ohad Levy
# expires all non interesting reports after one day
48 7 Ohad Levy
<pre>
49 7 Ohad Levy
rake reports:expire days=1 status=0 RAILS_ENV="production"
50 7 Ohad Levy
</pre> 
51 7 Ohad Levy
52 1
h2. Todo:
53 1
54 1
# Associate Users with Hosts, this will allow to send notifications (e.g. email) to the right users
55 9 Ohad Levy
# -Send out a summary of all of yours hosts status per day- done see [[Summarized E-Mail Reports]]