added servicegroup control
This commit is contained in:
@@ -56,11 +56,5 @@ class cd_nagios::nagios::objects::add_contactgroups_rules (
|
||||
content => template($ng_cntctgrps_head_erb),
|
||||
order => '000',
|
||||
}
|
||||
|
||||
cd_nagios::nagios::objects::add_contactgroups { 'example_group':
|
||||
ng_contactgroup_name => 'example_group',
|
||||
ng_contactgroup_alias => 'Example Group',
|
||||
ng_contactgroup_register => '1',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +55,5 @@ class cd_nagios::nagios::objects::add_hostgroup_rules (
|
||||
content => template($ng_tgt_hostgrp_head_erb),
|
||||
order => '000',
|
||||
}
|
||||
|
||||
cd_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
|
||||
ng_hostgroup_name => 'example_hostgroup',
|
||||
ng_hostgroup_alias => 'Example Hostgroup',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
manifests/nagios/objects/add_servicegroup_rules.pp
Normal file
64
manifests/nagios/objects/add_servicegroup_rules.pp
Normal file
@@ -0,0 +1,64 @@
|
||||
## cd_nagios::nagios::objects::add_servicegroup_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_servicegroups_add.cfg and
|
||||
# additional servicegroups through external Puppet rules via define.
|
||||
# @example
|
||||
# cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
|
||||
# ng_servicegroup_name => 'example_servicegroup',
|
||||
# ng_servicegroup_alias => 'Example Servicegroup',
|
||||
# }
|
||||
################################################################################
|
||||
class cd_nagios::nagios::objects::add_servicegroup_rules (
|
||||
|
||||
|
||||
) inherits cd_nagios::params {
|
||||
|
||||
if $::fqdn == $ng_nagios_server {
|
||||
|
||||
# manage /etc/nagios_conf.d/nagios_servicegroups_add.cfg
|
||||
|
||||
concat { $ng_tgt_servicegroup_add:
|
||||
ensure => present,
|
||||
path => $ng_tgt_servicegroup_add,
|
||||
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 { 'servicegroups_header':
|
||||
target => $ng_tgt_servicegroup_add,
|
||||
content => template($ng_tgt_svcgrp_head_erb),
|
||||
order => '000',
|
||||
}
|
||||
|
||||
cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
|
||||
ng_servicegroup_name => 'example_servicegroup',
|
||||
ng_servicegroup_alias => 'Example Servicegroup',
|
||||
}
|
||||
}
|
||||
}
|
||||
48
manifests/nagios/objects/add_servicegroups.pp
Normal file
48
manifests/nagios/objects/add_servicegroups.pp
Normal file
@@ -0,0 +1,48 @@
|
||||
## cd_nagios::nagios::objects::add_servicegroups.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_servicegroups_add through
|
||||
# extermal Puppet rules.
|
||||
# @example
|
||||
# cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
|
||||
# ng_servicegroup_name => 'example_servicegroup',
|
||||
# ng_servicegroup_alias => 'Example servicegroup',
|
||||
# }
|
||||
###############################################################################
|
||||
define cd_nagios::nagios::objects::add_servicegroups (
|
||||
|
||||
$ng_servicegroup_name = undef,
|
||||
$ng_servicegroup_alias = undef,
|
||||
$ng_servicegroup_register = '1',
|
||||
|
||||
) {
|
||||
|
||||
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
|
||||
$ng_tgt_servicegroup_add = $::cd_nagios::params::ng_tgt_servicegroup_add
|
||||
$ng_tgt_svcgrp_rule_erb = $::cd_nagios::params::ng_tgt_svcgrp_rule_erb
|
||||
|
||||
if $::fqdn == $ng_nagios_server {
|
||||
|
||||
concat::fragment { $name:
|
||||
target => $ng_tgt_servicegroup_add,
|
||||
content => template($ng_tgt_svcgrp_rule_erb),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ class cd_nagios::nagios::objects::config (
|
||||
require cd_nagios::nagios::objects::add_contactgroups_rules
|
||||
require cd_nagios::nagios::objects::hostgroups
|
||||
require cd_nagios::nagios::objects::add_hostgroup_rules
|
||||
|
||||
require cd_nagios::nagios::objects::servicegroups
|
||||
require cd_nagios::nagios::objects::add_servicegroup_rules
|
||||
}
|
||||
}
|
||||
|
||||
70
manifests/nagios/objects/servicegroups.pp
Normal file
70
manifests/nagios/objects/servicegroups.pp
Normal file
@@ -0,0 +1,70 @@
|
||||
## cd_nagios::nagios::objects::servicegroups.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 hostgroups known to NAGIOS through Puppet
|
||||
# exports, and populates /etc/nagios/conf.d/nagios_base_hostgroups.cfg.
|
||||
################################################################################
|
||||
class cd_nagios::nagios::objects::servicegroups (
|
||||
|
||||
|
||||
) inherits cd_nagios::params {
|
||||
|
||||
if $::fqdn == $ng_nagios_server {
|
||||
|
||||
# network services
|
||||
|
||||
@@nagios_servicegroup { 'network-services':
|
||||
ensure => present,
|
||||
servicegroup_name => 'network-services',
|
||||
alias => 'Network Services',
|
||||
owner => $ng_user,
|
||||
group => $ng_user,
|
||||
mode => '0640',
|
||||
register => '1',
|
||||
target => $ng_target_svcgrp_base,
|
||||
}
|
||||
|
||||
# linux services
|
||||
|
||||
@@nagios_servicegroup { 'linux-services':
|
||||
ensure => present,
|
||||
servicegroup_name => 'linux-services',
|
||||
alias => 'Linux Services',
|
||||
owner => $ng_user,
|
||||
group => $ng_user,
|
||||
mode => '0640',
|
||||
register => '1',
|
||||
target => $ng_target_svcgrp_base,
|
||||
}
|
||||
|
||||
# database services
|
||||
|
||||
@@nagios_servicegroup { 'database-services':
|
||||
ensure => present,
|
||||
servicegroup_name => 'database-services',
|
||||
alias => 'Database Services',
|
||||
owner => $ng_user,
|
||||
group => $ng_user,
|
||||
mode => '0640',
|
||||
register => '1',
|
||||
target => $ng_target_svcgrp_base,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user