cloud-mu 2.1.0beta → 3.0.0beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Berksfile +4 -5
- data/Berksfile.lock +179 -0
- data/README.md +1 -6
- data/ansible/roles/geerlingguy.firewall/templates/firewall.bash.j2 +0 -0
- data/ansible/roles/mu-installer/README.md +33 -0
- data/ansible/roles/mu-installer/defaults/main.yml +2 -0
- data/ansible/roles/mu-installer/handlers/main.yml +2 -0
- data/ansible/roles/mu-installer/meta/main.yml +60 -0
- data/ansible/roles/mu-installer/tasks/main.yml +13 -0
- data/ansible/roles/mu-installer/tests/inventory +2 -0
- data/ansible/roles/mu-installer/tests/test.yml +5 -0
- data/ansible/roles/mu-installer/vars/main.yml +2 -0
- data/bin/mu-adopt +125 -0
- data/bin/mu-aws-setup +4 -4
- data/bin/mu-azure-setup +265 -0
- data/bin/mu-azure-tests +43 -0
- data/bin/mu-cleanup +20 -8
- data/bin/mu-configure +224 -98
- data/bin/mu-deploy +8 -3
- data/bin/mu-gcp-setup +16 -8
- data/bin/mu-gen-docs +92 -8
- data/bin/mu-load-config.rb +52 -12
- data/bin/mu-momma-cat +36 -0
- data/bin/mu-node-manage +34 -27
- data/bin/mu-self-update +2 -2
- data/bin/mu-ssh +12 -8
- data/bin/mu-upload-chef-artifacts +11 -4
- data/bin/mu-user-manage +3 -0
- data/cloud-mu.gemspec +8 -11
- data/cookbooks/firewall/libraries/helpers_iptables.rb +2 -2
- data/cookbooks/firewall/metadata.json +1 -1
- data/cookbooks/firewall/recipes/default.rb +5 -9
- data/cookbooks/mu-firewall/attributes/default.rb +2 -0
- data/cookbooks/mu-firewall/metadata.rb +1 -1
- data/cookbooks/mu-glusterfs/templates/default/mu-gluster-client.erb +0 -0
- data/cookbooks/mu-master/Berksfile +2 -2
- data/cookbooks/mu-master/files/default/check_mem.pl +0 -0
- data/cookbooks/mu-master/files/default/cloudamatic.png +0 -0
- data/cookbooks/mu-master/metadata.rb +5 -4
- data/cookbooks/mu-master/recipes/389ds.rb +1 -1
- data/cookbooks/mu-master/recipes/basepackages.rb +30 -10
- data/cookbooks/mu-master/recipes/default.rb +59 -7
- data/cookbooks/mu-master/recipes/firewall-holes.rb +1 -1
- data/cookbooks/mu-master/recipes/init.rb +65 -47
- data/cookbooks/mu-master/recipes/{eks-kubectl.rb → kubectl.rb} +4 -10
- data/cookbooks/mu-master/recipes/sssd.rb +2 -1
- data/cookbooks/mu-master/recipes/update_nagios_only.rb +6 -6
- data/cookbooks/mu-master/templates/default/web_app.conf.erb +2 -2
- data/cookbooks/mu-master/templates/mods/ldap.conf.erb +4 -0
- data/cookbooks/mu-php54/Berksfile +1 -2
- data/cookbooks/mu-php54/metadata.rb +4 -5
- data/cookbooks/mu-php54/recipes/default.rb +1 -1
- data/cookbooks/mu-splunk/templates/default/splunk-init.erb +0 -0
- data/cookbooks/mu-tools/Berksfile +3 -2
- data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
- data/cookbooks/mu-tools/libraries/helper.rb +20 -8
- data/cookbooks/mu-tools/metadata.rb +5 -2
- data/cookbooks/mu-tools/recipes/apply_security.rb +2 -3
- data/cookbooks/mu-tools/recipes/eks.rb +1 -1
- data/cookbooks/mu-tools/recipes/gcloud.rb +5 -30
- data/cookbooks/mu-tools/recipes/nagios.rb +1 -1
- data/cookbooks/mu-tools/recipes/rsyslog.rb +1 -0
- data/cookbooks/mu-tools/recipes/selinux.rb +19 -0
- data/cookbooks/mu-tools/recipes/split_var_partitions.rb +0 -1
- data/cookbooks/mu-tools/recipes/windows-client.rb +256 -122
- data/cookbooks/mu-tools/resources/disk.rb +3 -1
- data/cookbooks/mu-tools/templates/amazon/sshd_config.erb +1 -1
- data/cookbooks/mu-tools/templates/default/etc_hosts.erb +1 -1
- data/cookbooks/mu-tools/templates/default/{kubeconfig.erb → kubeconfig-eks.erb} +0 -0
- data/cookbooks/mu-tools/templates/default/kubeconfig-gke.erb +27 -0
- data/cookbooks/mu-tools/templates/windows-10/sshd_config.erb +137 -0
- data/cookbooks/mu-utility/recipes/nat.rb +4 -0
- data/extras/alpha.png +0 -0
- data/extras/beta.png +0 -0
- data/extras/clean-stock-amis +2 -2
- data/extras/generate-stock-images +131 -0
- data/extras/git-fix-permissions-hook +0 -0
- data/extras/image-generators/AWS/centos6.yaml +17 -0
- data/extras/image-generators/{aws → AWS}/centos7-govcloud.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/centos7.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/rhel7.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/win2k12.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/win2k16.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/windows.yaml +0 -0
- data/extras/image-generators/{gcp → Google}/centos6.yaml +1 -0
- data/extras/image-generators/Google/centos7.yaml +18 -0
- data/extras/python_rpm/build.sh +0 -0
- data/extras/release.png +0 -0
- data/extras/ruby_rpm/build.sh +0 -0
- data/extras/ruby_rpm/muby.spec +1 -1
- data/install/README.md +43 -5
- data/install/deprecated-bash-library.sh +0 -0
- data/install/installer +1 -1
- data/install/jenkinskeys.rb +0 -0
- data/install/mu-master.yaml +55 -0
- data/modules/mommacat.ru +41 -7
- data/modules/mu.rb +444 -149
- data/modules/mu/adoption.rb +500 -0
- data/modules/mu/cleanup.rb +235 -158
- data/modules/mu/cloud.rb +675 -138
- data/modules/mu/clouds/aws.rb +156 -24
- data/modules/mu/clouds/aws/alarm.rb +4 -14
- data/modules/mu/clouds/aws/bucket.rb +60 -18
- data/modules/mu/clouds/aws/cache_cluster.rb +8 -20
- data/modules/mu/clouds/aws/collection.rb +12 -22
- data/modules/mu/clouds/aws/container_cluster.rb +209 -118
- data/modules/mu/clouds/aws/database.rb +120 -45
- data/modules/mu/clouds/aws/dnszone.rb +7 -18
- data/modules/mu/clouds/aws/endpoint.rb +5 -15
- data/modules/mu/clouds/aws/firewall_rule.rb +144 -72
- data/modules/mu/clouds/aws/folder.rb +4 -11
- data/modules/mu/clouds/aws/function.rb +6 -16
- data/modules/mu/clouds/aws/group.rb +4 -12
- data/modules/mu/clouds/aws/habitat.rb +11 -13
- data/modules/mu/clouds/aws/loadbalancer.rb +40 -28
- data/modules/mu/clouds/aws/log.rb +5 -13
- data/modules/mu/clouds/aws/msg_queue.rb +9 -24
- data/modules/mu/clouds/aws/nosqldb.rb +4 -12
- data/modules/mu/clouds/aws/notifier.rb +6 -13
- data/modules/mu/clouds/aws/role.rb +69 -40
- data/modules/mu/clouds/aws/search_domain.rb +17 -20
- data/modules/mu/clouds/aws/server.rb +184 -94
- data/modules/mu/clouds/aws/server_pool.rb +33 -38
- data/modules/mu/clouds/aws/storage_pool.rb +5 -12
- data/modules/mu/clouds/aws/user.rb +59 -33
- data/modules/mu/clouds/aws/userdata/linux.erb +18 -30
- data/modules/mu/clouds/aws/userdata/windows.erb +9 -9
- data/modules/mu/clouds/aws/vpc.rb +214 -145
- data/modules/mu/clouds/azure.rb +978 -44
- data/modules/mu/clouds/azure/container_cluster.rb +413 -0
- data/modules/mu/clouds/azure/firewall_rule.rb +500 -0
- data/modules/mu/clouds/azure/habitat.rb +167 -0
- data/modules/mu/clouds/azure/loadbalancer.rb +205 -0
- data/modules/mu/clouds/azure/role.rb +211 -0
- data/modules/mu/clouds/azure/server.rb +810 -0
- data/modules/mu/clouds/azure/user.rb +257 -0
- data/modules/mu/clouds/azure/userdata/README.md +4 -0
- data/modules/mu/clouds/azure/userdata/linux.erb +137 -0
- data/modules/mu/clouds/azure/userdata/windows.erb +275 -0
- data/modules/mu/clouds/azure/vpc.rb +782 -0
- data/modules/mu/clouds/cloudformation.rb +12 -9
- data/modules/mu/clouds/cloudformation/firewall_rule.rb +5 -13
- data/modules/mu/clouds/cloudformation/server.rb +10 -1
- data/modules/mu/clouds/cloudformation/server_pool.rb +1 -0
- data/modules/mu/clouds/cloudformation/vpc.rb +0 -2
- data/modules/mu/clouds/google.rb +554 -117
- data/modules/mu/clouds/google/bucket.rb +173 -32
- data/modules/mu/clouds/google/container_cluster.rb +1112 -157
- data/modules/mu/clouds/google/database.rb +24 -47
- data/modules/mu/clouds/google/firewall_rule.rb +344 -89
- data/modules/mu/clouds/google/folder.rb +156 -79
- data/modules/mu/clouds/google/group.rb +272 -82
- data/modules/mu/clouds/google/habitat.rb +177 -52
- data/modules/mu/clouds/google/loadbalancer.rb +9 -34
- data/modules/mu/clouds/google/role.rb +1211 -0
- data/modules/mu/clouds/google/server.rb +491 -227
- data/modules/mu/clouds/google/server_pool.rb +233 -48
- data/modules/mu/clouds/google/user.rb +479 -125
- data/modules/mu/clouds/google/userdata/linux.erb +3 -3
- data/modules/mu/clouds/google/userdata/windows.erb +9 -9
- data/modules/mu/clouds/google/vpc.rb +381 -223
- data/modules/mu/config.rb +689 -214
- data/modules/mu/config/bucket.rb +1 -1
- data/modules/mu/config/cache_cluster.rb +1 -1
- data/modules/mu/config/cache_cluster.yml +0 -4
- data/modules/mu/config/container_cluster.rb +18 -9
- data/modules/mu/config/database.rb +6 -23
- data/modules/mu/config/firewall_rule.rb +9 -15
- data/modules/mu/config/folder.rb +22 -21
- data/modules/mu/config/habitat.rb +22 -21
- data/modules/mu/config/loadbalancer.rb +2 -2
- data/modules/mu/config/role.rb +9 -40
- data/modules/mu/config/server.rb +26 -5
- data/modules/mu/config/server_pool.rb +1 -1
- data/modules/mu/config/storage_pool.rb +2 -2
- data/modules/mu/config/user.rb +4 -0
- data/modules/mu/config/vpc.rb +350 -110
- data/modules/mu/defaults/{amazon_images.yaml → AWS.yaml} +37 -39
- data/modules/mu/defaults/Azure.yaml +17 -0
- data/modules/mu/defaults/Google.yaml +24 -0
- data/modules/mu/defaults/README.md +1 -1
- data/modules/mu/deploy.rb +168 -125
- data/modules/mu/groomer.rb +2 -1
- data/modules/mu/groomers/ansible.rb +104 -32
- data/modules/mu/groomers/chef.rb +96 -44
- data/modules/mu/kittens.rb +20602 -0
- data/modules/mu/logger.rb +38 -11
- data/modules/mu/master.rb +90 -8
- data/modules/mu/master/chef.rb +2 -3
- data/modules/mu/master/ldap.rb +0 -1
- data/modules/mu/master/ssl.rb +250 -0
- data/modules/mu/mommacat.rb +917 -513
- data/modules/scratchpad.erb +1 -1
- data/modules/tests/super_complex_bok.yml +0 -0
- data/modules/tests/super_simple_bok.yml +0 -0
- data/roles/mu-master.json +2 -1
- data/spec/azure_creds +5 -0
- data/spec/mu.yaml +56 -0
- data/spec/mu/clouds/azure_spec.rb +164 -27
- data/spec/spec_helper.rb +5 -0
- data/test/clean_up.py +0 -0
- data/test/exec_inspec.py +0 -0
- data/test/exec_mu_install.py +0 -0
- data/test/exec_retry.py +0 -0
- data/test/smoke_test.rb +0 -0
- metadata +90 -118
- data/cookbooks/mu-jenkins/Berksfile +0 -14
- data/cookbooks/mu-jenkins/CHANGELOG.md +0 -13
- data/cookbooks/mu-jenkins/LICENSE +0 -37
- data/cookbooks/mu-jenkins/README.md +0 -105
- data/cookbooks/mu-jenkins/attributes/default.rb +0 -42
- data/cookbooks/mu-jenkins/files/default/cleanup_deploy_config.xml +0 -73
- data/cookbooks/mu-jenkins/files/default/deploy_config.xml +0 -44
- data/cookbooks/mu-jenkins/metadata.rb +0 -21
- data/cookbooks/mu-jenkins/recipes/default.rb +0 -195
- data/cookbooks/mu-jenkins/recipes/node-ssh-config.rb +0 -54
- data/cookbooks/mu-jenkins/recipes/public_key.rb +0 -24
- data/cookbooks/mu-jenkins/templates/default/example_job.config.xml.erb +0 -24
- data/cookbooks/mu-jenkins/templates/default/org.jvnet.hudson.plugins.SSHBuildWrapper.xml.erb +0 -14
- data/cookbooks/mu-jenkins/templates/default/ssh_config.erb +0 -6
- data/cookbooks/nagios/Berksfile +0 -11
- data/cookbooks/nagios/CHANGELOG.md +0 -589
- data/cookbooks/nagios/CONTRIBUTING.md +0 -11
- data/cookbooks/nagios/LICENSE +0 -37
- data/cookbooks/nagios/README.md +0 -328
- data/cookbooks/nagios/TESTING.md +0 -2
- data/cookbooks/nagios/attributes/config.rb +0 -171
- data/cookbooks/nagios/attributes/default.rb +0 -228
- data/cookbooks/nagios/chefignore +0 -102
- data/cookbooks/nagios/definitions/command.rb +0 -33
- data/cookbooks/nagios/definitions/contact.rb +0 -33
- data/cookbooks/nagios/definitions/contactgroup.rb +0 -33
- data/cookbooks/nagios/definitions/host.rb +0 -33
- data/cookbooks/nagios/definitions/hostdependency.rb +0 -33
- data/cookbooks/nagios/definitions/hostescalation.rb +0 -34
- data/cookbooks/nagios/definitions/hostgroup.rb +0 -33
- data/cookbooks/nagios/definitions/nagios_conf.rb +0 -38
- data/cookbooks/nagios/definitions/resource.rb +0 -33
- data/cookbooks/nagios/definitions/service.rb +0 -33
- data/cookbooks/nagios/definitions/servicedependency.rb +0 -33
- data/cookbooks/nagios/definitions/serviceescalation.rb +0 -34
- data/cookbooks/nagios/definitions/servicegroup.rb +0 -33
- data/cookbooks/nagios/definitions/timeperiod.rb +0 -33
- data/cookbooks/nagios/libraries/base.rb +0 -314
- data/cookbooks/nagios/libraries/command.rb +0 -91
- data/cookbooks/nagios/libraries/contact.rb +0 -230
- data/cookbooks/nagios/libraries/contactgroup.rb +0 -112
- data/cookbooks/nagios/libraries/custom_option.rb +0 -36
- data/cookbooks/nagios/libraries/data_bag_helper.rb +0 -23
- data/cookbooks/nagios/libraries/default.rb +0 -90
- data/cookbooks/nagios/libraries/host.rb +0 -412
- data/cookbooks/nagios/libraries/hostdependency.rb +0 -181
- data/cookbooks/nagios/libraries/hostescalation.rb +0 -173
- data/cookbooks/nagios/libraries/hostgroup.rb +0 -119
- data/cookbooks/nagios/libraries/nagios.rb +0 -282
- data/cookbooks/nagios/libraries/resource.rb +0 -59
- data/cookbooks/nagios/libraries/service.rb +0 -455
- data/cookbooks/nagios/libraries/servicedependency.rb +0 -215
- data/cookbooks/nagios/libraries/serviceescalation.rb +0 -195
- data/cookbooks/nagios/libraries/servicegroup.rb +0 -144
- data/cookbooks/nagios/libraries/timeperiod.rb +0 -160
- data/cookbooks/nagios/libraries/users_helper.rb +0 -54
- data/cookbooks/nagios/metadata.rb +0 -25
- data/cookbooks/nagios/recipes/_load_databag_config.rb +0 -153
- data/cookbooks/nagios/recipes/_load_default_config.rb +0 -241
- data/cookbooks/nagios/recipes/apache.rb +0 -48
- data/cookbooks/nagios/recipes/default.rb +0 -204
- data/cookbooks/nagios/recipes/nginx.rb +0 -82
- data/cookbooks/nagios/recipes/pagerduty.rb +0 -143
- data/cookbooks/nagios/recipes/server_package.rb +0 -40
- data/cookbooks/nagios/recipes/server_source.rb +0 -164
- data/cookbooks/nagios/templates/default/apache2.conf.erb +0 -96
- data/cookbooks/nagios/templates/default/cgi.cfg.erb +0 -266
- data/cookbooks/nagios/templates/default/commands.cfg.erb +0 -13
- data/cookbooks/nagios/templates/default/contacts.cfg.erb +0 -37
- data/cookbooks/nagios/templates/default/hostgroups.cfg.erb +0 -25
- data/cookbooks/nagios/templates/default/hosts.cfg.erb +0 -15
- data/cookbooks/nagios/templates/default/htpasswd.users.erb +0 -6
- data/cookbooks/nagios/templates/default/nagios.cfg.erb +0 -22
- data/cookbooks/nagios/templates/default/nginx.conf.erb +0 -62
- data/cookbooks/nagios/templates/default/pagerduty.cgi.erb +0 -185
- data/cookbooks/nagios/templates/default/resource.cfg.erb +0 -27
- data/cookbooks/nagios/templates/default/servicedependencies.cfg.erb +0 -15
- data/cookbooks/nagios/templates/default/servicegroups.cfg.erb +0 -14
- data/cookbooks/nagios/templates/default/services.cfg.erb +0 -14
- data/cookbooks/nagios/templates/default/templates.cfg.erb +0 -31
- data/cookbooks/nagios/templates/default/timeperiods.cfg.erb +0 -13
- data/extras/image-generators/aws/centos6.yaml +0 -18
- data/modules/mu/defaults/google_images.yaml +0 -16
- data/roles/mu-master-jenkins.json +0 -24
@@ -1,160 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman <sbotman@schubergphilis.com>
|
3
|
-
# Cookbook Name:: nagios
|
4
|
-
# Library:: timeperiod
|
5
|
-
#
|
6
|
-
# Copyright 2014, Sander Botman
|
7
|
-
#
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
|
20
|
-
require_relative 'base'
|
21
|
-
|
22
|
-
class Nagios
|
23
|
-
#
|
24
|
-
# This class holds all methods with regard to timeperiodentries,
|
25
|
-
# that are used within the timeperiod nagios configurations.
|
26
|
-
#
|
27
|
-
class Timeperiodentry
|
28
|
-
attr_reader :moment,
|
29
|
-
:period
|
30
|
-
|
31
|
-
def initialize(moment, period)
|
32
|
-
@moment = moment
|
33
|
-
@period = check_period(period)
|
34
|
-
end
|
35
|
-
|
36
|
-
def to_s
|
37
|
-
moment
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def check_period(period)
|
43
|
-
return period if period =~ /^(([01]?[0-9]|2[0-3])\:[0-5][0-9]-([01]?[0-9]|2[0-4])\:[0-5][0-9],?)*$/
|
44
|
-
nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
#
|
49
|
-
# This class holds all methods with regard to timeperiod options,
|
50
|
-
# that are used within nagios configurations.
|
51
|
-
#
|
52
|
-
class Timeperiod < Nagios::Base
|
53
|
-
attr_reader :timeperiod_name
|
54
|
-
|
55
|
-
attr_accessor :alias,
|
56
|
-
:periods,
|
57
|
-
:exclude
|
58
|
-
|
59
|
-
def initialize(timeperiod_name)
|
60
|
-
@timeperiod_name = timeperiod_name
|
61
|
-
@periods = {}
|
62
|
-
@exclude = {}
|
63
|
-
super()
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.create(name)
|
67
|
-
Nagios.instance.find(Nagios::Timeperiod.new(name))
|
68
|
-
end
|
69
|
-
|
70
|
-
def definition
|
71
|
-
configured = configured_options
|
72
|
-
periods.values.each { |v| configured[v.moment] = v.period }
|
73
|
-
get_definition(configured, 'timeperiod')
|
74
|
-
end
|
75
|
-
|
76
|
-
# exclude
|
77
|
-
# This directive is used to specify the short names of other timeperiod definitions
|
78
|
-
# whose time ranges should be excluded from this timeperiod.
|
79
|
-
# Multiple timeperiod names should be separated with a comma.
|
80
|
-
|
81
|
-
def exclude
|
82
|
-
@exclude.values.map(&:to_s).sort.join(',')
|
83
|
-
end
|
84
|
-
|
85
|
-
def import(hash)
|
86
|
-
update_options(hash)
|
87
|
-
if hash['times'].respond_to?('each_pair')
|
88
|
-
hash['times'].each { |k, v| push(Nagios::Timeperiodentry.new(k, v)) }
|
89
|
-
end
|
90
|
-
update_members(hash, 'exclude', Nagios::Timeperiod)
|
91
|
-
end
|
92
|
-
|
93
|
-
def push(obj)
|
94
|
-
case obj
|
95
|
-
when Nagios::Timeperiod
|
96
|
-
push_object(obj, @exclude)
|
97
|
-
when Nagios::Timeperiodentry
|
98
|
-
push_object(obj, @periods) unless obj.period.nil?
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def pop(obj)
|
103
|
-
return if obj == self
|
104
|
-
case obj
|
105
|
-
when Nagios::Timeperiod
|
106
|
-
if @exclude.keys?(obj.to_s)
|
107
|
-
pop_object(obj, @exclude)
|
108
|
-
pop(self, obj)
|
109
|
-
end
|
110
|
-
when Nagios::Timeperiodentry
|
111
|
-
if @periods.keys?(obj.to_s)
|
112
|
-
pop_object(obj, @periods)
|
113
|
-
pop(self, obj)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
|
119
|
-
def to_s
|
120
|
-
timeperiod_name
|
121
|
-
end
|
122
|
-
|
123
|
-
# [weekday]
|
124
|
-
# The weekday directives ("sunday" through "saturday")are comma-delimited
|
125
|
-
# lists of time ranges that are "valid" times for a particular day of the week.
|
126
|
-
# Notice that there are seven different days for which you can define time
|
127
|
-
# ranges (Sunday through Saturday). Each time range is in the form of
|
128
|
-
# HH:MM-HH:MM, where hours are specified on a 24 hour clock.
|
129
|
-
# For example, 00:15-24:00 means 12:15am in the morning for this day until
|
130
|
-
# 12:00am midnight (a 23 hour, 45 minute total time range).
|
131
|
-
# If you wish to exclude an entire day from the timeperiod, simply do not include
|
132
|
-
# it in the timeperiod definition.
|
133
|
-
|
134
|
-
# [exception]
|
135
|
-
# You can specify several different types of exceptions to the standard rotating
|
136
|
-
# weekday schedule. Exceptions can take a number of different forms including single
|
137
|
-
# days of a specific or generic month, single weekdays in a month, or single calendar
|
138
|
-
# dates. You can also specify a range of days/dates and even specify skip intervals
|
139
|
-
# to obtain functionality described by "every 3 days between these dates".
|
140
|
-
# Rather than list all the possible formats for exception strings, I'll let you look
|
141
|
-
# at the example timeperiod definitions above to see what's possible.
|
142
|
-
# Weekdays and different types of exceptions all have different levels of precedence,
|
143
|
-
# so its important to understand how they can affect each other.
|
144
|
-
|
145
|
-
private
|
146
|
-
|
147
|
-
def config_options
|
148
|
-
{
|
149
|
-
'timeperiod_name' => 'timeperiod_name',
|
150
|
-
'alias' => 'alias',
|
151
|
-
'exclude' => 'exclude',
|
152
|
-
}
|
153
|
-
end
|
154
|
-
|
155
|
-
def merge_members(obj)
|
156
|
-
obj.periods.each { |m| push(m) }
|
157
|
-
obj.exclude.each { |m| push(m) }
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'chef/log'
|
2
|
-
require 'chef/search/query'
|
3
|
-
|
4
|
-
# Simplify access to list of all valid Nagios users
|
5
|
-
class NagiosUsers
|
6
|
-
attr_accessor :users
|
7
|
-
|
8
|
-
def initialize(node)
|
9
|
-
@node = node
|
10
|
-
@users = []
|
11
|
-
|
12
|
-
user_databag = node['nagios']['users_databag'].to_sym
|
13
|
-
group = node['nagios']['users_databag_group']
|
14
|
-
|
15
|
-
if node['nagios']['server']['use_encrypted_data_bags']
|
16
|
-
load_encrypted_databag(user_databag)
|
17
|
-
else
|
18
|
-
search_databag(user_databag, group)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def return_user_contacts
|
23
|
-
contacts = []
|
24
|
-
# add base contacts from nagios_users data bag
|
25
|
-
@users.each do |s|
|
26
|
-
contacts << s['id']
|
27
|
-
end
|
28
|
-
contacts
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def fail_search(user_databag)
|
34
|
-
Chef::Log.fatal("\"#{user_databag}\" databag could not be found.")
|
35
|
-
raise "\"#{user_databag}\" databag could not be found."
|
36
|
-
end
|
37
|
-
|
38
|
-
def load_encrypted_databag(user_databag)
|
39
|
-
Chef::DataBag.load(user_databag).each do |u, _|
|
40
|
-
d = Chef::EncryptedDataBagItem.load(user_databag, u) # ~FC086
|
41
|
-
@users << d unless d['nagios'].nil? || d['nagios']['email'].nil?
|
42
|
-
end
|
43
|
-
rescue Net::HTTPServerException
|
44
|
-
fail_search(user_databag)
|
45
|
-
end
|
46
|
-
|
47
|
-
def search_databag(user_databag, group)
|
48
|
-
Chef::Search::Query.new.search(user_databag, "groups:#{group} NOT action:remove") do |d|
|
49
|
-
@users << d unless d['nagios'].nil? || d['nagios']['email'].nil?
|
50
|
-
end
|
51
|
-
rescue Net::HTTPServerException
|
52
|
-
fail_search(user_databag)
|
53
|
-
end
|
54
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
name 'nagios'
|
2
|
-
maintainer 'Mu'
|
3
|
-
maintainer_email 'mu-developers@googlegroups.com'
|
4
|
-
license 'BSD-3-Clause'
|
5
|
-
description 'Installs and configures Nagios server'
|
6
|
-
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
7
|
-
version '7.2.7'
|
8
|
-
source_url 'https://github.com/cloudamatic/mu'
|
9
|
-
issues_url 'https://github.com/cloudamatic/mu/issues'
|
10
|
-
chef_version '>= 14.0' if respond_to?(:chef_version)
|
11
|
-
|
12
|
-
recipe 'default', 'Installs Nagios server.'
|
13
|
-
recipe 'nagios::pagerduty', 'Integrates contacts w/ PagerDuty API'
|
14
|
-
|
15
|
-
depends 'apache2', '< 4.0'
|
16
|
-
depends 'php', '< 6.0'
|
17
|
-
depends 'zap', '>= 0.6.0'
|
18
|
-
|
19
|
-
%w(chef_nginx nginx_simplecgi yum-epel nrpe ).each do |cb|
|
20
|
-
depends cb
|
21
|
-
end
|
22
|
-
|
23
|
-
%w( debian ubuntu redhat centos fedora scientific amazon oracle).each do |os|
|
24
|
-
supports os
|
25
|
-
end
|
@@ -1,153 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman <sbotman@schubergphilis.com>
|
3
|
-
# Cookbook Name:: nagios
|
4
|
-
# Recipe:: _load_databag_config
|
5
|
-
#
|
6
|
-
# Copyright 2014, Sander Botman
|
7
|
-
#
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
|
20
|
-
# Loading all databag information
|
21
|
-
nagios_bags = NagiosDataBags.new
|
22
|
-
|
23
|
-
hostgroups = nagios_bags.get(node['nagios']['hostgroups_databag'])
|
24
|
-
hostgroups.each do |group|
|
25
|
-
next if group['search_query'].nil?
|
26
|
-
if node['nagios']['multi_environment_monitoring']
|
27
|
-
query_environments = node['nagios']['monitored_environments'].map do |environment|
|
28
|
-
"chef_environment:#{environment}"
|
29
|
-
end.join(' OR ')
|
30
|
-
result = search(:node, "(#{group['search_query']}) AND (#{query_environments})")
|
31
|
-
else
|
32
|
-
result = search(:node, "#{group['search_query']} AND chef_environment:#{node.chef_environment}")
|
33
|
-
end
|
34
|
-
|
35
|
-
result.each do |n|
|
36
|
-
n.automatic_attrs['roles'] = [group['hostgroup_name']]
|
37
|
-
Nagios.instance.push(n)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
services = nagios_bags.get(node['nagios']['services_databag'])
|
42
|
-
services.each do |item|
|
43
|
-
next unless item['activate_check_in_environment'].nil? || item['activate_check_in_environment'].include?(node.chef_environment)
|
44
|
-
name = item['service_description'] || item['id']
|
45
|
-
check_command = name.downcase.start_with?('check_') ? name.downcase : 'check_' + name.downcase
|
46
|
-
command_name = item['check_command'].nil? ? check_command : item['check_command']
|
47
|
-
service_name = name.downcase.start_with?('check_') ? name.gsub('check_', '') : name.downcase
|
48
|
-
item['check_command'] = command_name
|
49
|
-
|
50
|
-
nagios_command command_name do
|
51
|
-
options item
|
52
|
-
end
|
53
|
-
|
54
|
-
nagios_service service_name do
|
55
|
-
options item
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
contactgroups = nagios_bags.get(node['nagios']['contactgroups_databag'])
|
60
|
-
contactgroups.each do |item|
|
61
|
-
name = item['contactgroup_name'] || item['id']
|
62
|
-
nagios_contactgroup name do
|
63
|
-
options item
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
eventhandlers = nagios_bags.get(node['nagios']['eventhandlers_databag'])
|
68
|
-
eventhandlers.each do |item|
|
69
|
-
name = item['command_name'] || item['id']
|
70
|
-
nagios_command name do
|
71
|
-
options item
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
contacts = nagios_bags.get(node['nagios']['contacts_databag'])
|
76
|
-
contacts.each do |item|
|
77
|
-
name = item['contact_name'] || item['id']
|
78
|
-
nagios_contact name do
|
79
|
-
options item
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
hostescalations = nagios_bags.get(node['nagios']['hostescalations_databag'])
|
84
|
-
hostescalations.each do |item|
|
85
|
-
name = item['host_description'] || item['id']
|
86
|
-
nagios_hostescalation name do
|
87
|
-
options item
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
hosttemplates = nagios_bags.get(node['nagios']['hosttemplates_databag'])
|
92
|
-
hosttemplates.each do |item|
|
93
|
-
name = item['host_name'] || item['id']
|
94
|
-
item['name'] = name if item['name'].nil?
|
95
|
-
nagios_host name do
|
96
|
-
options item
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
servicedependencies = nagios_bags.get(node['nagios']['servicedependencies_databag'])
|
101
|
-
servicedependencies.each do |item|
|
102
|
-
name = item['service_description'] || item['id']
|
103
|
-
nagios_servicedependency name do
|
104
|
-
options item
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
serviceescalations = nagios_bags.get(node['nagios']['serviceescalations_databag'])
|
109
|
-
serviceescalations.each do |item|
|
110
|
-
name = item['service_description'] || item['id']
|
111
|
-
nagios_serviceescalation name do
|
112
|
-
options item
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
servicegroups = nagios_bags.get(node['nagios']['servicegroups_databag'])
|
117
|
-
servicegroups.each do |item|
|
118
|
-
name = item['servicegroup_name'] || item['id']
|
119
|
-
nagios_servicegroup name do
|
120
|
-
options item
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
templates = nagios_bags.get(node['nagios']['templates_databag'])
|
125
|
-
templates.each do |item|
|
126
|
-
name = item['name'] || item['id']
|
127
|
-
item['name'] = name
|
128
|
-
nagios_service name do
|
129
|
-
options item
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
timeperiods = nagios_bags.get(node['nagios']['timeperiods_databag'])
|
134
|
-
timeperiods.each do |item|
|
135
|
-
name = item['timeperiod_name'] || item['id']
|
136
|
-
nagios_timeperiod name do
|
137
|
-
options item
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
unmanaged_hosts = nagios_bags.get(node['nagios']['unmanagedhosts_databag'])
|
142
|
-
unmanaged_hosts.each do |item|
|
143
|
-
if node['nagios']['multi_environment_monitoring'].nil?
|
144
|
-
next if item['environment'].nil? || item['environment'] != node.chef_environment
|
145
|
-
else
|
146
|
-
envs = node['nagios']['monitored_environments']
|
147
|
-
next if item['environment'].nil? || !envs.include?(item['environment'])
|
148
|
-
end
|
149
|
-
name = item['host_name'] || item['id']
|
150
|
-
nagios_host name do
|
151
|
-
options item
|
152
|
-
end
|
153
|
-
end
|
@@ -1,241 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman <sbotman@schubergphilis.com>
|
3
|
-
# Cookbook Name:: nagios
|
4
|
-
# Recipe:: _load_default_config
|
5
|
-
#
|
6
|
-
# Copyright 2014, Sander Botman
|
7
|
-
#
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
|
20
|
-
# Find nodes to monitor.
|
21
|
-
# Search in all environments if multi_environment_monitoring is enabled.
|
22
|
-
Chef::Log.info('Beginning search for nodes. This may take some time depending on your node count')
|
23
|
-
|
24
|
-
multi_env = node['nagios']['monitored_environments']
|
25
|
-
multi_env_search = multi_env.empty? ? '' : ' AND (chef_environment:' + multi_env.join(' OR chef_environment:') + ')'
|
26
|
-
|
27
|
-
nodes = if node['nagios']['multi_environment_monitoring']
|
28
|
-
search(:node, "name:*#{multi_env_search}")
|
29
|
-
else
|
30
|
-
search(:node, "name:* AND chef_environment:#{node.chef_environment}")
|
31
|
-
end
|
32
|
-
|
33
|
-
if nodes.empty?
|
34
|
-
Chef::Log.info('No nodes returned from search, using this node so hosts.cfg has data')
|
35
|
-
nodes << node
|
36
|
-
end
|
37
|
-
|
38
|
-
# Pushing current node to prevent empty hosts.cfg
|
39
|
-
Nagios.instance.push(node)
|
40
|
-
|
41
|
-
# Pushing all nodes into the Nagios.instance model
|
42
|
-
exclude_tag = nagios_array(node['nagios']['exclude_tag_host'])
|
43
|
-
nodes.each do |n|
|
44
|
-
if n.respond_to?('tags')
|
45
|
-
Nagios.instance.push(n) unless nagios_array(n.tags).any? { |tag| exclude_tag.include?(tag) }
|
46
|
-
else
|
47
|
-
Nagios.instance.push(n)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# 24x7 timeperiod
|
52
|
-
nagios_timeperiod '24x7' do
|
53
|
-
options 'alias' => '24 Hours A Day, 7 Days A Week',
|
54
|
-
'times' => { 'sunday' => '00:00-24:00',
|
55
|
-
'monday' => '00:00-24:00',
|
56
|
-
'tuesday' => '00:00-24:00',
|
57
|
-
'wednesday' => '00:00-24:00',
|
58
|
-
'thursday' => '00:00-24:00',
|
59
|
-
'friday' => '00:00-24:00',
|
60
|
-
'saturday' => '00:00-24:00',
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
# Host checks
|
65
|
-
nagios_command 'check_host_alive' do
|
66
|
-
options 'command_line' => '$USER1$/check_ping -H $HOSTADDRESS$ -w 2000,80% -c 3000,100% -p 1'
|
67
|
-
end
|
68
|
-
|
69
|
-
# Service checks
|
70
|
-
nagios_command 'check_nagios' do
|
71
|
-
options 'command_line' => '$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_nagios -t 20'
|
72
|
-
end
|
73
|
-
|
74
|
-
# nrpe remote host checks
|
75
|
-
nagios_command 'check_nrpe_alive' do
|
76
|
-
options 'command_line' => '$USER1$/check_nrpe -H $HOSTADDRESS$ -t 20'
|
77
|
-
end
|
78
|
-
|
79
|
-
nagios_command 'check_nrpe' do
|
80
|
-
options 'command_line' => '$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 20'
|
81
|
-
end
|
82
|
-
|
83
|
-
# host_notify_by_email command
|
84
|
-
nagios_command 'host_notify_by_email' do
|
85
|
-
options 'command_line' => '/usr/bin/printf "%b" "$LONGDATETIME$\n\n$HOSTALIAS$ $NOTIFICATIONTYPE$ $HOSTSTATE$\n\n$HOSTOUTPUT$\n\nLogin: ssh://$HOSTNAME$" | ' + node['nagios']['server']['mail_command'] + ' -s "$NOTIFICATIONTYPE$ - $HOSTALIAS$ $HOSTSTATE$!" $CONTACTEMAIL$'
|
86
|
-
end
|
87
|
-
|
88
|
-
# service_notify_by_email command
|
89
|
-
nagios_command 'service_notify_by_email' do
|
90
|
-
options 'command_line' => '/usr/bin/printf "%b" "$LONGDATETIME$ - $SERVICEDESC$ $SERVICESTATE$\n\n$HOSTALIAS$ $NOTIFICATIONTYPE$\n\n$SERVICEOUTPUT$\n\nLogin: ssh://$HOSTNAME$" | ' + node['nagios']['server']['mail_command'] + ' -s "** $NOTIFICATIONTYPE$ - $HOSTALIAS$ - $SERVICEDESC$ - $SERVICESTATE$" $CONTACTEMAIL$'
|
91
|
-
end
|
92
|
-
|
93
|
-
# host_notify_by_sms_email command
|
94
|
-
nagios_command 'host_notify_by_sms_email' do
|
95
|
-
options 'command_line' => '/usr/bin/printf "%b" "$HOSTALIAS$ $NOTIFICATIONTYPE$ $HOSTSTATE$\n\n$HOSTOUTPUT$" | ' + node['nagios']['server']['mail_command'] + ' -s "$HOSTALIAS$ $HOSTSTATE$!" $CONTACTPAGER$'
|
96
|
-
end
|
97
|
-
|
98
|
-
# service_notify_by_sms_email command
|
99
|
-
nagios_command 'service_notify_by_sms_email' do
|
100
|
-
options 'command_line' => '/usr/bin/printf "%b" "$SERVICEDESC$ $NOTIFICATIONTYPE$ $SERVICESTATE$\n\n$SERVICEOUTPUT$" | ' + node['nagios']['server']['mail_command'] + ' -s "$HOSTALIAS$ $SERVICEDESC$ $SERVICESTATE$!" $CONTACTPAGER$'
|
101
|
-
end
|
102
|
-
|
103
|
-
# root contact
|
104
|
-
nagios_contact 'root' do
|
105
|
-
options 'alias' => 'Root',
|
106
|
-
'service_notification_period' => '24x7',
|
107
|
-
'host_notification_period' => '24x7',
|
108
|
-
'service_notification_options' => 'w,u,c,r',
|
109
|
-
'host_notification_options' => 'd,r',
|
110
|
-
'service_notification_commands' => 'service_notify_by_email',
|
111
|
-
'host_notification_commands' => 'host_notify_by_email',
|
112
|
-
'email' => 'root@localhost'
|
113
|
-
end
|
114
|
-
|
115
|
-
# admin contact
|
116
|
-
nagios_contact 'admin' do
|
117
|
-
options 'alias' => 'Admin',
|
118
|
-
'service_notification_period' => '24x7',
|
119
|
-
'host_notification_period' => '24x7',
|
120
|
-
'service_notification_options' => 'w,u,c,r',
|
121
|
-
'host_notification_options' => 'd,r',
|
122
|
-
'service_notification_commands' => 'service_notify_by_email',
|
123
|
-
'host_notification_commands' => 'host_notify_by_email'
|
124
|
-
end
|
125
|
-
|
126
|
-
nagios_contact 'default-contact' do
|
127
|
-
options 'name' => 'default-contact',
|
128
|
-
'service_notification_period' => '24x7',
|
129
|
-
'host_notification_period' => '24x7',
|
130
|
-
'service_notification_options' => 'w,u,c,r,f',
|
131
|
-
'host_notification_options' => 'd,u,r,f,s',
|
132
|
-
'service_notification_commands' => 'service_notify_by_email',
|
133
|
-
'host_notification_commands' => 'host_notify_by_email'
|
134
|
-
end
|
135
|
-
|
136
|
-
nagios_host 'default-host' do
|
137
|
-
options 'name' => 'default-host',
|
138
|
-
'notifications_enabled' => 1,
|
139
|
-
'event_handler_enabled' => 1,
|
140
|
-
'flap_detection_enabled' => nagios_boolean(nagios_attr(:default_host)[:flap_detection]),
|
141
|
-
'process_perf_data' => nagios_boolean(nagios_attr(:default_host)[:process_perf_data]),
|
142
|
-
'retain_status_information' => 1,
|
143
|
-
'retain_nonstatus_information' => 1,
|
144
|
-
'notification_period' => '24x7',
|
145
|
-
'register' => 0,
|
146
|
-
'action_url' => nagios_attr(:default_host)[:action_url]
|
147
|
-
end
|
148
|
-
|
149
|
-
nagios_host 'server' do
|
150
|
-
options 'name' => 'server',
|
151
|
-
'use' => 'default-host',
|
152
|
-
'check_period' => nagios_attr(:default_host)[:check_period],
|
153
|
-
'check_interval' => nagios_interval(nagios_attr(:default_host)[:check_interval]),
|
154
|
-
'retry_interval' => nagios_interval(nagios_attr(:default_host)[:retry_interval]),
|
155
|
-
'max_check_attempts' => nagios_attr(:default_host)[:max_check_attempts],
|
156
|
-
'check_command' => nagios_attr(:default_host)[:check_command],
|
157
|
-
'notification_interval' => nagios_interval(nagios_attr(:default_host)[:notification_interval]),
|
158
|
-
'notification_options' => nagios_attr(:default_host)[:notification_options],
|
159
|
-
'contact_groups' => nagios_attr(:default_contact_groups),
|
160
|
-
'register' => 0
|
161
|
-
end
|
162
|
-
|
163
|
-
# Defaut host template
|
164
|
-
Nagios.instance.default_host = node['nagios']['host_template']
|
165
|
-
|
166
|
-
# Users
|
167
|
-
# use the users_helper.rb library to build arrays of users and contacts
|
168
|
-
nagios_users = NagiosUsers.new(node)
|
169
|
-
nagios_users.users.each do |item|
|
170
|
-
o = Nagios::Contact.create(item['id'])
|
171
|
-
o.import(item.to_hash)
|
172
|
-
o.import(item['nagios'].to_hash) unless item['nagios'].nil?
|
173
|
-
o.use = 'default-contact'
|
174
|
-
end
|
175
|
-
|
176
|
-
nagios_contactgroup 'admins' do
|
177
|
-
options 'alias' => 'Nagios Administrators',
|
178
|
-
'members' => nagios_users.return_user_contacts
|
179
|
-
end
|
180
|
-
|
181
|
-
nagios_contactgroup 'admins-sms' do
|
182
|
-
options 'alias' => 'Sysadmin SMS',
|
183
|
-
'members' => nagios_users.return_user_contacts
|
184
|
-
end
|
185
|
-
|
186
|
-
# Services
|
187
|
-
nagios_service 'default-service' do
|
188
|
-
options 'name' => 'default-service',
|
189
|
-
'active_checks_enabled' => 1,
|
190
|
-
'passive_checks_enabled' => 1,
|
191
|
-
'parallelize_check' => 1,
|
192
|
-
'obsess_over_service' => 1,
|
193
|
-
'check_freshness' => 0,
|
194
|
-
'notifications_enabled' => 1,
|
195
|
-
'event_handler_enabled' => 1,
|
196
|
-
'flap_detection_enabled' => nagios_boolean(nagios_attr(:default_service)[:flap_detection]),
|
197
|
-
'process_perf_data' => nagios_boolean(nagios_attr(:default_service)[:process_perf_data]),
|
198
|
-
'retain_status_information' => 1,
|
199
|
-
'retain_nonstatus_information' => 1,
|
200
|
-
'is_volatile' => 0,
|
201
|
-
'check_period' => '24x7',
|
202
|
-
'max_check_attempts' => nagios_attr(:default_service)[:max_check_attempts],
|
203
|
-
'check_interval' => nagios_interval(nagios_attr(:default_service)[:check_interval]),
|
204
|
-
'retry_interval' => nagios_interval(nagios_attr(:default_service)[:retry_interval]),
|
205
|
-
'contact_groups' => nagios_attr(:default_contact_groups),
|
206
|
-
'notification_options' => 'w,u,c,r',
|
207
|
-
'notification_interval' => nagios_interval(nagios_attr(:default_service)[:notification_interval]),
|
208
|
-
'notification_period' => '24x7',
|
209
|
-
'register' => 0,
|
210
|
-
'action_url' => nagios_attr(:default_service)[:action_url]
|
211
|
-
end
|
212
|
-
# Default service template
|
213
|
-
Nagios.instance.default_service = 'default-service'
|
214
|
-
|
215
|
-
# Define the log monitoring template (monitoring logs is very different)
|
216
|
-
nagios_service 'default-logfile' do
|
217
|
-
options 'name' => 'default-logfile',
|
218
|
-
'use' => 'default-service',
|
219
|
-
'check_period' => '24x7',
|
220
|
-
'max_check_attempts' => 1,
|
221
|
-
'check_interval' => nagios_interval(nagios_attr(:default_service)[:check_interval]),
|
222
|
-
'retry_interval' => nagios_interval(nagios_attr(:default_service)[:retry_interval]),
|
223
|
-
'contact_groups' => nagios_attr(:default_contact_groups),
|
224
|
-
'notification_options' => 'w,u,c,r',
|
225
|
-
'notification_period' => '24x7',
|
226
|
-
'register' => 0,
|
227
|
-
'is_volatile' => 1
|
228
|
-
end
|
229
|
-
|
230
|
-
nagios_service 'service-template' do
|
231
|
-
options 'name' => 'service-template',
|
232
|
-
'max_check_attempts' => nagios_attr(:default_service)[:max_check_attempts],
|
233
|
-
'check_interval' => nagios_interval(nagios_attr(:default_service)[:check_interval]),
|
234
|
-
'retry_interval' => nagios_interval(nagios_attr(:default_service)[:retry_interval]),
|
235
|
-
'notification_interval' => nagios_interval(nagios_attr(:default_service)[:notification_interval]),
|
236
|
-
'register' => 0
|
237
|
-
end
|
238
|
-
|
239
|
-
nagios_resource 'USER1' do
|
240
|
-
options 'value' => node['nagios']['plugin_dir']
|
241
|
-
end
|