OP#436 add nagios contactgroups
This commit is contained in:
37
README.md
37
README.md
@@ -7,8 +7,10 @@
|
|||||||
- [Synopsis](#synopsis)
|
- [Synopsis](#synopsis)
|
||||||
- [WARNING](#warning)
|
- [WARNING](#warning)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
- [configuring user access](#configuring-user-access)
|
- [configuring UI user access](#configuring-ui-user-access)
|
||||||
- [Additional users](#additional-users)
|
- [Additional UI users](#additional-ui-users)
|
||||||
|
- [Adding contacts](#adding-contacts)
|
||||||
|
- [Adding contact groups](#adding-contact-groups)
|
||||||
- [Repo Documentation](#repo-documentation)
|
- [Repo Documentation](#repo-documentation)
|
||||||
- [Dependencies](#dependencies)
|
- [Dependencies](#dependencies)
|
||||||
- [Deployment](#deployment)
|
- [Deployment](#deployment)
|
||||||
@@ -40,7 +42,7 @@ At this stage, the module is being redeveloped and being built to the latest sta
|
|||||||
- configures the main nagios configuration file and sets values as (pre)configured per values in params, which can be overwritten.
|
- configures the main nagios configuration file and sets values as (pre)configured per values in params, which can be overwritten.
|
||||||
- if `ng_include_nrpe`is set to `true`, the confdroid_nrpe module is automatically applied on clients ([confdroid_nrpe](https://sourcecode.confdroid.com/confdroid/confdroid_nrpe) must be in the catalogue then)
|
- if `ng_include_nrpe`is set to `true`, the confdroid_nrpe module is automatically applied on clients ([confdroid_nrpe](https://sourcecode.confdroid.com/confdroid/confdroid_nrpe) must be in the catalogue then)
|
||||||
|
|
||||||
### configuring user access
|
### configuring UI user access
|
||||||
|
|
||||||
Main access to the user interface requires defining an administrative user and password via `ng_main_user` and `ng_main_password`. The password should be encrypted like this:
|
Main access to the user interface requires defining an administrative user and password via `ng_main_user` and `ng_main_password`. The password should be encrypted like this:
|
||||||
|
|
||||||
@@ -58,7 +60,7 @@ testuser: $2y$05$rNy/P22OfYZlpdEPnCAIg.OUizRD34P7pDRwUGiaYjH44PcRuZ2ia
|
|||||||
|
|
||||||
Use that value to override the default password in ENC or Hiera, if you use it.
|
Use that value to override the default password in ENC or Hiera, if you use it.
|
||||||
|
|
||||||
### Additional users
|
### Additional UI users
|
||||||
|
|
||||||
The main user is automatically created. If you want to add more users, this should be done via the define confdroid_nagios::server::access. In your control repo, site.pp etc. address the access define like this:
|
The main user is automatically created. If you want to add more users, this should be done via the define confdroid_nagios::server::access. In your control repo, site.pp etc. address the access define like this:
|
||||||
|
|
||||||
@@ -69,6 +71,33 @@ confdroid_nagios::server::access { 'example':
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Adding contacts
|
||||||
|
|
||||||
|
In order to add contacts for the notifications, address the define `confdroid_nagios::nagios::objects::add_contact` in your config repo, site.pp etc. like this:
|
||||||
|
|
||||||
|
```puppet
|
||||||
|
confdroid_nagios::nagios::objects::add_contact { 'example_user':
|
||||||
|
ng_contact_name => 'example_user',
|
||||||
|
ng_contact_alias => 'Example User',
|
||||||
|
ng_contact_groups => 'admins',
|
||||||
|
ng_contact_email => 'example@example.net',
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This requires the contact groups to be in place as well.
|
||||||
|
|
||||||
|
### Adding contact groups
|
||||||
|
|
||||||
|
In order to add contact groups for the notifications, address the define `confdroid_nagios::nagios::objects::add_contactgroups` in your config repo, site.pp etc. like this:
|
||||||
|
|
||||||
|
```puppet
|
||||||
|
confdroid_nagios::nagios::objects::add_contactgroups { 'example_group':
|
||||||
|
ng_contactgroup_name => 'example_group',
|
||||||
|
ng_contactgroup_alias => 'Example Group',
|
||||||
|
ng_contactgroup_register => '1',
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## 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`
|
||||||
|
|||||||
30
manifests/nagios/objects/add_contactgroups.pp
Normal file
30
manifests/nagios/objects/add_contactgroups.pp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
## confdroid_nagios::nagios::objects::add_contactgroups.pp
|
||||||
|
# Module name: confdroid_nagios
|
||||||
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
|
# @summary Define populates /etc/nagios/conf.d/nagios_add_contactgroups through
|
||||||
|
# external puppet rules.
|
||||||
|
# @param [string] ng_contactgroup_name Specify the short name of the
|
||||||
|
# contact group.
|
||||||
|
# @param [string] ng_contactgroup_alias Specify the alias (long name) of the
|
||||||
|
# contact group
|
||||||
|
# @param [string] ng_contactgroup_register Specify whether the contact group
|
||||||
|
# should be registered in Nagios.
|
||||||
|
################################################################################
|
||||||
|
define confdroid_nagios::nagios::objects::add_contactgroups (
|
||||||
|
|
||||||
|
Optional[String] $ng_contactgroup_name = undef,
|
||||||
|
Optional[String] $ng_contactgroup_alias = undef,
|
||||||
|
String $ng_contactgroup_register = '1',
|
||||||
|
|
||||||
|
) {
|
||||||
|
$ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
|
||||||
|
$ng_tgt_contactgroup_add = $confdroid_nagios::params::ng_tgt_contactgroup_add
|
||||||
|
$ng_cntctgrps_rule_erb = $confdroid_nagios::params::ng_cntctgrps_rule_erb
|
||||||
|
|
||||||
|
if $ng_nagios_server == $fqdn {
|
||||||
|
concat::fragment { $name:
|
||||||
|
target => $ng_tgt_contactgroup_add,
|
||||||
|
content => template($ng_cntctgrps_rule_erb),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
manifests/nagios/objects/add_contactgroups_rules.pp
Normal file
40
manifests/nagios/objects/add_contactgroups_rules.pp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
## confdroid_nagios::nagios::objects::add_contactgroups_rules.pp
|
||||||
|
# Module name: confdroid_nagios
|
||||||
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
|
# @summary Class manages /etc/nagios/conf.d/nagios_add_contactgroups.cfg file
|
||||||
|
# and populates through define and external puppet rules
|
||||||
|
# @example
|
||||||
|
# confdroid_nagios::nagios::objects::add_contactgroups { 'example_group':
|
||||||
|
# ng_contactgroup_name => 'example_group',
|
||||||
|
# ng_contactgroup_alias => 'Example Group',
|
||||||
|
# ng_contactgroup_register => '1',
|
||||||
|
# }
|
||||||
|
################################################################################
|
||||||
|
class confdroid_nagios::nagios::objects::add_contactgroups_rules (
|
||||||
|
|
||||||
|
) inherits confdroid_nagios::params {
|
||||||
|
if $ng_nagios_server == $fqdn {
|
||||||
|
# manage /etc/nagios/conf.d/nagios_add_contactgroups.cfg
|
||||||
|
|
||||||
|
concat { $ng_tgt_contactgroup_add:
|
||||||
|
ensure => present,
|
||||||
|
path => $ng_tgt_contactgroup_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 { 'contactgroups_header':
|
||||||
|
target => $ng_tgt_contactgroup_add,
|
||||||
|
content => template($ng_cntctgrps_head_erb),
|
||||||
|
order => '000',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,6 +48,39 @@ class confdroid_nagios::params (
|
|||||||
# httpd
|
# httpd
|
||||||
Boolean $ng_use_https = false,
|
Boolean $ng_use_https = false,
|
||||||
|
|
||||||
|
# check command parameters
|
||||||
|
## ping
|
||||||
|
String $ng_ping_warn = '100.0,20%',
|
||||||
|
String $ng_ping_crit = '500.0,60%',
|
||||||
|
String $ng_ping_ensure = 'present',
|
||||||
|
## disk
|
||||||
|
String $ng_disk_warn = '20%',
|
||||||
|
String $ng_disk_crit = '10%' ,
|
||||||
|
String $ng_disk_ensure = 'present',
|
||||||
|
# swap
|
||||||
|
String $ng_swap_warn = '20',
|
||||||
|
String $ng_swap_crit = '10',
|
||||||
|
String $ng_swap_ensure = 'present',
|
||||||
|
# users
|
||||||
|
String $ng_users_warn = '20',
|
||||||
|
String $ng_users_crit = '50',
|
||||||
|
String $ng_users_ensure = 'present',
|
||||||
|
#total procs
|
||||||
|
String $ng_procs_tot_warn = '330',
|
||||||
|
String $ng_procs_tot_crit = '400',
|
||||||
|
String $ng_procs_tot_param = 'RDST',
|
||||||
|
String $ng_procs_tot_ens = 'present',
|
||||||
|
# zombie procs
|
||||||
|
String $ng_procs_z_warn = '10',
|
||||||
|
String $ng_procs_z_crit = '30',
|
||||||
|
String $ng_procs_z_param = 'Z',
|
||||||
|
String $ng_procs_z_ensure = 'present',
|
||||||
|
# load
|
||||||
|
String $ng_load_warn = '5.00,4.00,3.00',
|
||||||
|
String $ng_load_crit = '10.00,6.00,4.00',
|
||||||
|
String $ng_load_ensure = 'present',
|
||||||
|
|
||||||
|
|
||||||
) {
|
) {
|
||||||
# Default facts
|
# Default facts
|
||||||
$fqdn = $facts['networking']['fqdn']
|
$fqdn = $facts['networking']['fqdn']
|
||||||
|
|||||||
Reference in New Issue
Block a user