Commit 8414a269 authored by Micah Anderson's avatar Micah Anderson
Browse files

Add the ability to set if the httpd server is going to be enabled or not

through setting the variable $monit_enable_httpd to either 'yes', or 'no'

The default is to set it to 'no', which keeps the httpd server from
being started
parent 1657566a
......@@ -4,7 +4,22 @@
# used from other classes and modules.
#
# Stig Sandbeck Mathisen <ssm@fnord.no>
# micah@riseup.net
#
# To set any of the following, simply set them as variables in your manifests
# before the class is included, for example:
#
# $monit_enable_httpd = yes
# include monit
#
# The following is a list of the currently available variables:
#
# monit_enable_httpd: should the httpd daemon be enabled?
# set this to 'yes' to enable it, be sure
# you have set the $monit_default_secret
# Valid values: yes or no
# Default: no
class monit {
......@@ -16,6 +31,10 @@ class monit {
# variable "$monit_alert" in your node specification.
$monit_default_alert="root@localhost"
# Should the httpd daemon be enabled, or not? By default it is not
case $monit_enable_httpd {
'': { $monit_enable_httpd = 'no' }
}
# The package
package { "monit":
ensure => installed,
......
......@@ -3,6 +3,19 @@
# This file is handled by puppet, any local changes will be lost
#
<%# BEGIN functions %>
<%
def monit_set_alert
if defined?(monit_alert)
return monit_alert
else
return monit_default_alert
end
end
%>
<%# END functions %>
<%- if monit_enable_httpd.to_s == 'yes' then -%>
<%# BEGIN functions %>
<%
require 'digest/sha1'
......@@ -16,18 +29,8 @@ def password
return Digest::SHA1.hexdigest(s + Digest::SHA1.hexdigest(s + fqdn))
end
def monit_set_alert
if defined?(monit_alert)
return monit_alert
else
return monit_default_alert
end
end
%>
<%# END functions %>
set daemon 120
set logfile syslog facility log_daemon
set mailserver localhost
......@@ -35,6 +38,7 @@ set alert <%= monit_set_alert %>
set httpd port 2812 and use address localhost
allow localhost
allow monit:<%= password %>
<%- end -%>
# Include settings from other files
include /etc/monit/conf.d/*.monitrc
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment