added template concat
This commit is contained in:
@@ -19,6 +19,9 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# 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/templates.cfg through concat.
|
||||||
|
# @example cd_nagios::objects::templates { $name:
|
||||||
|
# ng_template_object => 'service',
|
||||||
|
# }
|
||||||
################################################################################
|
################################################################################
|
||||||
class cd_nagios::nagios::objects::template_rules (
|
class cd_nagios::nagios::objects::template_rules (
|
||||||
|
|
||||||
@@ -41,5 +44,10 @@ class cd_nagios::nagios::objects::template_rules (
|
|||||||
content => template[$ng_templates_head_erb]
|
content => template[$ng_templates_head_erb]
|
||||||
notify => Service[$ng_service],
|
notify => Service[$ng_service],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# example rule
|
||||||
|
cd_nagios::objects::templates { $name:
|
||||||
|
ng_template_object => 'service',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,20 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
define cd_nagios::nagios::objects::templates (
|
define cd_nagios::nagios::objects::templates (
|
||||||
|
|
||||||
|
$ng_template_object = undef,
|
||||||
|
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$ng_target_templates = $::cd_nagios::params::ng_target_templates
|
$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),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -961,6 +961,7 @@ $ng_certbot_live = "${ng_certbot_main_dir}/live"
|
|||||||
# nagios
|
# nagios
|
||||||
$ng_target_templates = "${ng_conf_d_dir}/templates.cfg"
|
$ng_target_templates = "${ng_conf_d_dir}/templates.cfg"
|
||||||
$ng_templates_head_erb = 'cd_nagios/nagios/templates_cfg_head.erb'
|
$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"
|
$ng_target_timeperiods = "${ng_conf_d_dir}/timeperiods.cfg"
|
||||||
$ng_target_localhost = "${ng_conf_d_dir}/nagios_localhost.cfg"
|
$ng_target_localhost = "${ng_conf_d_dir}/nagios_localhost.cfg"
|
||||||
$ng_target_host = "${ng_conf_d_dir}/nagios_host.cfg"
|
$ng_target_host = "${ng_conf_d_dir}/nagios_host.cfg"
|
||||||
|
|||||||
Reference in New Issue
Block a user