diff --git a/README.md b/README.md
index d5cdefa..525768a 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,7 @@ Configuration
* manage Nagios main contacts through Puppet exports. Additional contacts can be created through external Puppet rules via define, to avoid having to alter the module code.
* manage Nagios main contactgroups through Puppet exports. Additional contact groups can be created through external Puppet rules via define, to avoid having to alter the module code.
* manage Nagios main hostgroups through Puppet exports. Additional host groups can be created through external Puppet rules via define, to avoid having to alter the module code.
+* manage Nagios main servicegroups through Puppet exports. Additional service groups can be created through external Puppet rules via define, to avoid having to alter the module code.
* configure NRPE on clients (optional)
* configure firewall (optional)
* configure selinux policies (optional)
diff --git a/REPOSTRUCTURE.md b/REPOSTRUCTURE.md
index 646eb7f..22736c6 100644
--- a/REPOSTRUCTURE.md
+++ b/REPOSTRUCTURE.md
@@ -65,11 +65,14 @@
| | |-- add_contact_rules.pp
| | |-- add_hostgroup_rules.pp
| | |-- add_hostgroups.pp
+| | |-- add_servicegroup_rules.pp
+| | |-- add_servicegroups.pp
| | |-- commands.pp
| | |-- config.pp
| | |-- contactgroups.pp
| | |-- contacts.pp
| | |-- hostgroups.pp
+| | |-- servicegroups.pp
| | |-- template_rules.pp
| | `-- templates.pp
| |-- selinux
@@ -101,6 +104,8 @@
| | |-- hostgroups_cfg_rule.erb
| | |-- htpasswd_rule.erb
| | |-- nagios_cfg.erb
+| | |-- svcgroups_cfg_head.erb
+| | |-- svcgroups_cfg_rule.erb
| | |-- templates_cfg_head.erb
| | `-- templates_cfg_rule.erb
| `-- selinux
@@ -116,4 +121,4 @@
|-- README.md
`-- REPOSTRUCTURE.md
-20 directories, 96 files
+20 directories, 101 files
diff --git a/doc/_index.html b/doc/_index.html
index 38e887d..2e4ee8d 100644
--- a/doc/_index.html
+++ b/doc/_index.html
@@ -123,6 +123,11 @@
+
cd_nagios::nagios::objects::templates
@@ -246,7 +261,7 @@
diff --git a/doc/file.README.html b/doc/file.README.html
index 3ff9e43..3bc23eb 100644
--- a/doc/file.README.html
+++ b/doc/file.README.html
@@ -161,15 +161,18 @@ the module code.
* manage Nagios main hostgroups through Puppet exports.
Additional host groups can be created through external Puppet rules via
define, to avoid having to alter the module code.
-* configure NRPE on
-clients (optional)
-* configure firewall (optional)
-* configure selinux
-policies (optional)
-* configure forwarding http to https including accesing
-the /nagios url directly (optional)
-* manage TLS certificates through
-certbot (optional)
+* manage Nagios main
+servicegroups through Puppet exports. Additional service groups can be
+created through external Puppet rules via define, to avoid having to alter
+the module code.
+* configure NRPE on clients (optional)
+* configure
+firewall (optional)
+* configure selinux policies (optional)
+* configure
+forwarding http to https including accesing the /nagios url directly
+(optional)
+* manage TLS certificates through certbot (optional)
Service
* manage Nagios service on server
@@ -369,7 +372,7 @@ environments.
diff --git a/doc/index.html b/doc/index.html
index e40e30e..b625eb3 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -161,15 +161,18 @@ the module code.
* manage Nagios main hostgroups through Puppet exports.
Additional host groups can be created through external Puppet rules via
define, to avoid having to alter the module code.
-* configure NRPE on
-clients (optional)
-* configure firewall (optional)
-* configure selinux
-policies (optional)
-* configure forwarding http to https including accesing
-the /nagios url directly (optional)
-* manage TLS certificates through
-certbot (optional)
+* manage Nagios main
+servicegroups through Puppet exports. Additional service groups can be
+created through external Puppet rules via define, to avoid having to alter
+the module code.
+* configure NRPE on clients (optional)
+* configure
+firewall (optional)
+* configure selinux policies (optional)
+* configure
+forwarding http to https including accesing the /nagios url directly
+(optional)
+* manage TLS certificates through certbot (optional)
Service
* manage Nagios service on server
@@ -369,7 +372,7 @@ environments.
+ Class manages /etc/nagios_conf.d/nagios_servicegroups_add.cfg and
+additional servicegroups through external Puppet rules via define.
+
+
Overview
+
+
+
+
cd_nagios::nagios::objects::add_servicegroup_rules.pp
+Module name:
+cd_nagios
+Author: Arne Teuke (arne_teuke@ConfDroid.com)
+
+
License:
+
+
This file is part of cd_nagios.
+
+
cd_nagios is used for providing automatic configuration of Nagios
+
+Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
+ This program is
+free software: you can redistribute it and/or modify
+ it under the terms of
+the GNU General Public License as published by
+ the Free Software
+Foundation, either version 3 of the License, or
+ (at your option) any later
+version.
+
+
This program is distributed in the hope that it will be useful,
+ but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License
+for more details.
+
+
You should have received a copy of the GNU General Public License
+ along
+with this program. If not, see www.gnu.org/licenses/.
cd_nagios is used for providing automatic configuration of Nagios
+
+Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
+ This program is
+free software: you can redistribute it and/or modify
+ it under the terms of
+the GNU General Public License as published by
+ the Free Software
+Foundation, either version 3 of the License, or
+ (at your option) any later
+version.
+
+
This program is distributed in the hope that it will be useful,
+ but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License
+for more details.
+
+
You should have received a copy of the GNU General Public License
+ along
+with this program. If not, see www.gnu.org/licenses/.
Defined Type: cd_nagios::nagios::objects::add_servicegroups
+
+
+
Defined in:
+
+ manifests/nagios/objects/add_servicegroups.pp
+
+
+
+
+
Summary
+ define populates /etc/nagios/conf.d/nagios_servicegroups_add through
+extermal Puppet rules.
+
+
Overview
+
+
+
+
cd_nagios::nagios::objects::add_servicegroups.pp
+Module name:
+cd_nagios
+Author: Arne Teuke (arne_teuke@ConfDroid.com)
+
+
License:
+
+
This file is part of cd_nagios.
+
+
cd_nagios is used for providing automatic configuration of Nagios
+
+Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
+ This program is
+free software: you can redistribute it and/or modify
+ it under the terms of
+the GNU General Public License as published by
+ the Free Software
+Foundation, either version 3 of the License, or
+ (at your option) any later
+version.
+
+
This program is distributed in the hope that it will be useful,
+ but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License
+for more details.
+
+
You should have received a copy of the GNU General Public License
+ along
+with this program. If not, see www.gnu.org/licenses/
+
+
\ No newline at end of file
diff --git a/doc/puppet_defined_types/cd_nagios_3A_3Anagios_3A_3Aobjects_3A_3Atemplates.html b/doc/puppet_defined_types/cd_nagios_3A_3Anagios_3A_3Aobjects_3A_3Atemplates.html
index 291de3d..6452b21 100644
--- a/doc/puppet_defined_types/cd_nagios_3A_3Anagios_3A_3Aobjects_3A_3Atemplates.html
+++ b/doc/puppet_defined_types/cd_nagios_3A_3Anagios_3A_3Aobjects_3A_3Atemplates.html
@@ -935,7 +935,7 @@ $ng_templates_rule_erb = $::cd_nagios::params::ng_templates_rule_erb
diff --git a/doc/puppet_defined_types/cd_nagios_3A_3Aserver_3A_3Aaccess.html b/doc/puppet_defined_types/cd_nagios_3A_3Aserver_3A_3Aaccess.html
index 8e1ed8c..9183481 100644
--- a/doc/puppet_defined_types/cd_nagios_3A_3Aserver_3A_3Aaccess.html
+++ b/doc/puppet_defined_types/cd_nagios_3A_3Aserver_3A_3Aaccess.html
@@ -220,7 +220,7 @@ $ng_service = $::cd_nagios::params::ng_service
diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html
index cfa9172..077ffa6 100644
--- a/doc/top-level-namespace.html
+++ b/doc/top-level-namespace.html
@@ -90,7 +90,7 @@
diff --git a/manifests/nagios/objects/add_contactgroups_rules.pp b/manifests/nagios/objects/add_contactgroups_rules.pp
index a1d83fc..418a40c 100644
--- a/manifests/nagios/objects/add_contactgroups_rules.pp
+++ b/manifests/nagios/objects/add_contactgroups_rules.pp
@@ -56,11 +56,5 @@ class cd_nagios::nagios::objects::add_contactgroups_rules (
content => template($ng_cntctgrps_head_erb),
order => '000',
}
-
- cd_nagios::nagios::objects::add_contactgroups { 'example_group':
- ng_contactgroup_name => 'example_group',
- ng_contactgroup_alias => 'Example Group',
- ng_contactgroup_register => '1',
- }
}
}
diff --git a/manifests/nagios/objects/add_hostgroup_rules.pp b/manifests/nagios/objects/add_hostgroup_rules.pp
index 8f884a3..740c1bb 100644
--- a/manifests/nagios/objects/add_hostgroup_rules.pp
+++ b/manifests/nagios/objects/add_hostgroup_rules.pp
@@ -55,10 +55,5 @@ class cd_nagios::nagios::objects::add_hostgroup_rules (
content => template($ng_tgt_hostgrp_head_erb),
order => '000',
}
-
- cd_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
- ng_hostgroup_name => 'example_hostgroup',
- ng_hostgroup_alias => 'Example Hostgroup',
- }
}
}
diff --git a/manifests/nagios/objects/add_servicegroup_rules.pp b/manifests/nagios/objects/add_servicegroup_rules.pp
new file mode 100644
index 0000000..208286e
--- /dev/null
+++ b/manifests/nagios/objects/add_servicegroup_rules.pp
@@ -0,0 +1,64 @@
+## cd_nagios::nagios::objects::add_servicegroup_rules.pp
+# Module name: cd_nagios
+# Author: Arne Teuke (arne_teuke@ConfDroid.com)
+# # License:
+# This file is part of cd_nagios.
+#
+# cd_nagios is used for providing automatic configuration of Nagios
+# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+# @summary Class manages /etc/nagios_conf.d/nagios_servicegroups_add.cfg and
+# additional servicegroups through external Puppet rules via define.
+# @example
+# cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
+# ng_servicegroup_name => 'example_servicegroup',
+# ng_servicegroup_alias => 'Example Servicegroup',
+# }
+################################################################################
+class cd_nagios::nagios::objects::add_servicegroup_rules (
+
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+
+ # manage /etc/nagios_conf.d/nagios_servicegroups_add.cfg
+
+ concat { $ng_tgt_servicegroup_add:
+ ensure => present,
+ path => $ng_tgt_servicegroup_add,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ # manage file header
+
+ concat::fragment { 'servicegroups_header':
+ target => $ng_tgt_servicegroup_add,
+ content => template($ng_tgt_svcgrp_head_erb),
+ order => '000',
+ }
+
+ cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
+ ng_servicegroup_name => 'example_servicegroup',
+ ng_servicegroup_alias => 'Example Servicegroup',
+ }
+ }
+}
diff --git a/manifests/nagios/objects/add_servicegroups.pp b/manifests/nagios/objects/add_servicegroups.pp
new file mode 100644
index 0000000..77f9314
--- /dev/null
+++ b/manifests/nagios/objects/add_servicegroups.pp
@@ -0,0 +1,48 @@
+## cd_nagios::nagios::objects::add_servicegroups.pp
+# Module name: cd_nagios
+# Author: Arne Teuke (arne_teuke@ConfDroid.com)
+# # License:
+# This file is part of cd_nagios.
+#
+# cd_nagios is used for providing automatic configuration of Nagios
+# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# @summary define populates /etc/nagios/conf.d/nagios_servicegroups_add through
+# extermal Puppet rules.
+# @example
+# cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
+# ng_servicegroup_name => 'example_servicegroup',
+# ng_servicegroup_alias => 'Example servicegroup',
+# }
+###############################################################################
+define cd_nagios::nagios::objects::add_servicegroups (
+
+$ng_servicegroup_name = undef,
+$ng_servicegroup_alias = undef,
+$ng_servicegroup_register = '1',
+
+) {
+
+$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
+$ng_tgt_servicegroup_add = $::cd_nagios::params::ng_tgt_servicegroup_add
+$ng_tgt_svcgrp_rule_erb = $::cd_nagios::params::ng_tgt_svcgrp_rule_erb
+
+ if $::fqdn == $ng_nagios_server {
+
+ concat::fragment { $name:
+ target => $ng_tgt_servicegroup_add,
+ content => template($ng_tgt_svcgrp_rule_erb),
+ }
+ }
+}
diff --git a/manifests/nagios/objects/config.pp b/manifests/nagios/objects/config.pp
index 31713ce..ff1953b 100644
--- a/manifests/nagios/objects/config.pp
+++ b/manifests/nagios/objects/config.pp
@@ -34,6 +34,7 @@ class cd_nagios::nagios::objects::config (
require cd_nagios::nagios::objects::add_contactgroups_rules
require cd_nagios::nagios::objects::hostgroups
require cd_nagios::nagios::objects::add_hostgroup_rules
-
+ require cd_nagios::nagios::objects::servicegroups
+ require cd_nagios::nagios::objects::add_servicegroup_rules
}
}
diff --git a/manifests/nagios/objects/servicegroups.pp b/manifests/nagios/objects/servicegroups.pp
new file mode 100644
index 0000000..a73f0e2
--- /dev/null
+++ b/manifests/nagios/objects/servicegroups.pp
@@ -0,0 +1,70 @@
+## cd_nagios::nagios::objects::servicegroups.pp
+# Module name: cd_nagios
+# Author: Arne Teuke (arne_teuke@ConfDroid.com)
+# # License:
+# This file is part of cd_nagios.
+#
+# cd_nagios is used for providing automatic configuration of Nagios
+# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+# @summary Class manages basic hostgroups known to NAGIOS through Puppet
+# exports, and populates /etc/nagios/conf.d/nagios_base_hostgroups.cfg.
+################################################################################
+class cd_nagios::nagios::objects::servicegroups (
+
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+
+ # network services
+
+ @@nagios_servicegroup { 'network-services':
+ ensure => present,
+ servicegroup_name => 'network-services',
+ alias => 'Network Services',
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ register => '1',
+ target => $ng_target_svcgrp_base,
+ }
+
+ # linux services
+
+ @@nagios_servicegroup { 'linux-services':
+ ensure => present,
+ servicegroup_name => 'linux-services',
+ alias => 'Linux Services',
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ register => '1',
+ target => $ng_target_svcgrp_base,
+ }
+
+ # database services
+
+ @@nagios_servicegroup { 'database-services':
+ ensure => present,
+ servicegroup_name => 'database-services',
+ alias => 'Database Services',
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ register => '1',
+ target => $ng_target_svcgrp_base,
+ }
+ }
+}
diff --git a/manifests/params.pp b/manifests/params.pp
index 4e33fd5..b5832b4 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -892,6 +892,8 @@ $ng_check_workers = '',
$ng_host_down_svc_checks = '0',
$ng_enable_load_ctl_options = false,
$ng_loadctl_options = 'jobs_max=100;backoff_limit=10;rampup_change=5',
+$ng_nagios_service_cmd = 'check_nagios!/var/log/nagios/status.dat!5!/usr/sbin/nagios',
+
) {
# installation section
@@ -973,9 +975,12 @@ $ng_target_hostdep = "${ng_conf_d_dir}/nagios_hostdependency.cfg"
$ng_target_hostesc = "${ng_conf_d_dir}/nagios_hostescalation.cfg"
$ng_target_hostext = "${ng_conf_d_dir}/nagios_hostextinfo.cfg"
$ng_target_service = "${ng_conf_d_dir}/nagios_service.cfg"
-$ng_target_servicegroup = "${ng_conf_d_dir}/nagios_servicegroup.cfg"
-$ng_target_base_contact = "${ng_conf_d_dir}/nagios_base_contact.cfg"
-$ng_target_add_contact = "${ng_conf_d_dir}/nagios_add_contact.cfg"
+$ng_target_svcgrp_base = "${ng_conf_d_dir}/nagios_servicegroups_base.cfg"
+$ng_tgt_servicegroup_add = "${ng_conf_d_dir}/nagios_servicegroups_add.cfg"
+$ng_tgt_svcgrp_head_erb = 'cd_nagios/nagios/svcgroups_cfg_head.erb'
+$ng_tgt_hostgrp_rule_erb = 'cd_nagios/nagios/svcgroups_cfg_rule.erb'
+$ng_target_base_contact = "${ng_conf_d_dir}/nagios_contact_base.cfg"
+$ng_target_add_contact = "${ng_conf_d_dir}/nagios_contact_add.cfg"
$ng_contacts_head_erb = 'cd_nagios/nagios/contacts_cfg_head.erb'
$ng_contacts_rule_erb = 'cd_nagios/nagios/contacts_cfg_rule.erb'
$ng_tgt_contactgroup_base = "${ng_conf_d_dir}/nagios_contactgroup_base.cfg"
diff --git a/manifests/server/service.pp b/manifests/server/service.pp
index 6df3ab6..949d951 100644
--- a/manifests/server/service.pp
+++ b/manifests/server/service.pp
@@ -54,13 +54,13 @@ class cd_nagios::server::service (
notify => Service ['nagios'],
}
- @@nagios_service { "check_nagios_localhost":
- check_command => 'check_nagios!/var/log/nagios/status.dat!5!/usr/sbin/nagios',
+ @@nagios_service { 'check_nagios_localhost':
+ check_command => $ng_nagios_service_cmd,
use => 'generic-service',
host_name => 'localhost',
notification_period => '24x7',
- service_description => 'localhost_nagios_service',
- target => $ng_target_service,
+ service_description => 'localhost_nagios_service',
+ target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
diff --git a/templates/nagios/svcgroups_cfg_head.erb b/templates/nagios/svcgroups_cfg_head.erb
new file mode 100644
index 0000000..7612129
--- /dev/null
+++ b/templates/nagios/svcgroups_cfg_head.erb
@@ -0,0 +1,5 @@
+###############################################################################
+########## nagios_servicegroups_add.cfg created by Puppet ##########
+########## manual changes are overwritten! ##########
+###############################################################################
+# rules are created below by external puppet rules.
diff --git a/templates/nagios/svcgroups_cfg_rule.erb b/templates/nagios/svcgroups_cfg_rule.erb
new file mode 100644
index 0000000..4d5e62b
--- /dev/null
+++ b/templates/nagios/svcgroups_cfg_rule.erb
@@ -0,0 +1,6 @@
+
+define servicegroup {
+ servicegroup_name <%= @ng_servicegroup_name %>
+ alias <%= @ng_servicegroup_alias %>
+ register <%= @ng_servicegroup_register %>
+ }