OP#436 add negios section resources

This commit is contained in:
2026-02-28 16:16:59 +01:00
parent 0ac4426bd6
commit c5a28ee036
6 changed files with 84 additions and 3 deletions

View File

@@ -0,0 +1,48 @@
## confdroid_nagios::nagios::resources::resource.pp
# Module name: confdroid_nagios
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages the resource config file header.
# @example concat::fragment { "user_rule_plugins":
# ng_user_arg_name => "$user1$",
# ng_user_arg_value => '/usr/lib64/nagios/plugins',
# ng_user_arg_comment => "Sets $USER1$ to be the path to the plugins",
# }
#############################################################################
class confdroid_nagios::nagios::resources::resource (
) inherits confdroid_nagios::params {
if $fqdn == $ng_nagios_server {
concat { $ng_resource_file:
ensure => present,
owner => 'root',
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
concat::fragment { 'header':
target => $ng_resource_file,
content => template($ng_resource_erb),
order => '000',
}
# plugins rule
confdroid_nagios::nagios::resources::resource_df { 'user_rule_plugins':
ng_user_arg_name => 'USER1',
ng_user_arg_value => '/usr/lib64/nagios/plugins/',
ng_user_arg_comment => 'Sets user1 to be the path to the plugins',
}
# eventhandlers rule
confdroid_nagios::nagios::resources::resource_df { 'user_rule_eventhandlers':
ng_user_arg_name => 'USER2',
ng_user_arg_value => '/usr/lib64/nagios/plugins/eventhandlers/',
ng_user_arg_comment => 'Sets user2 to be the path to the eventhandlers',
}
}
}

View File

@@ -0,0 +1,28 @@
## confdroid_nagios::nagios::resources::resource_df.pp
# Module name: confdroid_nagios
# Author: 12ww1160 (12ww1160@ConfDroid.com)
# @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_value the value of t user argument i.e. $user1$
# @param [String] ng_user_arg_comment the argument i.e. $user1$
# @param [String] ng_resource_rule_erb resource rule #
#############################################################################
define confdroid_nagios::nagios::resources::resource_df (
Optional[String] $ng_user_arg_name = undef,
Optional[String] $ng_user_arg_value = undef,
Optional[String] $ng_user_arg_comment = undef,
String $ng_resource_rule_erb = 'confdroid_nagios/nagios/resource_cfg_rule.erb',
) {
$ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
$ng_resource_file = $confdroid_nagios::params::ng_resource_file
if $fqdn == $ng_nagios_server {
concat::fragment { "rule_${name}":
target => $ng_resource_file,
content => template($ng_resource_rule_erb),
order => '000',
}
}
}