Files
confdroid_nagios/manifests/nagios/objects/templates.pp

77 lines
3.7 KiB
ObjectPascal
Raw Normal View History

2017-07-25 16:30:03 +01:00
## 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.
2017-07-25 17:13:25 +01:00
# @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.
2017-07-25 16:30:03 +01:00
################################################################################
2017-07-25 16:32:38 +01:00
define cd_nagios::nagios::objects::templates (
2017-07-25 16:57:10 +01:00
$ng_template_object = undef,
$ng_template_object_name = undef,
$ng_svc_notification_period = '24x7',
2017-07-25 17:15:21 +01:00
$ng_host_notification_period = '24x7',
2017-07-25 16:57:10 +01:00
$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',
2017-07-25 16:30:03 +01:00
) {
2017-07-25 16:39:28 +01:00
$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
2017-07-25 16:30:03 +01:00
2017-07-25 16:39:28 +01:00
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_target_templates,
content => template($ng_templates_rule_erb),
}
}
2017-07-25 16:30:03 +01:00
}