OP#436 add nagios contactgroups
This commit is contained in:
39
manifests/nagios/objects/add_hostgroup_rules.pp
Normal file
39
manifests/nagios/objects/add_hostgroup_rules.pp
Normal file
@@ -0,0 +1,39 @@
|
||||
## confdroid_nagios::nagios::objects::add_hostgroup_rules.pp
|
||||
# Module name: confdroid_nagios
|
||||
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||
# @summary Class manages /etc/nagios_conf.d/nagios_hostgroups_add.cfg and
|
||||
# additional hostgroups through external Puppet rules via define.
|
||||
# @example
|
||||
# confdroid_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
|
||||
# ng_hostgroup_name => 'example_hostgroup',
|
||||
# ng_hostgroup_alias => 'Example Hostgroup',
|
||||
# }
|
||||
################################################################################
|
||||
class confdroid_nagios::nagios::objects::add_hostgroup_rules (
|
||||
|
||||
) inherits confdroid_nagios::params {
|
||||
if $ng_nagios_server == $fqdn {
|
||||
# manage /etc/nagios_conf.d/nagios_hostgroups_add.cfg
|
||||
|
||||
concat { $ng_tgt_hostgroup_add:
|
||||
ensure => present,
|
||||
path => $ng_tgt_hostgroup_add,
|
||||
owner => 'nagios',
|
||||
group => 'nagios',
|
||||
mode => '0640',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => nagios_etc_t,
|
||||
seluser => system_u,
|
||||
notify => Service[ng_nagios_service],
|
||||
}
|
||||
|
||||
# manage file header
|
||||
|
||||
concat::fragment { 'hostgroups_header':
|
||||
target => $ng_tgt_hostgroup_add,
|
||||
content => template($ng_tgt_hostgrp_head_erb),
|
||||
order => '000',
|
||||
}
|
||||
}
|
||||
}
|
||||
32
manifests/nagios/objects/add_hostgroups.pp
Normal file
32
manifests/nagios/objects/add_hostgroups.pp
Normal file
@@ -0,0 +1,32 @@
|
||||
## confdroid_nagios::nagios::objects::add_hostgroups.pp
|
||||
# Module name: confdroid_nagios
|
||||
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||
# @summary define populates /etc/nagios/conf.d/nagios_hostgroups_add through
|
||||
# external Puppet rules.
|
||||
# @example
|
||||
# confdroid_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
|
||||
# ng_hostgroup_name => 'example_hostgroup',
|
||||
# ng_hostgroup_alias => 'Example Hostgroup',
|
||||
# }
|
||||
# @param [string] ng_hostgroup_name Specify the hostgroup short name.
|
||||
# @param [string] ng_hostgroup_alias Specify the hostgroup alias (long name).
|
||||
# @param [string] ng_hostgroup_register Whether to register the hostgroup.
|
||||
###############################################################################
|
||||
define confdroid_nagios::nagios::objects::add_hostgroups (
|
||||
|
||||
Optional[String] $ng_hostgroup_name = undef,
|
||||
Optional[String] $ng_hostgroup_alias = undef,
|
||||
String $ng_hostgroup_register = '1',
|
||||
|
||||
) {
|
||||
$ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
|
||||
$ng_tgt_hostgroup_add = $confdroid_nagios::params::ng_tgt_hostgroup_add
|
||||
$ng_tgt_hostgrp_rule_erb = $confdroid_nagios::params::ng_tgt_hostgrp_rule_erb
|
||||
|
||||
if $ng_nagios_server == $fqdn {
|
||||
concat::fragment { $name:
|
||||
target => $ng_tgt_hostgroup_add,
|
||||
content => template($ng_tgt_hostgrp_rule_erb),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user