124 lines
6.5 KiB
Puppet
124 lines
6.5 KiB
Puppet
## cd_nagios::nagios::objects::templates.pp
|
|
# Module name: cd_nagios
|
|
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
|
|
# @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 how 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_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 object.
|
|
# 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
|
|
################################################################################
|
|
define cd_nagios::nagios::objects::templates (
|
|
Optional[String] $ng_template_object = undef,
|
|
Optional[String] $ng_template_object_name = undef,
|
|
String $ng_svc_notification_period = '24x7',
|
|
String $ng_host_notification_period = '24x7',
|
|
String $ng_service_notification_options = 'w,u,c,r,f,s',
|
|
String $ng_host_notification_options = 'd,u,r,f,s',
|
|
String $ng_service_notification_commands = 'notify-service-by-email',
|
|
String $ng_host_notification_commands = 'notify-host-by-email',
|
|
String $ng_object_register = '0',
|
|
Optional[String] $ng_template_object_use = undef,
|
|
String $ng_notifications_enabled = '1',
|
|
String $ng_event_handler_enabled = '1',
|
|
String $ng_flap_detection_enabled = '1',
|
|
String $ng_process_perf_data = '1',
|
|
String $ng_retain_status_information = '1',
|
|
String $ng_retain_nonstatus_information = '1',
|
|
String $ng_notification_period = '24x7',
|
|
String $ng_notification_interval = '30',
|
|
String $ng_check_period = '24x7',
|
|
String $ng_check_interval = '5',
|
|
String $ng_retry_interval = '1',
|
|
String $ng_max_check_attempts = '10',
|
|
String $ng_host_check_command = 'check-host-alive',
|
|
Optional[String] $ng_notification_options = undef,
|
|
String $ng_contact_groups = 'admins',
|
|
String $ng_active_checks_enabled = '1',
|
|
String $ng_passive_checks_enabled = '1',
|
|
String $ng_parallelize_check = '1',
|
|
String $ng_obsess_over_service = '1',
|
|
String $ng_check_freshness = '0',
|
|
String $ng_is_volatile = '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),
|
|
}
|
|
}
|
|
}
|