Files
confdroid_nagios/manifests/nagios/objects/add_contact.pp
2017-07-27 14:33:00 +01:00

58 lines
2.4 KiB
Puppet

## cd_nagios::nagios::objects::add_contact.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 <http://www.gnu.org/licenses/>.
# @summary Define manages additional contacts known to NAGIOS through external
# Puppet rules, and populates /etc/nagios/conf.d/nagios_add_contact.cfg.
# @example
# cd_nagios::nagios::objects::add_contact { 'example_user':
# ng_contact_name => 'example_user',
# ng_contact_alias => 'Example User',
# ng_contact_groups => 'admins',
# ng_contact_email => 'example@example.net',
# }
# @param [string] ng_contact_name Specify the contact short name.
# @param [string] ng_contact_use which contact template to use
# @param [string] ng_contact_alias Specify the contact alias (long name).
# @param [string] ng_contact_email Specify the contact email address.
# @param [string] ng_contact_groups Specidy the contact group for the contact.
################################################################################
define cd_nagios::nagios::objects::add_contact (
$ng_contact_name = undef,
$ng_contact_use = 'generic-contact',
$ng_contact_alias = undef,
$ng_contact_email = undef,
$ng_contact_groups = undef,
) {
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
$ng_target_add_contact = $::cd_nagios::params::ng_target_add_contact
$ng_contacts_rule_erb = $::cd_nagios::params::ng_contacts_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_target_add_contact,
content => template($ng_contacts_rule_erb),
}
}
}