Mail Notifications

Version 7 (Ohad Levy, 01/25/2012 07:46 am)

1 1
h1. Summarized E-Mail Reports
2 1
3 1
h2. Overview
4 1
5 1
Starting in version 0-1.3 Foreman can send a hourly / daily email report containing information about your nodes.
6 2 Ohad Levy
7 1
this information will include: List of hosts that had errors or that have performed any action through puppet.
8 1
additionally, it would include a list of all of your hosts which didn't run Puppet recently (defaults to 30 minutes).
9 1
10 1
h2. Configuration
11 1
12 2 Ohad Levy
First, make sure that you enable emails in Foreman - at the [[Email configuration]] page.
13 2 Ohad Levy
14 2 Ohad Levy
Secondly, you would need to setup a cron job:
15 1
   
16 1
Available options:
17 1
 * days     => number of days to scan backwards (defaults to 1)
18 1
 * hours    => number of hours to scan backwards (defaults to disabled)
19 1
    
20 7 Ohad Levy
Example (switch to foreman dir and type):
21 7 Ohad Levy
22 1
<pre>
23 1
  rake reports:summarize days=3 RAILS_ENV="production" # Sends out a summary email for the last 3 days.
24 1
</pre>
25 1
or
26 1
<pre>
27 1
  rake reports:summarize hours=12 RAILS_ENV="production" # Sends out a summary email for the last 12 hours.
28 1
</pre>
29 1
30 1
h3. Recipients 
31 1
32 1
If you are using LDAP authentication, Foreman will send the reports directly to all registered users, if that's not what you would like, add the following line to your *config/settings.yaml* file:
33 1
<pre>
34 3 Ohad Levy
#Foreman host, required for http links inside emails
35 3 Ohad Levy
:foreman_url: foreman.domain
36 1
# where do send out daily report emails, comment out if you want to send to registered Foreman users instead.
37 1
:administrator: ohadlevy@gmail.com
38 1
</pre>
39 4 Ohad Levy
40 4 Ohad Levy
h1. Emails on Report errors
41 4 Ohad Levy
42 4 Ohad Levy
Similar to tagmail, foreman can send you notifications once a report which contains an error has been received.
43 4 Ohad Levy
44 5 Alexander Rusa
at this point of time, the report would be sent to a mailbox predefined in config/settings.yaml, however in future versions, the report would be sent only to the relevant user (or user group) which manage the host.
45 4 Ohad Levy
46 5 Alexander Rusa
in order to enable please make sure the following two lines exists in your '''config/settings.yaml''' file:
47 4 Ohad Levy
<pre>
48 4 Ohad Levy
:administrator: <email address of recipient> 
49 4 Ohad Levy
:failed_report_email_notification: true
50 4 Ohad Levy
</pre>
51 6 Raffael Schmid
52 6 Raffael Schmid
*Please note:* Foreman will not send notifications for reports which where generated by a puppet client < 2.6.5 and creating the catalog failed on the puppet master.