poise-monit-compat 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.foodcritic +1 -0
- data/.gitignore +11 -0
- data/.kitchen.yml +8 -0
- data/.travis.yml +20 -0
- data/.yardopts +7 -0
- data/Berksfile +30 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +36 -0
- data/LICENSE +201 -0
- data/README.md +139 -0
- data/Rakefile +17 -0
- data/chef/attributes/default.rb +63 -0
- data/chef/recipes/default.rb +47 -0
- data/chef/recipes/postfix.rb +31 -0
- data/chef/recipes/postgresql.rb +32 -0
- data/chef/recipes/rabbitmq.rb +31 -0
- data/chef/recipes/resque.rb +25 -0
- data/chef/recipes/resque_scheduler.rb +30 -0
- data/chef/recipes/ssh.rb +30 -0
- data/chef/recipes/unicorn.rb +25 -0
- data/chef/templates/compat.conf.erb +43 -0
- data/chef/templates/resque.conf.erb +21 -0
- data/chef/templates/unicorn.conf.erb +17 -0
- data/lib/poise_monit_compat.rb +21 -0
- data/lib/poise_monit_compat/cheftie.rb +17 -0
- data/lib/poise_monit_compat/resources.rb +26 -0
- data/lib/poise_monit_compat/resources/monitrc.rb +95 -0
- data/lib/poise_monit_compat/version.rb +20 -0
- data/poise-monit-compat.gemspec +42 -0
- data/test/cookbooks/monit_test/attributes/default.rb +17 -0
- data/test/cookbooks/monit_test/metadata.rb +19 -0
- data/test/cookbooks/monit_test/recipes/default.rb +17 -0
- data/test/gemfiles/chef-12.gemfile +19 -0
- data/test/gemfiles/master.gemfile +25 -0
- data/test/integration/default/serverspec/default_spec.rb +37 -0
- data/test/spec/default_spec.rb +110 -0
- data/test/spec/monitrc_spec.rb +41 -0
- data/test/spec/postfix_spec.rb +24 -0
- data/test/spec/postgresql_spec.rb +24 -0
- data/test/spec/rabbitmq_spec.rb +24 -0
- data/test/spec/resque_scheduler_spec.rb +25 -0
- data/test/spec/resque_spec.rb +24 -0
- data/test/spec/spec_helper.rb +20 -0
- data/test/spec/ssh_spec.rb +24 -0
- data/test/spec/unicorn_spec.rb +24 -0
- metadata +167 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'poise_monit_compat/resources'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'poise_monit_compat/resources/monitrc'
|
18
|
+
|
19
|
+
|
20
|
+
module PoiseMonitCompat
|
21
|
+
# Chef resources and providers for poise-monit-compat.
|
22
|
+
#
|
23
|
+
# @since 1.0.0
|
24
|
+
module Resources
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'chef/provider'
|
18
|
+
require 'chef/resource'
|
19
|
+
require 'poise'
|
20
|
+
|
21
|
+
|
22
|
+
module PoiseMonitCompat
|
23
|
+
module Resources
|
24
|
+
# (see Monitrc::Resource)
|
25
|
+
# @since 1.0.0
|
26
|
+
module Monitrc
|
27
|
+
|
28
|
+
# A `monitrc` resource to install and configure Monit.
|
29
|
+
#
|
30
|
+
# @provides monitrc
|
31
|
+
# @action enable
|
32
|
+
# @action disable
|
33
|
+
# @example
|
34
|
+
# monitrc 'postfix'
|
35
|
+
class Resource < Chef::Resource
|
36
|
+
include Poise(parent: :monit)
|
37
|
+
provides(:monitrc)
|
38
|
+
actions(:enable, :disable)
|
39
|
+
|
40
|
+
# @!attribute reload
|
41
|
+
# Unusued, only present for compat.
|
42
|
+
# @return [nil]
|
43
|
+
attribute(:reload)
|
44
|
+
# @!attribute template_cookbook
|
45
|
+
# Cookbook to load the template from. Defaults to "monit".
|
46
|
+
# @return [String]
|
47
|
+
attribute(:template_cookbook, kind_of: String, default: 'monit')
|
48
|
+
# @!attribute template_source
|
49
|
+
# Path to the template source file. Defaults to "$name.conf.erb".
|
50
|
+
# @return [String]
|
51
|
+
attribute(:template_source, kind_of: String, default: lazy { "#{name}.conf.erb" })
|
52
|
+
# @!attribute variables
|
53
|
+
# Variables for the template.
|
54
|
+
# @return [Hash]
|
55
|
+
attribute(:variables, kind_of: Hash, default: lazy { {} })
|
56
|
+
end
|
57
|
+
|
58
|
+
# The provider for `monitrc`.
|
59
|
+
#
|
60
|
+
# @see Resource
|
61
|
+
# @provides monitrc
|
62
|
+
class Provider < Chef::Provider
|
63
|
+
include Poise
|
64
|
+
provides(:monitrc)
|
65
|
+
|
66
|
+
# An `enable` action for `monitrc`.
|
67
|
+
#
|
68
|
+
# @return [void]
|
69
|
+
def action_enable
|
70
|
+
notifying_block do
|
71
|
+
monit_config new_resource.name do
|
72
|
+
cookbook new_resource.template_cookbook
|
73
|
+
options new_resource.variables
|
74
|
+
parent new_resource.parent
|
75
|
+
source new_resource.template_source
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# A `disable` action for `monitrc`.
|
81
|
+
#
|
82
|
+
# @return [void]
|
83
|
+
def action_disable
|
84
|
+
notifying_block do
|
85
|
+
monit_config new_resource.name do
|
86
|
+
action :delete
|
87
|
+
parent new_resource.parent
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
|
18
|
+
module PoiseMonitCompat
|
19
|
+
VERSION = '1.0.0'
|
20
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
lib = File.expand_path('../lib', __FILE__)
|
18
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
19
|
+
require 'poise_monit_compat/version'
|
20
|
+
|
21
|
+
Gem::Specification.new do |spec|
|
22
|
+
spec.name = 'poise-monit-compat'
|
23
|
+
spec.version = PoiseMonitCompat::VERSION
|
24
|
+
spec.authors = ['Noah Kantrowitz']
|
25
|
+
spec.email = %w{noah@coderanger.net}
|
26
|
+
spec.description = 'A deprecated Chef cookbook for managing the Monit process manager.'
|
27
|
+
spec.summary = spec.description
|
28
|
+
spec.homepage = 'https://github.com/poise/poise-monit-compat'
|
29
|
+
spec.license = 'Apache 2.0'
|
30
|
+
spec.metadata['halite_name'] = 'monit'
|
31
|
+
|
32
|
+
spec.files = `git ls-files`.split($/)
|
33
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
34
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
35
|
+
spec.require_paths = %w{lib}
|
36
|
+
|
37
|
+
spec.add_dependency 'halite', '~> 1.1'
|
38
|
+
spec.add_dependency 'poise', '~> 2.0'
|
39
|
+
spec.add_dependency 'poise-monit', '~> 1.0'
|
40
|
+
|
41
|
+
spec.add_development_dependency 'poise-boiler', '~> 1.0'
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
override['poise-service']['provider'] = 'dummy'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
name 'monit_test'
|
18
|
+
depends 'monit'
|
19
|
+
depends 'yum-epel'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
include_recipe 'monit'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.0'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', github: 'chef/chef'
|
20
|
+
# gem 'halite', github: 'poise/halite'
|
21
|
+
gem 'poise', github: 'poise/poise'
|
22
|
+
gem 'poise-boiler', github: 'poise/poise-boiler'
|
23
|
+
gem 'poise-languages', github: 'poise/poise-languages'
|
24
|
+
gem 'poise-monit', github: 'poise/poise-monit'
|
25
|
+
gem 'poise-service', github: 'poise/poise-service'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# #
|
2
|
+
# # Copyright 2015, Noah Kantrowitz
|
3
|
+
# #
|
4
|
+
# # Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# # you may not use this file except in compliance with the License.
|
6
|
+
# # You may obtain a copy of the License at
|
7
|
+
# #
|
8
|
+
# # http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
# #
|
10
|
+
# # Unless required by applicable law or agreed to in writing, software
|
11
|
+
# # distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# # See the License for the specific language governing permissions and
|
14
|
+
# # limitations under the License.
|
15
|
+
# #
|
16
|
+
|
17
|
+
require 'serverspec'
|
18
|
+
set :backend, :exec
|
19
|
+
|
20
|
+
describe file('/usr/bin/monit') do
|
21
|
+
it { is_expected.to exist }
|
22
|
+
it { is_expected.to be_a_file }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe file('/etc/monit/monitrc') do
|
26
|
+
it { is_expected.to exist }
|
27
|
+
it { is_expected.to be_a_file }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe command('monit -c /etc/monit/monitrc -V') do
|
31
|
+
its(:exit_status) { is_expected.to eq 0 }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe command('monit -c /etc/monit/monitrc status') do
|
35
|
+
its(:exit_status) { is_expected.to eq 0 }
|
36
|
+
its(:stdout) { is_expected.to include 'System' }
|
37
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe 'monit::default' do
|
20
|
+
step_into(:monit)
|
21
|
+
step_into(:monit_config)
|
22
|
+
recipe { include_recipe 'monit' }
|
23
|
+
before do
|
24
|
+
allow_any_instance_of(PoiseMonit::Resources::Monit::Resource).to receive(:monit_version).and_return(Gem::Version.create('5.15'))
|
25
|
+
override_attributes['monit'] ||= {}
|
26
|
+
override_attributes['monit']['eventqueue'] ||= {}
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with defaults' do
|
30
|
+
it { is_expected.to enable_monit('monit').with(daemon_interval: 60, event_slots: 1000, httpd_port: '/var/run/monit.sock', logfile: 'syslog facility log_daemon', var_path: '/var/monit') }
|
31
|
+
it { is_expected.to install_package('monit') }
|
32
|
+
it { is_expected.to render_file('/etc/monit/monitrc') }
|
33
|
+
it { is_expected.to render_file('/etc/monit/conf.d/compat.conf').with_content(/\A\s*\Z/) }
|
34
|
+
end # /context with defaults
|
35
|
+
|
36
|
+
context 'with node["monit"]["logfile"]' do
|
37
|
+
before { override_attributes['monit']['logfile'] = '/log' }
|
38
|
+
it { is_expected.to enable_monit('monit').with(logfile: '/log') }
|
39
|
+
end # /context with node["monit"]["logfile"]
|
40
|
+
|
41
|
+
context 'with node["monit"]["poll_period"]' do
|
42
|
+
before { override_attributes['monit']['poll_period'] = 200 }
|
43
|
+
it { is_expected.to enable_monit('monit').with(daemon_interval: 200) }
|
44
|
+
end # /context with node["monit"]["poll_period"]
|
45
|
+
|
46
|
+
context 'with node["monit"]["eventqueue"]["set"]' do
|
47
|
+
before { override_attributes['monit']['eventqueue']['set'] = false }
|
48
|
+
it { is_expected.to enable_monit('monit').with(event_slots: 0) }
|
49
|
+
end # /context with node["monit"]["eventqueue"]["set"]
|
50
|
+
|
51
|
+
context 'with node["monit"]["eventqueue"]["basedir"]' do
|
52
|
+
before { override_attributes['monit']['eventqueue']['basedir'] = '/events' }
|
53
|
+
it { is_expected.to enable_monit('monit').with(var_path: '/events') }
|
54
|
+
end # /context with node["monit"]["eventqueue"]["basedir"]
|
55
|
+
|
56
|
+
context 'with node["monit"]["eventqueue"]["slots"]' do
|
57
|
+
before { override_attributes['monit']['eventqueue']['slots'] = 200 }
|
58
|
+
it { is_expected.to enable_monit('monit').with(event_slots: 200) }
|
59
|
+
end # /context with node["monit"]["eventqueue"]["slots"]
|
60
|
+
|
61
|
+
context 'with basic httpd config' do
|
62
|
+
before do
|
63
|
+
override_attributes['monit']['username'] = 'super'
|
64
|
+
override_attributes['monit']['password'] = 'secretz'
|
65
|
+
end
|
66
|
+
it { is_expected.to enable_monit('monit').with(httpd_port: false) }
|
67
|
+
it { is_expected.to render_file('/etc/monit/conf.d/compat.conf').with_content(<<-EOH) }
|
68
|
+
set httpd port 3737
|
69
|
+
allow super:secretz
|
70
|
+
EOH
|
71
|
+
end # /context with basic httpd config
|
72
|
+
|
73
|
+
context 'with complex httpd config' do
|
74
|
+
before do
|
75
|
+
override_attributes['monit']['address'] = '10.0.0.1'
|
76
|
+
override_attributes['monit']['allow'] = %w{192.168.0.0/16}
|
77
|
+
override_attributes['monit']['password'] = 'secretz'
|
78
|
+
override_attributes['monit']['ssl'] = true
|
79
|
+
override_attributes['monit']['username'] = 'super'
|
80
|
+
end
|
81
|
+
it { is_expected.to enable_monit('monit').with(httpd_port: false) }
|
82
|
+
it { is_expected.to render_file('/etc/monit/conf.d/compat.conf').with_content(<<-EOH) }
|
83
|
+
set httpd port 3737
|
84
|
+
use address 10.0.0.1
|
85
|
+
allow 192.168.0.0/16
|
86
|
+
allow super:secretz
|
87
|
+
ssl enable
|
88
|
+
pemfile /etc/monit/monit.pem
|
89
|
+
EOH
|
90
|
+
end # /context with complex httpd config
|
91
|
+
|
92
|
+
context 'with a notification config' do
|
93
|
+
before { override_attributes['monit']['notify_email'] = 'admins@example.com' }
|
94
|
+
it { is_expected.to render_file('/etc/monit/conf.d/compat.conf').with_content(<<-EOH) }
|
95
|
+
set mailserver localhost
|
96
|
+
with timeout 60 seconds
|
97
|
+
|
98
|
+
set mail-format {
|
99
|
+
from: monit@chefspec.local
|
100
|
+
subject: $SERVICE $EVENT
|
101
|
+
message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
|
102
|
+
Yours sincerely,
|
103
|
+
monit
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
set alert admins@example.com NOT ON { action, instance, pid, ppid }
|
108
|
+
EOH
|
109
|
+
end # /context with a notification config
|
110
|
+
end
|