## 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 . # @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_host_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 = notify 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. # @param [string] ng_template_object_use Which template to use for a given # host or service definition, i.e. `generic-host`, `generic-service` etc. # @param [string] ng_notifications_enabled Whether notifications are enabled. # Valid options are `0` and `1`. # @param [string] ng_event_handler_enabled Whether event handlers are enabled. # Valid options are `0` and `1`. # @param [string] ng_flap_detection_enabled Whether flap detection is enabled. # Valid options are `0` and `1`. # @param [string] ng_process_perf_data Whether to process performance data. # Valid options are `0` and `1`. # @param [string] ng_retain_status_information Whether to retain status # information. Valid options are `0` and `1`. # @param [string] ng_retain_nonstatus_information Whether to retain non-status # information. Valid options are `0` and `1`. # @param [string] ng_notification_period Which period in to send out # notifications. for the defined service or host. # @param [string] ng_notification_interval Whoe often (in minutes) we should # resend notifications for the current status. # @param [string] ng_check_period Which period in to run checks for the defined # object. # @param [string] ng_check_interval How often in minutes to check the defined # object. # @param [string] ng_retry_interval at what interval in minutes to schedule # retries for the defined object. # @param [string] ng_max_check_attempts how often to check the defined object # maximal. # @param [string] ng_notification_options see `ng_service_notification_options` # and `ng_host_notification_options`. # @param [string] ng_contact_groups contact groups for the defined oject. # Specified contact group must exit in contact_groups # @param [string] ng_active_checks_enabled Whether to enable active checks. # Valid options are `0` and `1`. # @param [string] ng_passive_checks_enabled Whether to enable passive checks. # Valid options are `0` and `1`. # @param [string] ng_parallelize_check Whether to parallelize checks # Valid options are `0` and `1`. # @param [string] ng_obsess_over_service Whether to obsess over the service. # Valid options are `0` and `1`. # @param [string] ng_check_freshness Whether to check freshness. # Valid options are `0` and `1`. # @param [string] ng_is_volatile Whether the service is volatile. # Valid options are `0` and `1`. # @param [string] ng_check_interval How often to check the service # under normal conditions. # @param [string] ng_retry_interval Re-check the service every x minutes # until a hard state can be determined. # @param [string] ng_host_check_command the check command for host checks # @param [string] ################################################################################ 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_template_object_use = undef, $ng_notifications_enabled = '1', $ng_event_handler_enabled = '1', $ng_flap_detection_enabled = '1', $ng_process_perf_data = '1', $ng_retain_status_information = '1', $ng_retain_nonstatus_information = '1', $ng_notification_period = '24x7', $ng_notification_interval = '30', $ng_check_period = '24x7', $ng_check_interval = '5', $ng_retry_interval = '1', $ng_max_check_attempts = '10', $ng_host_check_command = 'check-host-alive', $ng_notification_options = undef, $ng_contact_groups = 'admins', $ng_active_checks_enabled = '1', $ng_passive_checks_enabled = '1', $ng_parallelize_check = '1', $ng_obsess_over_service = '1', $ng_check_freshness = '0', $ng_is_volatile = '0', $ng_check_interval = '10', $ng_retry_interval = '2', ) { $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), } } }