+ Class manages /etc/nagios/conf.d/nagios_add_contactgroups.cfg file
+and populates through define and external puppet rules
+
+
Overview
+
+
+
+
cd_nagios::nagios::objects::add_contactgroups_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/.
Defined Type: cd_nagios::nagios::objects::add_contactgroups
+
+
+
Defined in:
+
+ manifests/nagios/objects/add_contactgroups.pp
+
+
+
+
+
Summary
+ Define populates /etc/nagios/conf.d/nagios_add_contactgroups through
+external puppet rules.
+
+
Overview
+
+
+
+
cd_nagios::nagios::objects::add_contactgroups.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 e2e06ec..052b4cd 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 9e75a34..9d108ac 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 f0c25a4..1a19bb7 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.pp b/manifests/nagios/objects/add_contactgroups.pp
new file mode 100644
index 0000000..b5e6fb0
--- /dev/null
+++ b/manifests/nagios/objects/add_contactgroups.pp
@@ -0,0 +1,43 @@
+## cd_nagios::nagios::objects::add_contactgroups.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_add_contactgroups through
+# external puppet rules.
+################################################################################
+define cd_nagios::nagios::objects::add_contactgroups (
+
+$ng_contactgroup_name = undef,
+$ng_contactgroup_alias = undef,
+$ng_contactgroup_register = '1',
+
+) {
+
+$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
+$ng_tgt_contactgroup_add = $::cd_nagios::params::ng_tgt_contactgroup_add
+
+
+ if $::fqdn == $ng_nagios_server {
+
+ concat::fragment { $name:
+ target => $ng_tgt_contactgroup_add,
+ content => template($ng_contacts_rule_erb),
+ }
+ }
+}
diff --git a/manifests/nagios/objects/add_contactgroups_rules.pp b/manifests/nagios/objects/add_contactgroups_rules.pp
new file mode 100644
index 0000000..a1d83fc
--- /dev/null
+++ b/manifests/nagios/objects/add_contactgroups_rules.pp
@@ -0,0 +1,66 @@
+## cd_nagios::nagios::objects::add_contactgroups_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_add_contactgroups.cfg file
+# and populates through define and external puppet rules
+# @example
+# cd_nagios::nagios::objects::add_contactgroups { 'example_group':
+# ng_contactgroup_name => 'example_group',
+# ng_contactgroup_alias => 'Example Group',
+# ng_contactgroup_register => '1',
+# }
+################################################################################
+class cd_nagios::nagios::objects::add_contactgroups_rules (
+
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+
+ # manage /etc/nagios/conf.d/nagios_add_contactgroups.cfg
+
+ concat { $ng_tgt_contactgroup_add:
+ ensure => present,
+ path => $ng_tgt_contactgroup_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 { 'contactgroups_header':
+ target => $ng_tgt_contactgroup_add,
+ 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/contactgroups.pp b/manifests/nagios/objects/contactgroups.pp
index 0697db5..a324c33 100644
--- a/manifests/nagios/objects/contactgroups.pp
+++ b/manifests/nagios/objects/contactgroups.pp
@@ -18,6 +18,18 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
+# @summary Class manages base contactgroups which always should be there.
+# @example
+# @@nagios_contactgroup { 'admins':
+# ensure => present,
+# alias => 'Nagios Administrators',
+# contactgroup_name => 'admins',
+# owner => $ng_user,
+# group => $ng_user,
+# mode => '0640',
+# register => '1',
+# target => $ng_tgt_contactgroup_base,
+# }
################################################################################
class cd_nagios::nagios::objects::contactgroups (
diff --git a/manifests/params.pp b/manifests/params.pp
index 37d50c5..1589b8a 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -976,6 +976,9 @@ $ng_target_add_contact = "${ng_conf_d_dir}/nagios_add_contact.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"
+$ng_tgt_contactgroup_add = "${ng_conf_d_dir}/nagios_contactgroup_add.cfg"
+$ng_cntctgrps_head_erb = 'cd_nagios/nagios/contactgroups_cfg_head.erb'
+$ng_cntctgrps_rule_erb = 'cd_nagios/nagios/contactgroups_cfg_rule.erb'
$ng_target_command = "${ng_conf_d_dir}/nagios_command.cfg"
diff --git a/templates/nagios/contactgroups_cfg_head.erb b/templates/nagios/contactgroups_cfg_head.erb
new file mode 100644
index 0000000..31e8a7b
--- /dev/null
+++ b/templates/nagios/contactgroups_cfg_head.erb
@@ -0,0 +1,8 @@
+###############################################################################
+########## nagios_add_contactgroups.cfg created by Puppet ##########
+########## manual changes are overwritten! ##########
+###############################################################################
+########## Full reference file available at ##########
+########## https://confdroid.com/2017/07/nagios-contacts-cfg/ ##########
+###############################################################################
+# rules are created below by external puppet rules.
diff --git a/templates/nagios/contactgroups_cfg_rule.erb b/templates/nagios/contactgroups_cfg_rule.erb
new file mode 100644
index 0000000..f4bbd98
--- /dev/null
+++ b/templates/nagios/contactgroups_cfg_rule.erb
@@ -0,0 +1,5 @@
+define contactgroup {
+ contactgroup_name <%= @ng_contactgroup_name %>
+ alias <%= @ng_contactgroup_alias %>
+ register <%= @ng_contactgroup_register %>
+ }
diff --git a/templates/nagios/contacts_cfg.erb b/templates/nagios/contacts.cfg
similarity index 100%
rename from templates/nagios/contacts_cfg.erb
rename to templates/nagios/contacts.cfg