From 97885f12cf3acaf66c8fe958cd7b35ca1d0c611e Mon Sep 17 00:00:00 2001 From: Riekelt Kapitein Date: Mon, 24 Oct 2016 08:36:07 +0200 Subject: [PATCH 1/2] Add configuration option for http_allow and include directive in monitrc --- manifests/init.pp | 4 ++++ manifests/params.pp | 2 ++ templates/monitrc.erb | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index c43b432..7566b4e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -7,6 +7,7 @@ $httpd_address = $monit::params::httpd_address, $httpd_user = $monit::params::httpd_user, $httpd_password = $monit::params::httpd_password, + $httpd_allow = $monit::params::httpd_allow, $manage_firewall = $monit::params::manage_firewall, $package_ensure = $monit::params::package_ensure, $package_name = $monit::params::package_name, @@ -17,6 +18,7 @@ $config_file = $monit::params::config_file, $config_dir = $monit::params::config_dir, $config_dir_purge = $monit::params::config_dir_purge, + $config_include = $monit::params::config_include, $logfile = $monit::params::logfile, $mailserver = $monit::params::mailserver, $mailformat = $monit::params::mailformat, @@ -73,6 +75,7 @@ validate_string($httpd_address) validate_string($httpd_user) validate_string($httpd_password) + validate_string($httpd_allow) validate_bool($manage_firewall_bool) validate_string($package_ensure) validate_string($package_name) @@ -106,6 +109,7 @@ validate_bool($mmonit_without_credential_bool) validate_absolute_path($config_file) validate_absolute_path($config_dir) + validate_array($config_include) validate_bool($config_dir_purge_bool) # diff --git a/manifests/params.pp b/manifests/params.pp index 7a45ff6..49e41c0 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,11 +4,13 @@ class monit::params { $check_interval = 120 $config_dir_purge = false + $config_include = [] $httpd = false $httpd_port = 2812 $httpd_address = 'localhost' $httpd_user = 'admin' $httpd_password = 'monit' + $httpd_allow = '0.0.0.0/0.0.0.0' $manage_firewall = false $package_ensure = 'present' $package_name = 'monit' diff --git a/templates/monitrc.erb b/templates/monitrc.erb index d270f52..7407c15 100644 --- a/templates/monitrc.erb +++ b/templates/monitrc.erb @@ -28,7 +28,7 @@ set eventqueue <%- if @httpd == true -%> set httpd port <%= @httpd_port %> and use address <%= @httpd_address %> - allow 0.0.0.0/0.0.0.0 + allow <%= @httpd_allow %> <%- if !@httpd_user.empty? && !@httpd_password.empty? -%> allow <%= @httpd_user %>:<%= @httpd_password %> <%- end -%> @@ -39,3 +39,7 @@ set mmonit http://<%= @mmonit_user %>:<%= @mmonit_password %>@<%= @mmonit_addres <%- end -%> include <%= @config_dir -%>/* + +<%- @config_include.each do |include| -%> +include <%= include %> +<%- end -%> From 0aaed6c40fd2214371b72a89460522838f3662b2 Mon Sep 17 00:00:00 2001 From: Riekelt Kapitein Date: Mon, 24 Oct 2016 09:11:18 +0200 Subject: [PATCH 2/2] small fix travis tests --- templates/monitrc.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/templates/monitrc.erb b/templates/monitrc.erb index 7407c15..e0449a9 100644 --- a/templates/monitrc.erb +++ b/templates/monitrc.erb @@ -37,9 +37,8 @@ set httpd port <%= @httpd_port %> and set mmonit http://<%= @mmonit_user %>:<%= @mmonit_password %>@<%= @mmonit_address %>:<%= @mmonit_port %>/collector <%- if @mmonit_without_credential_bool -%> and register without credentials<%- end -%> <%- end -%> - -include <%= @config_dir -%>/* - <%- @config_include.each do |include| -%> include <%= include %> <%- end -%> + +include <%= @config_dir -%>/*