added and linked add_timeperiods
This commit is contained in:
69
manifests/nagios/objects/add_timeperiods.pp
Normal file
69
manifests/nagios/objects/add_timeperiods.pp
Normal file
@@ -0,0 +1,69 @@
|
||||
## cd_nagios::nagios::objects::add_timeperiods.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 populates /etc/nagios/conf.d/nagios_timeperiods_add through
|
||||
# extermal Puppet rules.
|
||||
# @example
|
||||
# cd_nagios::nagios::objects::add_timeperiods { 'example_timeperiod':
|
||||
# ng_timeperiod_name => 'example_timeperiod',
|
||||
# ng_timeperiod_alias => 'Example timeperiod',
|
||||
# }
|
||||
# @param [string] ng_timep_name Specify the timeperiod short name.
|
||||
# @param [string] ng_timep_alias Specify the timeperiod alias (long name)
|
||||
# @param [string] ng_timep_monday Specify the desired hours for Monday
|
||||
# @param [string] ng_timep_tuesday Specify the desired hours for Tuesday
|
||||
# @param [string] ng_timep_wednesday Specify the desired hours for Wednesday.
|
||||
# @param [string] ng_timep_thursday Specify the desired hours for Thursday
|
||||
# @param [string] ng_timep_friday Specify the desired hours for Friday
|
||||
# @param [string] ng_timep_saturday Specify the desired hours for Saturday
|
||||
# @param [string] ng_timep_sunday Specify the desired hours for Sunday.
|
||||
# @param [string] ng_timep_special_01 Specify a special date as key parameter
|
||||
# for `ng_timep_special_02`. See Nagios documentation for format details.
|
||||
# @param [string] ng_timep_special_02 Specify desired hours as value parameter
|
||||
# for `g_timep_special_01`.
|
||||
###############################################################################
|
||||
define cd_nagios::nagios::objects::add_timeperiods (
|
||||
|
||||
$ng_timep_name = undef,
|
||||
$ng_timep_alias = undef,
|
||||
$ng_timep_monday = '00:00-00:00',
|
||||
$ng_timep_tuesday = '00:00-00:00',
|
||||
$ng_timep_wednesday = '00:00-00:00',
|
||||
$ng_timep_thursday = '00:00-00:00',
|
||||
$ng_timep_friday = '00:00-00:00',
|
||||
$ng_timep_saturday = '00:00-00:00',
|
||||
$ng_timep_sunday = '00:00-00:00',
|
||||
$ng_timep_special_01 = undef,
|
||||
$ng_timep_special_02 = '00:00-00:00',
|
||||
|
||||
) {
|
||||
|
||||
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
|
||||
$ng_tgt_timep_add = $::cd_nagios::params::ng_tgt_timeperiod_add
|
||||
$ng_tgt_timep_rule_erb = $::cd_nagios::params::ng_tgt_timep_rule_erb
|
||||
|
||||
if $::fqdn == $ng_nagios_server {
|
||||
|
||||
concat::fragment { $name:
|
||||
target => $ng_tgt_timep_add,
|
||||
content => template($ng_tgt_timep_rule_erb),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user