From e0a3ad9624f30732d3b9f4a522bc66bc246b4557 Mon Sep 17 00:00:00 2001 From: 12ww1160 <12ww1160@confdroid.com> Date: Sun, 1 Mar 2026 16:04:02 +0100 Subject: [PATCH] OP#436 add nagios hostgroups, and example groups and contacts --- manifests/nagios/objects/add_hostgroup_rules.pp | 9 ++++++++- manifests/params.pp | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/manifests/nagios/objects/add_hostgroup_rules.pp b/manifests/nagios/objects/add_hostgroup_rules.pp index 4494ee2..d50dd5e 100644 --- a/manifests/nagios/objects/add_hostgroup_rules.pp +++ b/manifests/nagios/objects/add_hostgroup_rules.pp @@ -25,7 +25,7 @@ class confdroid_nagios::nagios::objects::add_hostgroup_rules ( selrole => object_r, seltype => nagios_etc_t, seluser => system_u, - notify => Service[ng_nagios_service], + notify => Service[$ng_nagios_service], } # manage file header @@ -35,5 +35,12 @@ class confdroid_nagios::nagios::objects::add_hostgroup_rules ( content => template($ng_tgt_hostgrp_head_erb), 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, + } } } diff --git a/manifests/params.pp b/manifests/params.pp index 371b706..ecb006f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -87,6 +87,12 @@ # Default is 'admins'. # @param [String] ng_contact_email The email address for the default contact. # 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 ( @@ -110,6 +116,11 @@ class confdroid_nagios::params ( String $ng_contact_groups = 'admins', 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 String $ng_log_file = '/var/log/nagios/nagios.log',