From b92f79716967f21c39d9fe127f2a91da1e2075d3 Mon Sep 17 00:00:00 2001 From: 12ww1160 <12ww1160@confdroid.com> Date: Sat, 21 Feb 2026 14:04:06 +0100 Subject: [PATCH] OP#436 add main file control link to wiki --- README.md | 4 ++-- manifests/main/dirs.pp | 6 +++--- manifests/params.pp | 7 ++++++- templates/nagios/cgi_cfg.erb | 1 + templates/nagios/nagios_cfg.erb | 26 +++++++------------------- 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 8176027..5ad8105 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ At this stage, the module is being redeveloped and being built to the latest sta - if FQDN equals the specified `ng_nagios_server`, nagios server with all required specs is installed, else only nagios client packages and the target specs - an additional directory /etc/nagios/conf.d is created to place the custom checks etc. without being overwritten by updates. -- 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) - - configures all required directories for server and clients and sets proper permissions and selinux contexts +- 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) ### configuring user access ToDo diff --git a/manifests/main/dirs.pp b/manifests/main/dirs.pp index 148390e..f644d14 100644 --- a/manifests/main/dirs.pp +++ b/manifests/main/dirs.pp @@ -158,7 +158,7 @@ class confdroid_nagios::main::dirs ( path => $ng_run_dir, owner => 'nagios', group => 'nagios', - mode => '0750', + mode => '0755', selrange => s0, selrole => object_r, seltype => nagios_var_run_t, @@ -171,7 +171,7 @@ class confdroid_nagios::main::dirs ( path => $ng_cmd_dir, owner => 'nagios', group => 'nagios', - mode => '0775', + mode => '2775', selrange => s0, selrole => object_r, seltype => nagios_spool_t, @@ -184,7 +184,7 @@ class confdroid_nagios::main::dirs ( path => $ng_checkresults_dir, owner => 'nagios', group => 'nagios', - mode => '0770', + mode => '0750', selrange => s0, selrole => object_r, seltype => nagios_spool_t, diff --git a/manifests/params.pp b/manifests/params.pp index 2bf611b..1e16048 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -25,6 +25,8 @@ # htpasswd utility. # @param [String] ng_context_help Whether to enable the context help in the # Nagios web interface. Default is '1'. +# @param [String] ng_log_file The path to the Nagios log file. Default is +# '/var/log/nagios/nagios.log'. ############################################################################### class confdroid_nagios::params ( @@ -37,7 +39,10 @@ class confdroid_nagios::params ( String $ng_main_user = 'nagios', String $ng_main_password = 'nagios', -# cgi +# nagios.cfg + String $ng_log_file = '/var/log/nagios/nagios.log', + +# cgi.cfg String $ng_context_help = '1', # httpd diff --git a/templates/nagios/cgi_cfg.erb b/templates/nagios/cgi_cfg.erb index 99865ea..104f8cc 100644 --- a/templates/nagios/cgi_cfg.erb +++ b/templates/nagios/cgi_cfg.erb @@ -88,3 +88,4 @@ navbar_search_for_aliases=<%= @ng_navbar_aliases %> ack_no_sticky=<%= @ng_ack_no_sticky %> ack_no_send=<%= @ng_ack_no_send %> + diff --git a/templates/nagios/nagios_cfg.erb b/templates/nagios/nagios_cfg.erb index 15eb1bd..ce6f68b 100644 --- a/templates/nagios/nagios_cfg.erb +++ b/templates/nagios/nagios_cfg.erb @@ -1,23 +1,11 @@ -############################################################################## -# -# NAGIOS.CFG - Sample Main Config File for Nagios 4.4.14 -# -# Read the documentation for more information on this configuration -# file. I've provided some comments here, but things may not be so -# clear without further explanation. -# -# -############################################################################## - +############################################################################### +########## parameterized nagios.cfg created by Puppet ########## +########## manual changes will be overwritten !!! ########## +### original nagios.cfg file is available at https://3for.me/hn6ca ########## +############################################################################### # LOG FILE -# This is the main log file where service and host events are logged -# for historical purposes. This should be the first option specified -# in the config file!!! - -log_file=/var/log/nagios/nagios.log - - +log_file=<%= @ng_log_file %> # OBJECT CONFIGURATION FILE(S) # These are the object configuration files in which you define hosts, @@ -1375,4 +1363,4 @@ allow_empty_hostgroup_assignment=0 # rampup_limit Minimum rampup_change # rampup_change # of jobs to add to jobs_limit when ramping up -#loadctl_options=jobs_max=100;backoff_limit=10;rampup_change=5 \ No newline at end of file +#loadctl_options=jobs_max=100;backoff_limit=10;rampup_change=5