77 lines
3.7 KiB
Puppet
77 lines
3.7 KiB
Puppet
## cd_nagios::nagios::objects::templates.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 populates /etc/nagios/conf.d/templates.cfg.
|
|
# @param [string] ng_template_object the object type for the templates.
|
|
# valid options are `contact`, `host` and `service`.
|
|
# @param [string] ng_template_object_name populates the name field,
|
|
# i.e. `generic-contact`, `generic-host`, `generic-service`.
|
|
# @param [string] ng_svc_notification_period Period in which to send out
|
|
# notifications for service events, i.e. `24x7`.
|
|
# @param [string] ng_svc_notification_period Period in which to send out
|
|
# notifications for host events , i.e. `24x7`.
|
|
# @param [string] ng_service_notification_options What service events to send
|
|
# out notifications for:
|
|
# w = notify on WARNING service states,
|
|
# u = notify on UNKNOWN service states,
|
|
# c = notify on CRITICAL service states,
|
|
# r = notify on service recoveries (OK states),
|
|
# f = notify when the service starts and stops flapping.
|
|
# n = none (the contact will not receive any type of service notifications).
|
|
# @param [string] ng_host_notification_options What host events to send
|
|
# out notifications for:
|
|
# d = notify on DOWN host states,
|
|
# u = notify on UNREACHABLE host states,
|
|
# r = notify on host recoveries (UP states),
|
|
# f = notify when the host starts and stops flapping,
|
|
# s = snotify when host or service scheduled downtime starts and ends.
|
|
# n = none (the contact will not receive any type of host notifications).
|
|
# @param [string] ng_service_notification_commands Command to use for
|
|
# service event notification. Command must be defined in commands.cfg
|
|
# @param [string] ng_host_notification_commands Command to use for
|
|
# host event notification. Command must be defined in commands.cfg.
|
|
# @param [string] ng_object_register Whether to register the object to Nagios.
|
|
# Since this is a template definition, we do not want to register those.
|
|
################################################################################
|
|
define cd_nagios::nagios::objects::templates (
|
|
$ng_template_object = undef,
|
|
$ng_template_object_name = undef,
|
|
$ng_svc_notification_period = '24x7',
|
|
$ng_host_notification_period = '24x7',
|
|
$ng_service_notification_options = 'w,u,c,r,f,s',
|
|
$ng_host_notification_options = 'd,u,r,f,s',
|
|
$ng_service_notification_commands = 'notify-service-by-email',
|
|
$ng_host_notification_commands = 'notify-host-by-email',
|
|
$ng_object_register = '0',
|
|
|
|
) {
|
|
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
|
|
$ng_target_templates = $::cd_nagios::params::ng_target_templates
|
|
$ng_templates_rule_erb = $::cd_nagios::params::ng_templates_rule_erb
|
|
|
|
if $::fqdn == $ng_nagios_server {
|
|
|
|
concat::fragment { $name:
|
|
target => $ng_target_templates,
|
|
content => template($ng_templates_rule_erb),
|
|
}
|
|
}
|
|
}
|