added base contacts and additional contacts
This commit is contained in:
35
manifests/nagios/objects/add_contact.pp
Normal file
35
manifests/nagios/objects/add_contact.pp
Normal file
@@ -0,0 +1,35 @@
|
||||
## 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
|
||||
################################################################################
|
||||
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,
|
||||
|
||||
) {
|
||||
|
||||
}
|
||||
69
manifests/nagios/objects/add_contact_rules.pp
Normal file
69
manifests/nagios/objects/add_contact_rules.pp
Normal file
@@ -0,0 +1,69 @@
|
||||
## cd_nagios::nagios::objects::add_contact_rules.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 Class manages /etc/nagios/conf.d/nagios_add_contact.cfg through
|
||||
# concat.
|
||||
# @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',
|
||||
# }
|
||||
################################################################################
|
||||
class cd_nagios::nagios::objects::add_contact_rules (
|
||||
|
||||
) inherits cd_nagios::params {
|
||||
|
||||
if $::fqdn == $ng_nagios_server {
|
||||
|
||||
# manage /etc/nagios/conf.d/nagios_add_contacts.cfg
|
||||
|
||||
concat { $ng_target_add_contact:
|
||||
ensure => present,
|
||||
path => $ng_target_add_contact,
|
||||
owner => $ng_user,
|
||||
group => $ng_user,
|
||||
mode => '0640',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => nagios_etc_t,
|
||||
seluser => system_u,
|
||||
notify => Service[$ng_service],
|
||||
}
|
||||
|
||||
# manage file header
|
||||
|
||||
concat::fragment { 'header':
|
||||
target => $ng_target_add_contact,
|
||||
content => template($ng_contacts_head_erb),
|
||||
order => '000',
|
||||
}
|
||||
|
||||
# example rule for testing
|
||||
|
||||
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',
|
||||
}
|
||||
}
|
||||
}
|
||||
34
manifests/nagios/objects/config.pp
Normal file
34
manifests/nagios/objects/config.pp
Normal file
@@ -0,0 +1,34 @@
|
||||
## cd_nagios::server::nagios::objects::config.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 Class manages the nagios objects definitions.
|
||||
#############################################################################
|
||||
class cd_nagios::nagios::objects::config (
|
||||
|
||||
) inherits cd_nagios::params {
|
||||
|
||||
if $::fqdn == $ng_nagios_server {
|
||||
|
||||
require cd_nagios::nagios::objects::commands
|
||||
require cd_nagios::nagios::objects::template_rules
|
||||
require cd_nagios::nagios::objects::add_contact_rules
|
||||
|
||||
}
|
||||
}
|
||||
97
manifests/nagios/objects/contacts.pp
Normal file
97
manifests/nagios/objects/contacts.pp
Normal file
@@ -0,0 +1,97 @@
|
||||
## cd_nagios::nagios::objects::contacts.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 Class manages basic contacts known to NAGIOS through Puppet exports,
|
||||
# and populates /etc/nagios/conf.d/nagios_base_contacts.cfg.
|
||||
# @example
|
||||
# @@nagios_contact { 'admin':
|
||||
# ensure => present,
|
||||
# alias => 'Nagios Admin',
|
||||
# contact_name => 'admin',
|
||||
# contactgroups => 'admins',
|
||||
# email => "admin@${::domain}",
|
||||
# can_submit_commands => '1',
|
||||
# register => '1',
|
||||
# use => 'generic-contact',
|
||||
# target => $ng_target_base_contact,
|
||||
# owner => 'root',
|
||||
# group => 'nagios',
|
||||
# mode => '0664',
|
||||
# }
|
||||
################################################################################
|
||||
class cd_nagios::nagios::objects::contacts (
|
||||
|
||||
|
||||
) inherits cd_nagios::params {
|
||||
|
||||
if $::fqdn == $ng_nagios_server {
|
||||
|
||||
# admin contact
|
||||
|
||||
@@nagios_contact { 'admin':
|
||||
ensure => present,
|
||||
alias => 'Nagios Admin',
|
||||
contact_name => 'admin',
|
||||
contactgroups => 'admins',
|
||||
email => "admin@${::domain}",
|
||||
can_submit_commands => '1',
|
||||
register => '1',
|
||||
use => 'generic-contact',
|
||||
target => $ng_target_base_contact,
|
||||
owner => $ng_user,
|
||||
group => $ng_user,
|
||||
mode => '0640',
|
||||
}
|
||||
|
||||
# ops contact
|
||||
|
||||
@@nagios_contact { 'ops':
|
||||
ensure => present,
|
||||
alias => 'Operations',
|
||||
contact_name => 'ops',
|
||||
contactgroups => 'operations',
|
||||
email => "ops@${::domain}",
|
||||
can_submit_commands => '1',
|
||||
register => '1',
|
||||
use => 'generic-contact',
|
||||
target => $ng_target_base_contact,
|
||||
owner => $ng_user,
|
||||
group => $ng_user,
|
||||
mode => '0640',
|
||||
}
|
||||
|
||||
# support contact
|
||||
|
||||
@@nagios_contact { 'support':
|
||||
ensure => present,
|
||||
alias => 'support',
|
||||
contact_name => 'support',
|
||||
contactgroups => 'support',
|
||||
email => "support@${::domain}",
|
||||
can_submit_commands => '1',
|
||||
register => '1',
|
||||
use => 'generic-contact',
|
||||
target => $ng_target_base_contact,
|
||||
owner => $ng_user,
|
||||
group => $ng_user,
|
||||
mode => '0640',
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,8 @@
|
||||
#
|
||||
# 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 Class manages /etc/nagios/conf.d/templates.cfg through concat.
|
||||
# @summary Class manages /etc/nagios/conf.d/nagios_templates.cfg through
|
||||
# concat.
|
||||
# @example cd_nagios::nagios::objects::templates { 'generic contact':
|
||||
# ng_template_object => 'contact',
|
||||
# ng_template_object_name => 'generic-contact',
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
# 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
|
||||
# @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:
|
||||
@@ -77,6 +77,7 @@
|
||||
# retries for the defined object.
|
||||
# @param [string] ng_max_check_attempts how often to check the defined object
|
||||
# maximal.
|
||||
# @param [string] ng_check_command The command to use for host checks.
|
||||
# @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.
|
||||
@@ -112,7 +113,6 @@ $ng_template_object_use = undef,
|
||||
$ng_notifications_enabled = '1',
|
||||
$ng_event_handler_enabled = '1',
|
||||
$ng_flap_detection_enabled = '1',
|
||||
$ng_failure_prediction_enabled = '1',
|
||||
$ng_process_perf_data = '1',
|
||||
$ng_retain_status_information = '1',
|
||||
$ng_retain_nonstatus_information = '1',
|
||||
@@ -122,7 +122,7 @@ $ng_check_period = '24x7',
|
||||
$ng_check_interval = '5',
|
||||
$ng_retry_interval = '1',
|
||||
$ng_max_check_attempts = '10',
|
||||
$ng_check_command = 'check-host-alive',
|
||||
$ng_host_check_command = 'check-host-alive',
|
||||
$ng_notification_options = undef,
|
||||
$ng_contact_groups = 'admins',
|
||||
$ng_active_checks_enabled = '1',
|
||||
|
||||
@@ -959,7 +959,7 @@ $ng_certbot_check = "${ng_certbot_archive}/${ng_webserver_name}/cert1.pe
|
||||
$ng_certbot_live = "${ng_certbot_main_dir}/live"
|
||||
|
||||
# nagios
|
||||
$ng_target_templates = "${ng_conf_d_dir}/templates.cfg"
|
||||
$ng_target_templates = "${ng_conf_d_dir}/nagios_templates.cfg"
|
||||
$ng_templates_head_erb = 'cd_nagios/nagios/templates_cfg_head.erb'
|
||||
$ng_templates_rule_erb = 'cd_nagios/nagios/templates_cfg_rule.erb'
|
||||
$ng_target_timeperiods = "${ng_conf_d_dir}/timeperiods.cfg"
|
||||
@@ -971,7 +971,10 @@ $ng_target_hostesc = "${ng_conf_d_dir}/nagios_hostescalation.cfg"
|
||||
$ng_target_hostext = "${ng_conf_d_dir}/nagios_hostextinfo.cfg"
|
||||
$ng_target_service = "${ng_conf_d_dir}/nagios_service.cfg"
|
||||
$ng_target_servicegroup = "${ng_conf_d_dir}/nagios_servicegroup.cfg"
|
||||
$ng_target_contact = "${ng_conf_d_dir}/nagios_contact.cfg"
|
||||
$ng_target_base_contact = "${ng_conf_d_dir}/nagios_base_contact.cfg"
|
||||
$ng_target_add_contact = "${ng_conf_d_dir}/nagios_add_contact.cfg"
|
||||
$ng_contacts_head_erb = 'cd_nagios/nagios/contacts_cfg_head.erb'
|
||||
$ng_contact_rule_erb = 'cd_nagios/nagios/contact_cfg_rule.erb'
|
||||
$ng_target_contactgroup = "${ng_conf_d_dir}/nagios_contactgroup.cfg"
|
||||
$ng_target_command = "${ng_conf_d_dir}/nagios_command.cfg"
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@ class cd_nagios::server::service (
|
||||
|
||||
require cd_nagios::server::files
|
||||
require cd_nagios::server::access_rules
|
||||
require cd_nagios::nagios::objects::commands
|
||||
require cd_nagios::nagios::objects::template_rules
|
||||
require cd_nagios::nagios::objects::config
|
||||
|
||||
service { $ng_service:
|
||||
ensure => running,
|
||||
|
||||
Reference in New Issue
Block a user