Skip to content

Commit

Permalink
Use attributes to configure http settings in monitrc.
Browse files Browse the repository at this point in the history
  • Loading branch information
xdissent committed Oct 31, 2012
1 parent 94f1879 commit 9a5249a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions attributes/default.rb
Expand Up @@ -16,3 +16,9 @@
default[:monit][:mailserver][:username] = nil
default[:monit][:mailserver][:password] = nil
default[:monit][:mailserver][:password_suffix] = nil

default[:monit][:port] = 3737
default[:monit][:address] = "localhost"
default[:monit][:ssl] = false
default[:monit][:cert] = "/etc/monit/monit.pem"
default[:monit][:allow] = ["localhost"]
12 changes: 9 additions & 3 deletions templates/default/monitrc.erb
Expand Up @@ -25,9 +25,15 @@ set mail-format {

set alert <%= @node[:monit][:notify_email] %> NOT ON { action, instance, pid, ppid }

set httpd port 3737 and
use address localhost
allow localhost
set httpd port <%= node[:monit][:port] %>
<%= "use address #{node[:monit][:address]}" if node[:monit][:address] %>
<% node[:monit][:allow].each do |a| %>
allow <%= "#{a}" %>
<% end %>
<% if node[:monit][:ssl] %>
ssl enable
pemfile <%= node[:monit][:cert] %>
<% end %>

include /etc/monit/conf.d/*.conf

0 comments on commit 9a5249a

Please sign in to comment.