Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add mail_alerts attribute #10

Merged
merged 1 commit into from

2 participants

@fixlr

Allows mail alerts to be disabled in the monitrc template by setting node[:monit][:mail_alerts] to false. Defaults to true so that existing chef-monit cookbook users will not be affected.

@phlipper
Owner

@fixlr thank you for this! Would you please add a note to the README about the new attribute before I merge this? Thanks!

@fixlr fixlr Add mail_alerts attribute
Allows mail alerts to be disabled in the monitrc template.
5ef384a
@fixlr

@phlipper Ooops, there ya go. Had it right here, uncommitted, the entire time. :blush:

@phlipper
Owner

@fixlr thank you very much!

@phlipper phlipper merged commit f79e3ed into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2013
  1. @fixlr

    Add mail_alerts attribute

    fixlr authored
    Allows mail alerts to be disabled in the monitrc template.
This page is out of date. Refresh to see the latest.
View
3  README.md
@@ -60,6 +60,9 @@ default["monit"]["use_syslog"] = true
# If not using syslog, the log file that monit will use.
default["monit"]["logfile"] = "/var/log/monit.log"
+# Enable emails for internal monit alerts
+default["monit"]["mail_alerts"] = true
+
# Email address that will be notified of events.
default["monit"]["alert_email"] = "root@localhost"
View
3  attributes/default.rb
@@ -17,6 +17,9 @@
# If not using syslog, the log file that monit will use.
default["monit"]["logfile"] = "/var/log/monit.log"
+# Enable emails for internal monit alerts
+default["monit"]["mail_alerts"] = true
+
# Email address that will be notified of events.
default["monit"]["alert_email"] = "root@localhost"
View
3  templates/default/monitrc.erb
@@ -8,8 +8,11 @@ set logfile syslog facility log_daemon
set logfile <%= node["monit"]["logfile"] %>
<% end %>
+<% if node['monit']['mail_alerts'] %>
# Mail alerts
set alert <%= node["monit"]["alert_email"] %>
+<% end %>
+
set mailserver <%= node["monit"]["mail"]["hostname"] %> port <%= node["monit"]["mail"]["port"] %>
<% if node["monit"]["mail"]["username"] -%>
username "<%= node["monit"]["mail"]["username"] %>"
Something went wrong with that request. Please try again.