Mail Notifications » History » Version 9
Jason Berry, 03/12/2014 08:38 PM
| 1 | 1 | Ohad Levy | h1. Summarized E-Mail Reports |
|---|---|---|---|
| 2 | |||
| 3 | h2. Overview |
||
| 4 | |||
| 5 | 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 | Ohad Levy | this information will include: List of hosts that had errors or that have performed any action through puppet. |
| 8 | additionally, it would include a list of all of your hosts which didn't run Puppet recently (defaults to 30 minutes). |
||
| 9 | |||
| 10 | h2. Configuration |
||
| 11 | |||
| 12 | 9 | Jason Berry | _*Due to the environment settings needed to run the foreman rake tasks, it is recommended to run them with "foreman-rake", rather then calling rake directly._ |
| 13 | |||
| 14 | 2 | Ohad Levy | First, make sure that you enable emails in Foreman - at the [[Email configuration]] page. |
| 15 | |||
| 16 | Secondly, you would need to setup a cron job: |
||
| 17 | 1 | Ohad Levy | |
| 18 | Available options: |
||
| 19 | * days => number of days to scan backwards (defaults to 1) |
||
| 20 | * hours => number of hours to scan backwards (defaults to disabled) |
||
| 21 | |||
| 22 | 7 | Ohad Levy | Example (switch to foreman dir and type): |
| 23 | 1 | Ohad Levy | |
| 24 | <pre> |
||
| 25 | 9 | Jason Berry | foreman-rake reports:summarize days=3 RAILS_ENV="production" # Sends out a summary email for the last 3 days. |
| 26 | 1 | Ohad Levy | </pre> |
| 27 | or |
||
| 28 | <pre> |
||
| 29 | 9 | Jason Berry | foreman-rake reports:summarize hours=12 RAILS_ENV="production" # Sends out a summary email for the last 12 hours. |
| 30 | 1 | Ohad Levy | </pre> |
| 31 | |||
| 32 | h3. Recipients |
||
| 33 | |||
| 34 | 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: |
||
| 35 | <pre> |
||
| 36 | 3 | Ohad Levy | #Foreman host, required for http links inside emails |
| 37 | :foreman_url: foreman.domain |
||
| 38 | 1 | Ohad Levy | # where do send out daily report emails, comment out if you want to send to registered Foreman users instead. |
| 39 | :administrator: ohadlevy@gmail.com |
||
| 40 | </pre> |
||
| 41 | 4 | Ohad Levy | |
| 42 | h1. Emails on Report errors |
||
| 43 | |||
| 44 | Similar to tagmail, foreman can send you notifications once a report which contains an error has been received. |
||
| 45 | |||
| 46 | 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. |
| 47 | 4 | Ohad Levy | |
| 48 | 8 | Adam Denning | in order to enable please make sure the following two lines exists in your *config/settings.yaml* file: |
| 49 | 4 | Ohad Levy | <pre> |
| 50 | :administrator: <email address of recipient> |
||
| 51 | :failed_report_email_notification: true |
||
| 52 | 1 | Ohad Levy | </pre> |
| 53 | 8 | Adam Denning | |
| 54 | In newer versions of Foreman, these settings should be configured within the web application (More > Settings) rather than settings.yaml. |
||
| 55 | |||
| 56 | Multiple comma-delimited addresses may be used. |
||
| 57 | 6 | Raffael Schmid | |
| 58 | *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. |