OP#436 add nagios contactgroups
This commit is contained in:
18
README.md
18
README.md
@@ -11,6 +11,7 @@
|
|||||||
- [Additional UI users](#additional-ui-users)
|
- [Additional UI users](#additional-ui-users)
|
||||||
- [Adding contacts](#adding-contacts)
|
- [Adding contacts](#adding-contacts)
|
||||||
- [Adding contact groups](#adding-contact-groups)
|
- [Adding contact groups](#adding-contact-groups)
|
||||||
|
- [Adding host groups](#adding-host-groups)
|
||||||
- [Repo Documentation](#repo-documentation)
|
- [Repo Documentation](#repo-documentation)
|
||||||
- [Dependencies](#dependencies)
|
- [Dependencies](#dependencies)
|
||||||
- [Deployment](#deployment)
|
- [Deployment](#deployment)
|
||||||
@@ -98,6 +99,19 @@ In order to add contact groups for the notifications, address the define `confdr
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Adding host groups
|
||||||
|
|
||||||
|
In order to add host groups, address the define `confdroid_nagios::nagios::objects::add_hostgroups` in your config repo, site.pp etc. like this:
|
||||||
|
|
||||||
|
```puppet
|
||||||
|
confdroid_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
|
||||||
|
ng_hostgroup_name => 'example_hostgroup',
|
||||||
|
ng_hostgroup_alias => 'Example Hostgroup',
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Hosts will be populated through the target.pp dynamically.
|
||||||
|
|
||||||
## Repo Documentation
|
## Repo Documentation
|
||||||
|
|
||||||
See the full Puppet documentation including parameters in `docs/index.html`
|
See the full Puppet documentation including parameters in `docs/index.html`
|
||||||
@@ -127,7 +141,7 @@ node 'example.example.net' {
|
|||||||
|
|
||||||
In order to apply parameters through Foreman, **__confdroid_nagios::params__*- must be added to the host or host group in question.
|
In order to apply parameters through Foreman, **__confdroid_nagios::params__*- must be added to the host or host group in question.
|
||||||
|
|
||||||
See [more details about class deployment on Confdroid.com](https://confdroid.com/2017/05/deploying-our-puppet-modules/).
|
See [more details about class deployment on confdroid.com](https://confdroid.com/2017/05/deploying-our-puppet-modules/).
|
||||||
|
|
||||||
## PuppetDB
|
## PuppetDB
|
||||||
|
|
||||||
@@ -158,5 +172,5 @@ All files and directories are configured with correct selinux context. If selinu
|
|||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
ConfDroid as entity is entirely independent from Puppet. We provide custom configuration modules, written for specific purposes and specific environments.
|
confdroid as entity is entirely independent from Puppet. We provide custom configuration modules, written for specific purposes and specific environments.
|
||||||
The modules are tested and supported only as documented, and require testing in designated environments (i.e. lab or development environments) for parameter tuning etc. before deploying into production environments.
|
The modules are tested and supported only as documented, and require testing in designated environments (i.e. lab or development environments) for parameter tuning etc. before deploying into production environments.
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ class confdroid_nagios::nagios::config (
|
|||||||
#require confdroid_nagios::nagios::objects::template_rules
|
#require confdroid_nagios::nagios::objects::template_rules
|
||||||
require confdroid_nagios::nagios::objects::add_contact_rules
|
require confdroid_nagios::nagios::objects::add_contact_rules
|
||||||
require confdroid_nagios::nagios::objects::add_contactgroups_rules
|
require confdroid_nagios::nagios::objects::add_contactgroups_rules
|
||||||
#require confdroid_nagios::nagios::objects::hostgroups
|
require confdroid_nagios::nagios::objects::add_hostgroup_rules
|
||||||
#require confdroid_nagios::nagios::objects::add_hostgroup_rules
|
|
||||||
#require confdroid_nagios::nagios::objects::servicegroups
|
#require confdroid_nagios::nagios::objects::servicegroups
|
||||||
#require confdroid_nagios::nagios::objects::add_servicegroup_rules
|
#require confdroid_nagios::nagios::objects::add_servicegroup_rules
|
||||||
#require confdroid_nagios::nagios::objects::timeperiods
|
#require confdroid_nagios::nagios::objects::timeperiods
|
||||||
|
|||||||
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),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
## confdroid_nagios::nagios::resources::resource_df.pp
|
## confdroid_nagios::nagios::resources::resource_df.pp
|
||||||
# Module name: confdroid_nagios
|
# Module name: confdroid_nagios
|
||||||
# Author: 12ww1160 (12ww1160@ConfDroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary define manages the resources in/etc/nagios/private/resources.cfg
|
# @summary define manages the resources in/etc/nagios/private/resources.cfg
|
||||||
# @param [String] ng_user_arg_name the name of user argument i.e. $user1$
|
# @param [String] ng_user_arg_name the name of user argument i.e. $user1$
|
||||||
# @param [String] ng_user_arg_value the value of t user argument i.e. $user1$
|
# @param [String] ng_user_arg_value the value of t user argument i.e. $user1$
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
#############################################################################
|
#############################################################################
|
||||||
define confdroid_nagios::nagios::resources::resource_df (
|
define confdroid_nagios::nagios::resources::resource_df (
|
||||||
|
|
||||||
Optional[String] $ng_user_arg_name = undef,
|
Optional[String] 'nagios'_arg_name = undef,
|
||||||
Optional[String] $ng_user_arg_value = undef,
|
Optional[String] 'nagios'_arg_value = undef,
|
||||||
Optional[String] $ng_user_arg_comment = undef,
|
Optional[String] 'nagios'_arg_comment = undef,
|
||||||
String $ng_resource_rule_erb = 'confdroid_nagios/nagios/resource_cfg_rule.erb',
|
String $ng_resource_rule_erb = 'confdroid_nagios/nagios/resource_cfg_rule.erb',
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -108,9 +108,9 @@ class confdroid_nagios::params (
|
|||||||
String $ng_swap_crit = '10',
|
String $ng_swap_crit = '10',
|
||||||
String $ng_swap_ensure = 'present',
|
String $ng_swap_ensure = 'present',
|
||||||
# users
|
# users
|
||||||
String $ng_users_warn = '20',
|
String 'nagios's_warn = '20',
|
||||||
String $ng_users_crit = '50',
|
String 'nagios's_crit = '50',
|
||||||
String $ng_users_ensure = 'present',
|
String 'nagios's_ensure = 'present',
|
||||||
#total procs
|
#total procs
|
||||||
String $ng_procs_tot_warn = '330',
|
String $ng_procs_tot_warn = '330',
|
||||||
String $ng_procs_tot_crit = '400',
|
String $ng_procs_tot_crit = '400',
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ log_file=<%= @ng_log_file %>
|
|||||||
# or at nagios.org
|
# or at nagios.org
|
||||||
|
|
||||||
cfg_file=/etc/nagios/objects/commands.cfg
|
cfg_file=/etc/nagios/objects/commands.cfg
|
||||||
cfg_file=/etc/nagios/objects/contacts.cfg
|
|
||||||
cfg_file=/etc/nagios/objects/timeperiods.cfg
|
cfg_file=/etc/nagios/objects/timeperiods.cfg
|
||||||
cfg_file=/etc/nagios/objects/templates.cfg
|
cfg_file=/etc/nagios/objects/templates.cfg
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user