OP#436 add nagios hostgroups, and example groups and contacts

This commit is contained in:
2026-03-01 16:04:02 +01:00
parent 741bc76fb6
commit e0a3ad9624
2 changed files with 19 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ class confdroid_nagios::nagios::objects::add_hostgroup_rules (
selrole => object_r, selrole => object_r,
seltype => nagios_etc_t, seltype => nagios_etc_t,
seluser => system_u, seluser => system_u,
notify => Service[ng_nagios_service], notify => Service[$ng_nagios_service],
} }
# manage file header # manage file header
@@ -35,5 +35,12 @@ class confdroid_nagios::nagios::objects::add_hostgroup_rules (
content => template($ng_tgt_hostgrp_head_erb), content => template($ng_tgt_hostgrp_head_erb),
order => '000', order => '000',
} }
# add hostgroup rules through defines and parameters
confdroid_nagios::nagios::objects::add_hostgroups { $ng_hostgroup_name:
ng_hostgroup_name => $ng_hostgroup_name,
ng_hostgroup_alias => $ng_hostgroup_alias,
ng_hostgroup_ensure => $ng_hostgroup_ensure,
}
} }
} }

View File

@@ -87,6 +87,12 @@
# Default is 'admins'. # Default is 'admins'.
# @param [String] ng_contact_email The email address for the default contact. # @param [String] ng_contact_email The email address for the default contact.
# Default is 'nagiosadmin@example.net'. # Default is 'nagiosadmin@example.net'.
# @param [String] ng_hostgroup_name The name of the default host group. Default
# is 'linux-servers'.
# @param [String] ng_hostgroup_alias The alias of the default host group. Default
# is 'Linux Servers'.
# @param [String] ng_hostgroup_ensure The ensure value for the default host group
# Default is 'present'.
############################################################################### ###############################################################################
class confdroid_nagios::params ( class confdroid_nagios::params (
@@ -110,6 +116,11 @@ class confdroid_nagios::params (
String $ng_contact_groups = 'admins', String $ng_contact_groups = 'admins',
String $ng_contact_email = 'nagiosadmin@example.net', String $ng_contact_email = 'nagiosadmin@example.net',
# hostgroups
String $ng_hostgroup_name = 'linux-servers',
String $ng_hostgroup_alias = 'Linux Servers',
String $ng_hostgroup_ensure = 'present',
# nagios.cfg # nagios.cfg
String $ng_log_file = '/var/log/nagios/nagios.log', String $ng_log_file = '/var/log/nagios/nagios.log',