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,91 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman <sbotman@schubergphilis.com>
|
3
|
-
# Cookbook Name:: nagios
|
4
|
-
# Library:: command
|
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 command options,
|
25
|
-
# that are used within nagios configurations.
|
26
|
-
#
|
27
|
-
class Command < Nagios::Base
|
28
|
-
attr_reader :command_name,
|
29
|
-
:timeout
|
30
|
-
attr_accessor :command_line
|
31
|
-
|
32
|
-
def initialize(command_name)
|
33
|
-
cmd = command_name.split('!')
|
34
|
-
@command_name = cmd.shift
|
35
|
-
@timeout = nil
|
36
|
-
super()
|
37
|
-
end
|
38
|
-
|
39
|
-
def definition
|
40
|
-
if blank?(command_line)
|
41
|
-
"# Skipping #{command_name} because command_line is missing."
|
42
|
-
else
|
43
|
-
get_definition(configured_options, 'command')
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.create(name)
|
48
|
-
Nagios.instance.find(Nagios::Command.new(name))
|
49
|
-
end
|
50
|
-
|
51
|
-
def command_line=(command_line)
|
52
|
-
param = command_timeout(command_line)
|
53
|
-
@command_line = if @timeout.nil?
|
54
|
-
command_line
|
55
|
-
elsif param.nil?
|
56
|
-
command_line + " -t #{@timeout}"
|
57
|
-
else
|
58
|
-
command_line.gsub(param, "-t #{@timeout}")
|
59
|
-
end
|
60
|
-
@command_line
|
61
|
-
end
|
62
|
-
|
63
|
-
def import(hash)
|
64
|
-
@command_line = hash if hash.class == String
|
65
|
-
hash['command_line'] == hash['command'] unless hash['command'].nil?
|
66
|
-
update_options(hash)
|
67
|
-
end
|
68
|
-
|
69
|
-
def to_s
|
70
|
-
command_name
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
def command_timeout(command_line)
|
76
|
-
if command_line =~ /(-t *?(\d+))/
|
77
|
-
timeout = Regexp.last_match[2].to_i + 5
|
78
|
-
@timeout = timeout if @timeout.nil? || timeout > @timeout
|
79
|
-
return Regexp.last_match[1]
|
80
|
-
end
|
81
|
-
nil
|
82
|
-
end
|
83
|
-
|
84
|
-
def config_options
|
85
|
-
{
|
86
|
-
'command_name' => 'command_name',
|
87
|
-
'command_line' => 'command_line',
|
88
|
-
}
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,230 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman <sbotman@schubergphilis.com>
|
3
|
-
# Cookbook Name:: nagios
|
4
|
-
# Library:: contact
|
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 contact options,
|
25
|
-
# that are used within nagios configurations.
|
26
|
-
#
|
27
|
-
class Contact < Nagios::Base
|
28
|
-
attr_reader :contact_name,
|
29
|
-
:contactgroups,
|
30
|
-
:custom_options
|
31
|
-
|
32
|
-
attr_accessor :alias,
|
33
|
-
:host_notifications_enabled,
|
34
|
-
:service_notifications_enabled,
|
35
|
-
:host_notification_period,
|
36
|
-
:service_notification_period,
|
37
|
-
:host_notification_options,
|
38
|
-
:service_notification_options,
|
39
|
-
:host_notification_commands,
|
40
|
-
:service_notification_commands,
|
41
|
-
:email,
|
42
|
-
:pager,
|
43
|
-
:addressx,
|
44
|
-
:can_submit_commands,
|
45
|
-
:retain_status_information,
|
46
|
-
:retain_nonstatus_information
|
47
|
-
|
48
|
-
def initialize(contact_name)
|
49
|
-
@contact_name = contact_name
|
50
|
-
@contactgroups = {}
|
51
|
-
@host_notification_commands = []
|
52
|
-
@service_notification_commands = []
|
53
|
-
@custom_options = {}
|
54
|
-
super()
|
55
|
-
end
|
56
|
-
|
57
|
-
def contactgroups_list
|
58
|
-
@contactgroups.values.map(&:to_s).sort.join(',')
|
59
|
-
end
|
60
|
-
|
61
|
-
def definition
|
62
|
-
if email.nil? && name.nil? && pager.nil?
|
63
|
-
"# Skipping #{contact_name} because missing email/pager."
|
64
|
-
else
|
65
|
-
configured = configured_options
|
66
|
-
custom_options.each { |_, v| configured[v.to_s] = v.value }
|
67
|
-
get_definition(configured, 'contact')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.create(name)
|
72
|
-
Nagios.instance.find(Nagios::Contact.new(name))
|
73
|
-
end
|
74
|
-
|
75
|
-
def host_notification_commands
|
76
|
-
get_commands(@host_notification_commands)
|
77
|
-
end
|
78
|
-
|
79
|
-
def host_notification_commands=(obj)
|
80
|
-
@host_notification_commands = notification_commands(obj)
|
81
|
-
end
|
82
|
-
|
83
|
-
def host_notification_period
|
84
|
-
get_timeperiod(@host_notification_period)
|
85
|
-
end
|
86
|
-
|
87
|
-
def import(hash)
|
88
|
-
update_options(hash)
|
89
|
-
update_members(hash, 'contactgroups', Nagios::Contactgroup, true)
|
90
|
-
end
|
91
|
-
|
92
|
-
def push(obj)
|
93
|
-
case obj
|
94
|
-
when Nagios::Contactgroup
|
95
|
-
push_object(obj, @contactgroups)
|
96
|
-
when Nagios::Timeperiod
|
97
|
-
@host_notification_period = obj
|
98
|
-
@service_notification_period = obj
|
99
|
-
when Nagios::CustomOption
|
100
|
-
push_object(obj, @custom_options)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def pop(obj)
|
105
|
-
return if obj == self
|
106
|
-
case obj
|
107
|
-
when Nagios::Contactgroup
|
108
|
-
if @contactgroups.keys?(obj.to_s)
|
109
|
-
pop_object(obj, @contactgroups)
|
110
|
-
pop(self, obj)
|
111
|
-
end
|
112
|
-
when Nagios::Timeperiod
|
113
|
-
@host_notification_period = nil if obj == @host_notification_period
|
114
|
-
@service_notification_period = nil if obj == @service_notification_period
|
115
|
-
when Nagios::CustomOption
|
116
|
-
if @custom_options.keys?(obj.to_s)
|
117
|
-
pop_object(obj, @custom_options)
|
118
|
-
pop(self, obj)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
def service_notification_commands
|
125
|
-
get_commands(@service_notification_commands)
|
126
|
-
end
|
127
|
-
|
128
|
-
def service_notification_commands=(obj)
|
129
|
-
@service_notification_commands = notification_commands(obj)
|
130
|
-
end
|
131
|
-
|
132
|
-
def service_notification_period
|
133
|
-
get_timeperiod(@service_notification_period)
|
134
|
-
end
|
135
|
-
|
136
|
-
def to_s
|
137
|
-
contact_name
|
138
|
-
end
|
139
|
-
|
140
|
-
# check the True/False options
|
141
|
-
# default = nil
|
142
|
-
def host_notifications_enabled=(arg)
|
143
|
-
@host_notifications_enabled = check_bool(arg)
|
144
|
-
end
|
145
|
-
|
146
|
-
def service_notifications_enabled=(arg)
|
147
|
-
@service_notifications_enabled = check_bool(arg)
|
148
|
-
end
|
149
|
-
|
150
|
-
def can_submit_commands=(arg)
|
151
|
-
@can_submit_commands = check_bool(arg)
|
152
|
-
end
|
153
|
-
|
154
|
-
def retain_status_information=(arg)
|
155
|
-
@retain_status_information = check_bool(arg)
|
156
|
-
end
|
157
|
-
|
158
|
-
def retain_nonstatus_information=(arg)
|
159
|
-
@retain_nonstatus_information = check_bool(arg)
|
160
|
-
end
|
161
|
-
|
162
|
-
# check other options
|
163
|
-
#
|
164
|
-
# host_notification_options
|
165
|
-
# This directive is used to define the host states for which notifications
|
166
|
-
# can be sent out to this contact.
|
167
|
-
# Valid options are a combination of one or more of the following:
|
168
|
-
# d = notify on DOWN host states,
|
169
|
-
# u = notify on UNREACHABLE host states,
|
170
|
-
# r = notify on host recoveries (UP states),
|
171
|
-
# f = notify when the host starts and stops flapping,
|
172
|
-
# s = send notifications when host or service scheduled downtime starts and ends.
|
173
|
-
#
|
174
|
-
# If you specify n (none) as an option, the contact will not receive any type of
|
175
|
-
# host notifications.
|
176
|
-
def host_notification_options=(arg)
|
177
|
-
@host_notification_options = check_state_options(
|
178
|
-
arg, %w(d u r f s n), 'host_notification_options')
|
179
|
-
end
|
180
|
-
|
181
|
-
# service_notification_options
|
182
|
-
# This directive is used to define the service states for which notifications
|
183
|
-
# can be sent out to this contact.
|
184
|
-
# Valid options are a combination of one or more of the following:
|
185
|
-
# w = notify on WARNING service states,
|
186
|
-
# u = notify on UNKNOWN service states,
|
187
|
-
# c = notify on CRITICAL service states,
|
188
|
-
# r = notify on service recoveries (OK states),
|
189
|
-
# f = notify when the service starts and stops flapping.
|
190
|
-
#
|
191
|
-
# If you specify n (none) as an option, the contact will not receive any type of
|
192
|
-
# service notifications.
|
193
|
-
def service_notification_options=(arg)
|
194
|
-
@service_notification_options = check_state_options(
|
195
|
-
arg, %w(w u c r f n), 'service_notification_options')
|
196
|
-
end
|
197
|
-
|
198
|
-
private
|
199
|
-
|
200
|
-
def config_options
|
201
|
-
{
|
202
|
-
'name' => 'name',
|
203
|
-
'use' => 'use',
|
204
|
-
'contact_name' => 'contact_name',
|
205
|
-
'contactgroups_list' => 'contactgroups',
|
206
|
-
'alias' => 'alias',
|
207
|
-
'host_notifications_enabled' => 'host_notifications_enabled',
|
208
|
-
'service_notifications_enabled' => 'service_notifications_enabled',
|
209
|
-
'host_notification_period' => 'host_notification_period',
|
210
|
-
'service_notification_period' => 'service_notification_period',
|
211
|
-
'host_notification_options' => 'host_notification_options',
|
212
|
-
'service_notification_options' => 'service_notification_options',
|
213
|
-
'host_notification_commands' => 'host_notification_commands',
|
214
|
-
'service_notification_commands' => 'service_notification_commands',
|
215
|
-
'email' => 'email',
|
216
|
-
'pager' => 'pager',
|
217
|
-
'addressx' => 'addressx',
|
218
|
-
'can_submit_commands' => 'can_submit_commands',
|
219
|
-
'retain_status_information' => 'retain_status_information',
|
220
|
-
'retain_nonstatus_information' => 'retain_nonstatus_information',
|
221
|
-
'register' => 'register',
|
222
|
-
}
|
223
|
-
end
|
224
|
-
|
225
|
-
def merge_members(obj)
|
226
|
-
obj.contactgroups.each { |m| push(m) }
|
227
|
-
obj.custom_options.each { |_, m| push(m) }
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman <sbotman@schubergphilis.com>
|
3
|
-
# Cookbook Name:: nagios
|
4
|
-
# Library:: contactgroup
|
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 'nagios'
|
21
|
-
|
22
|
-
class Nagios
|
23
|
-
#
|
24
|
-
# This class holds all methods with regard to contactgroup options,
|
25
|
-
# that are used within nagios configurations.
|
26
|
-
#
|
27
|
-
class Contactgroup < Nagios::Base
|
28
|
-
attr_reader :contactgroup_name,
|
29
|
-
:members,
|
30
|
-
:contactgroup_members
|
31
|
-
|
32
|
-
attr_accessor :alias
|
33
|
-
|
34
|
-
def initialize(contactgroup_name)
|
35
|
-
@contactgroup_name = contactgroup_name
|
36
|
-
@members = {}
|
37
|
-
@contactgroup_members = {}
|
38
|
-
super()
|
39
|
-
end
|
40
|
-
|
41
|
-
def contactgroup_members_list
|
42
|
-
@contactgroup_members.values.map(&:to_s).sort.join(',')
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.create(name)
|
46
|
-
Nagios.instance.find(Nagios::Contactgroup.new(name))
|
47
|
-
end
|
48
|
-
|
49
|
-
def definition
|
50
|
-
get_definition(configured_options, 'contactgroup')
|
51
|
-
end
|
52
|
-
|
53
|
-
def import(hash)
|
54
|
-
update_options(hash)
|
55
|
-
update_members(hash, 'members', Nagios::Contact, true)
|
56
|
-
update_members(hash, 'contactgroups_members', Nagios::Contactgroup, true)
|
57
|
-
end
|
58
|
-
|
59
|
-
def members_list
|
60
|
-
@members.values.map(&:to_s).sort.join(',')
|
61
|
-
end
|
62
|
-
|
63
|
-
def push(obj)
|
64
|
-
case obj
|
65
|
-
when Nagios::Contact
|
66
|
-
push_object(obj, @members)
|
67
|
-
when Nagios::Contactgroup
|
68
|
-
push_object(obj, @contactgroup_members)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def pop(obj)
|
73
|
-
return if obj == self
|
74
|
-
case obj
|
75
|
-
when Nagios::Contact
|
76
|
-
if @members.keys?(obj.to_s)
|
77
|
-
pop_object(obj, @members)
|
78
|
-
pop(self, obj)
|
79
|
-
end
|
80
|
-
when Nagios::Contactgroup
|
81
|
-
if @contactgroups_members.keys?(obj.to_s)
|
82
|
-
pop_object(obj, @contactgroup_members)
|
83
|
-
pop(self, obj)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
|
89
|
-
def to_s
|
90
|
-
contactgroup_name
|
91
|
-
end
|
92
|
-
|
93
|
-
private
|
94
|
-
|
95
|
-
def config_options
|
96
|
-
{
|
97
|
-
'name' => 'name',
|
98
|
-
'use' => 'use',
|
99
|
-
'contactgroup_name' => 'contactgroup_name',
|
100
|
-
'members_list' => 'members',
|
101
|
-
'contactgroup_members_list' => 'contactgroup_members',
|
102
|
-
'alias' => 'alias',
|
103
|
-
'register' => 'register',
|
104
|
-
}
|
105
|
-
end
|
106
|
-
|
107
|
-
def merge_members(obj)
|
108
|
-
obj.members.each { |m| push(m) }
|
109
|
-
obj.contactgroup_members.each { |m| push(m) }
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman <sbotman@schubergphilis.com>
|
3
|
-
# Cookbook Name:: nagios
|
4
|
-
# Library:: custom_option
|
5
|
-
#
|
6
|
-
# Copyright 2015, 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
|
-
class Nagios
|
21
|
-
#
|
22
|
-
# This class holds all methods with regard to custom_options
|
23
|
-
#
|
24
|
-
class CustomOption
|
25
|
-
attr_reader :value
|
26
|
-
|
27
|
-
def initialize(option, value)
|
28
|
-
@option = option
|
29
|
-
@value = value
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_s
|
33
|
-
@option
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|