diff --git a/manifests/params.pp b/manifests/params.pp index e6a8966..bc4c30c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -203,91 +203,160 @@ # attribute mask for Nagios. Default is '0'. # @param [String] ng_ret_contact_s_attr_mask The retention contact service # attribute mask for Nagios. Default is '0'. +# @param [String] ng_interval_length The interval length for Nagios. +# Default is '60'. +# @param [String] ng_check_for_updates Whether to check for updates in Nagios. +# Default is '1'. +# @param [String] ng_bare_update_check Whether to perform a bare update check +# in Nagios. Default is '1'. +# @param [String] ng_use_aggr_host_checking Whether to use aggressive host checking +# in Nagios. Default is '0'. +# @param [String] ng_execute_service_checks Whether to execute service checks in +# Nagios at initial start. Default is '1'. +# @param [String] ng_accept_pass_svc_checks Whether to accept passive service +# checks in Nagios. Default is '1'. +# @param [String] ng_execute_host_checks Whether to execute host checks in Nagios +# at initial start. Default is '1'. +# @param [String] ng_accept_pass_host_checks Whether to accept passive host +# checks in Nagios. Default is '1'. +# @param [String] ng_enable_notifications Whether to enable notifications in +# Nagios when it is initially started. Default is '1'. +# @param [String] ng_enable_event_handlers Whether to enable event handlers in +# Nagios when it is initially started. Default is '1'. +# @param [String] ng_process_perf_data Whether to process performance data in +# Nagios when it is initially started. Default is '0'. +# @param [String] ng_host_perfdata_command The command to process host +# performance data in Nagios. Default is 'process-host-perfdata'. +# @param [String] ng_svc_perfdata_command The command to process service +# performance data in Nagios. Default is 'process-service-perfdata'. +# @param [String] ng_host_perfdata_template The template for host performance +# data in Nagios. +# @param [String] ng_svc_perfdata_template The template for service performance +# data in Nagios. +# @param [String] ng_host_perfdata_file_mode The file mode for host performance +# data in Nagios. Default is 'a'. +# @param [String] ng_svc_perfdata_file_mode The file mode for service performance +# data in Nagios. Default is 'a'. +# @param [String] ng_h_perfdata_proc_intval The interval for processing host +# performance data in Nagios. Default is '0'. +# @param [String] ng_s_perfdata_proc_intval The interval for processing service +# performance data in Nagios. Default is '0'. +# @param [String] ng_h_perfdata_proc_cmd The command to process host performance +# data in Nagios. Default is 'process-host-perfdata'. +# @param [String] ng_s_perfdata_proc_cmd The command to process service performance +# data in Nagios. Default is 'process-service-perfdata'. +# @param [String] ng_h_perfdata_proc_e_result The expected result for processing +# host performance data in Nagios. Default is '0'. +# @param [String] ng_s_perfdata_proc_e_result The expected result for processing +# service performance data in Nagios. Default is '0'. ################################################################################ class confdroid_nagios::params ( # main - String $ng_nagios_server = 'nagios.example.net', - Array $ng_reqpackages_server = ['nagios','nagios-devel'], - Array $ng_reqpackages_client = ['net-snmp-utils','nagios-plugins','nagios-plugins-all','nagios-plugins-nrpe','nagios-common'], - String $ng_pkg_ensure = 'present', - Boolean $ng_include_nrpe = true, - String $ng_main_user = 'nagios', - String $ng_main_password = 'nagios', - String $ng_max_check_attempts = '10', - String $ng_status_upd_interval = '10', - String $ng_check_ext_commands = '1', - String $ng_user = 'nagios', - Boolean $ng_enable_target = true, - Boolean $ng_purge_target = true, + String $ng_nagios_server = 'nagios.example.net', + Array $ng_reqpackages_server = ['nagios','nagios-devel'], + Array $ng_reqpackages_client = ['net-snmp-utils','nagios-plugins','nagios-plugins-all','nagios-plugins-nrpe','nagios-common'], + String $ng_pkg_ensure = 'present', + Boolean $ng_include_nrpe = true, + String $ng_main_user = 'nagios', + String $ng_main_password = 'nagios', + String $ng_max_check_attempts = '10', + String $ng_status_upd_interval = '10', + String $ng_check_ext_commands = '1', + String $ng_user = 'nagios', + Boolean $ng_enable_target = true, + Boolean $ng_purge_target = true, # contact groups - String $ng_contactgroup_name = 'admins', - String $ng_contactgroup_alias = 'Nagios Administrators', - String $ng_contactgroup_members = 'nagiosadmin', + String $ng_contactgroup_name = 'admins', + String $ng_contactgroup_alias = 'Nagios Administrators', + String $ng_contactgroup_members = 'nagiosadmin', # contacts - String $ng_contact_name = 'nagiosadmin', - String $ng_contact_alias = 'Nagios Admin', - String $ng_contact_groups = 'admins', - String $ng_contact_email = 'nagiosadmin@example.net', + String $ng_contact_name = 'nagiosadmin', + String $ng_contact_alias = 'Nagios Admin', + 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_name = 'linux-servers', + String $ng_hostgroup_alias = 'Linux Servers', # nagios.cfg - String $ng_log_file = '/var/log/nagios/nagios.log', - String $ng_event_broker_options = '-1', - Boolean $ng_enable_query_handler = false, - Array $ng_event_broker_module = [], - String $ng_log_rotation_method = 'd', - String $ng_use_syslog = '1', - String $ng_log_notifications = '1', - String $ng_log_service_retries = '1', - String $ng_log_host_retries = '1', - String $ng_log_event_handlers = '1', - String $ng_log_initial_states = '0', - String $ng_log_current_states = '1', - String $ng_log_external_commands = '1', - String $ng_log_passive_checks = '1', - Array $ng_glob_host_evt_handler = [], - Array $ng_glob_svc_evt_handler = [], - String $ng_svc_int_check_delay = 's', - String $ng_max_svc_check_spread = '30', - String $ng_svc_interleave_factor = 's', - String $ng_host_int_check_delay = 's', - String $ng_max_host_check_spread = '30', - String $ng_max_concurrent_checks = '0', - String $ng_check_res_reaper_freq = '10', - String $ng_max_check_res_reap_time = '30', - String $ng_max_check_res_file_age = '3600', - String $ng_cached_h_check_horizon = '15', - String $ng_cached_s_check_horizon = '15', - String $ng_pred_host_dep_checks = '1', - String $ng_pred_svc_dep_checks = '1', - String $ng_soft_state_dependencies = '0', - String $ng_time_change_threshold = '900', - String $ng_auto_reschedule_checks = '1', - String $ng_auto_reschedule_intval = '30', - String $ng_auto_reschedule_window = '180', - String $ng_service_check_timeout = '60', - String $ng_host_check_timeout = '30', - String $ng_event_handler_timeout = '30', - String $ng_notification_timeout = '30', - String $ng_ocsp_timeout = '5', - String $ng_ochp_timeout = '5', - String $ng_perfdata_timeout = '5', - String $ng_retain_state_inf = '1', - String $ng_retention_update_intval = '60', - String $ng_use_ret_program_state = '1', - String $ng_use_ret_scheduling_info = '1', - String $ng_ret_host_attr_mask = '0', - String $ng_ret_service_attr_mask = '0', - String $ng_ret_proc_host_attr_mask = '0', - String $ng_ret_proc_svc_attr_mask = '0', - String $ng_ret_contact_h_attr_mask = '0', - String $ng_ret_contact_s_attr_mask = '0', + String $ng_log_file = '/var/log/nagios/nagios.log', + String $ng_event_broker_options = '-1', + Boolean $ng_enable_query_handler = false, + Array $ng_event_broker_module = [], + String $ng_log_rotation_method = 'd', + String $ng_use_syslog = '1', + String $ng_log_notifications = '1', + String $ng_log_service_retries = '1', + String $ng_log_host_retries = '1', + String $ng_log_event_handlers = '1', + String $ng_log_initial_states = '0', + String $ng_log_current_states = '1', + String $ng_log_external_commands = '1', + String $ng_log_passive_checks = '1', + Array $ng_glob_host_evt_handler = [], + Array $ng_glob_svc_evt_handler = [], + String $ng_svc_int_check_delay = 's', + String $ng_max_svc_check_spread = '30', + String $ng_svc_interleave_factor = 's', + String $ng_host_int_check_delay = 's', + String $ng_max_host_check_spread = '30', + String $ng_max_concurrent_checks = '0', + String $ng_check_res_reaper_freq = '10', + String $ng_max_check_res_reap_time = '30', + String $ng_max_check_res_file_age = '3600', + String $ng_cached_h_check_horizon = '15', + String $ng_cached_s_check_horizon = '15', + String $ng_pred_host_dep_checks = '1', + String $ng_pred_svc_dep_checks = '1', + String $ng_soft_state_dependencies = '0', + String $ng_time_change_threshold = '900', + String $ng_auto_reschedule_checks = '1', + String $ng_auto_reschedule_intval = '30', + String $ng_auto_reschedule_window = '180', + String $ng_service_check_timeout = '60', + String $ng_host_check_timeout = '30', + String $ng_event_handler_timeout = '30', + String $ng_notification_timeout = '30', + String $ng_ocsp_timeout = '5', + String $ng_ochp_timeout = '5', + String $ng_perfdata_timeout = '5', + String $ng_retain_state_inf = '1', + String $ng_retention_update_intval = '60', + String $ng_use_ret_program_state = '1', + String $ng_use_ret_scheduling_info = '1', + String $ng_ret_host_attr_mask = '0', + String $ng_ret_service_attr_mask = '0', + String $ng_ret_proc_host_attr_mask = '0', + String $ng_ret_proc_svc_attr_mask = '0', + String $ng_ret_contact_h_attr_mask = '0', + String $ng_ret_contact_s_attr_mask = '0', + String $ng_interval_length = '60', + String $ng_check_for_updates = '1', + String $ng_bare_update_check = '1', + String $ng_use_aggr_host_checking = '0', + String $ng_execute_service_checks = '1', + String $ng_accept_pass_svc_checks = '1', + String $ng_execute_host_checks = '1', + String $ng_accept_pass_host_checks = '1', + String $ng_enable_notifications = '1', + String $ng_enable_event_handlers = '1', + String $ng_process_perf_data = '0', + String $ng_host_perfdata_command = 'process-host-perfdata', + String $ng_svc_perfdata_command = 'process-service-perfdata', + String $ng_host_perfdata_template = '[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$', + String $ng_svc_perfdata_template = '[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$', + String $ng_host_perfdata_file_mode = 'a', + String $ng_svc_perfdata_file_mode = 'a', + String $ng_h_perfdata_proc_intval = '0', + String $ng_s_perfdata_proc_intval = '0', + String $ng_h_perfdata_proc_cmd = 'process-host-perfdata', + String $ng_s_perfdata_proc_cmd = 'process-service-perfdata', + String $ng_h_perfdata_proc_e_result = '0', + String $ng_s_perfdata_proc_e_result = '0', # cgi.cfg String $ng_context_help = '1', @@ -408,27 +477,29 @@ class confdroid_nagios::params ( $ng_temp_file = "${ng_spool_dir}/nagios.tmp" $ng_check_result_path = "${ng_spool_dir}/checkresults" $ng_state_retention_file = "${ng_spool_dir}/retention.dat" + $ng_host_perfdata_file = "${ng_log_dir}/host-perfdata" + $ng_svc_perfdata_file = "${ng_log_dir}/service-perfdata" ## old - $ng_taccgi_erb = 'confdroid_nagios/selinux/taccgi.erb' - $ng_statcgi_erb = 'confdroid_nagios/selinux/statuscgi.erb' - $ng_statdat_erb = 'confdroid_nagios/selinux/statusdat.erb' - $ng_checknrpe_erb = 'confdroid_nagios/selinux/checknrpe.erb' - $ng_checknagios_erb = 'confdroid_nagios/selinux/checknagios.erb' - $ng_nagios_conf = '/etc/httpd/conf.d/nagios.conf' - $ng_nagios_conf_erb = 'confdroid_nagios/httpd/nagios_conf.erb' - $ng_welcome_conf = '/etc/httpd/conf.d/welcome.conf' - $ng_welcome_conf_erb = 'confdroid_nagios/httpd/welcome_conf.erb' - $ng_forward_conf = '/etc/httpd/conf.d/nagios_forward.conf' - $ng_forward_conf_erb = 'confdroid_nagios/httpd/forward_conf.erb' - $ng_get_cert_erb = 'confdroid_nagios/certbot/get_cert.erb' - $ng_unless_get_cert = 'confdroid_nagios/certbot/unless_get_cert.erb' - $ng_unless_renew_erb = 'confdroid_nagios/certbot/unless_renew_cert.erb' - $ng_index_html_file = '/var/www/html/index.html' - $ng_index_html_erb = 'confdroid_nagios/httpd/index_html.erb' - $ng_ssl_vhost_file = '/etc/httpd/conf.d/nagios_ssl.conf' - $ng_ssl_vhost_erb = 'confdroid_nagios/httpd/nagios_ssl_vhost.erb' - $ng_grep_erb = 'confdroid_nagios/selinux/grep.erb' +# $ng_taccgi_erb = 'confdroid_nagios/selinux/taccgi.erb' +# $ng_statcgi_erb = 'confdroid_nagios/selinux/statuscgi.erb' +# $ng_statdat_erb = 'confdroid_nagios/selinux/statusdat.erb' +# $ng_checknrpe_erb = 'confdroid_nagios/selinux/checknrpe.erb' +# $ng_checknagios_erb = 'confdroid_nagios/selinux/checknagios.erb' +# $ng_nagios_conf = '/etc/httpd/conf.d/nagios.conf' +# $ng_nagios_conf_erb = 'confdroid_nagios/httpd/nagios_conf.erb' +# $ng_welcome_conf = '/etc/httpd/conf.d/welcome.conf' +# $ng_welcome_conf_erb = 'confdroid_nagios/httpd/welcome_conf.erb' +# $ng_forward_conf = '/etc/httpd/conf.d/nagios_forward.conf' +# $ng_forward_conf_erb = 'confdroid_nagios/httpd/forward_conf.erb' +# $ng_get_cert_erb = 'confdroid_nagios/certbot/get_cert.erb' +# $ng_unless_get_cert = 'confdroid_nagios/certbot/unless_get_cert.erb' +# $ng_unless_renew_erb = 'confdroid_nagios/certbot/unless_renew_cert.erb' +# $ng_index_html_file = '/var/www/html/index.html' +# $ng_index_html_erb = 'confdroid_nagios/httpd/index_html.erb' +# $ng_ssl_vhost_file = '/etc/httpd/conf.d/nagios_ssl.conf' +# $ng_ssl_vhost_erb = 'confdroid_nagios/httpd/nagios_ssl_vhost.erb' +# $ng_grep_erb = 'confdroid_nagios/selinux/grep.erb' # includes must be last include confdroid_nagios::main::config diff --git a/templates/nagios/nagios_cfg.erb b/templates/nagios/nagios_cfg.erb index 0003d02..dd0f9e0 100644 --- a/templates/nagios/nagios_cfg.erb +++ b/templates/nagios/nagios_cfg.erb @@ -120,210 +120,36 @@ retained_process_service_attribute_mask=<%= @ng_ret_proc_svc_attr_mask %> retained_contact_host_attribute_mask=<%= @ng_ret_contact_h_attr_mask %> retained_contact_service_attribute_mask=<%= @ng_ret_contact_s_attr_mask %> - -# INTERVAL LENGTH -# This is the seconds per unit interval as used in the -# host/contact/service configuration files. Setting this to 60 means -# that each interval is one minute long (60 seconds). Other settings -# have not been tested much, so your mileage is likely to vary... - -interval_length=60 - - - -# CHECK FOR UPDATES -# This option determines whether Nagios will automatically check to -# see if new updates (releases) are available. It is recommend that you -# enable this option to ensure that you stay on top of the latest critical -# patches to Nagios. Nagios is critical to you - make sure you keep it in -# good shape. Nagios will check once a day for new updates. Data collected -# by Nagios Enterprises from the update check is processed in accordance -# with our privacy policy - see https://api.nagios.org for details. - -check_for_updates=1 - - - -# BARE UPDATE CHECK -# This option determines what data Nagios will send to api.nagios.org when -# it checks for updates. By default, Nagios will send information on the -# current version of Nagios you have installed, as well as an indicator as -# to whether this was a new installation or not. Nagios Enterprises uses -# this data to determine the number of users running specific version of -# Nagios. Enable this option if you do not want this information to be sent. - -bare_update_check=0 - - - -# AGGRESSIVE HOST CHECKING OPTION -# If you don't want to turn on aggressive host checking features, set -# this value to 0 (the default). Otherwise set this value to 1 to -# enable the aggressive check option. Read the docs for more info -# on what aggressive host check is or check out the source code in -# base/checks.c - -use_aggressive_host_checking=0 - - - -# SERVICE CHECK EXECUTION OPTION -# This determines whether or not Nagios will actively execute -# service checks when it initially starts. If this option is -# disabled, checks are not actively made, but Nagios can still -# receive and process passive check results that come in. Unless -# you're implementing redundant hosts or have a special need for -# disabling the execution of service checks, leave this enabled! -# Values: 1 = enable checks, 0 = disable checks - -execute_service_checks=1 - - - -# PASSIVE SERVICE CHECK ACCEPTANCE OPTION -# This determines whether or not Nagios will accept passive -# service checks results when it initially (re)starts. -# Values: 1 = accept passive checks, 0 = reject passive checks - -accept_passive_service_checks=1 - - - -# HOST CHECK EXECUTION OPTION -# This determines whether or not Nagios will actively execute -# host checks when it initially starts. If this option is -# disabled, checks are not actively made, but Nagios can still -# receive and process passive check results that come in. Unless -# you're implementing redundant hosts or have a special need for -# disabling the execution of host checks, leave this enabled! -# Values: 1 = enable checks, 0 = disable checks - -execute_host_checks=1 - - - -# PASSIVE HOST CHECK ACCEPTANCE OPTION -# This determines whether or not Nagios will accept passive -# host checks results when it initially (re)starts. -# Values: 1 = accept passive checks, 0 = reject passive checks - -accept_passive_host_checks=1 - - - -# NOTIFICATIONS OPTION -# This determines whether or not Nagios will sent out any host or -# service notifications when it is initially (re)started. -# Values: 1 = enable notifications, 0 = disable notifications - -enable_notifications=1 - - - -# EVENT HANDLER USE OPTION -# This determines whether or not Nagios will run any host or -# service event handlers when it is initially (re)started. Unless -# you're implementing redundant hosts, leave this option enabled. -# Values: 1 = enable event handlers, 0 = disable event handlers - -enable_event_handlers=1 - - - -# PROCESS PERFORMANCE DATA OPTION -# This determines whether or not Nagios will process performance -# data returned from service and host checks. If this option is -# enabled, host performance data will be processed using the -# host_perfdata_command (defined below) and service performance -# data will be processed using the service_perfdata_command (also -# defined below). Read the HTML docs for more information on -# performance data. -# Values: 1 = process performance data, 0 = do not process performance data - -process_performance_data=0 - - - -# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS -# These commands are run after every host and service check is -# performed. These commands are executed only if the -# enable_performance_data option (above) is set to 1. The command -# argument is the short name of a command definition that you -# define in your host configuration file. Read the HTML docs for -# more information on performance data. - -#host_perfdata_command=process-host-perfdata -#service_perfdata_command=process-service-perfdata - - - -# HOST AND SERVICE PERFORMANCE DATA FILES -# These files are used to store host and service performance data. -# Performance data is only written to these files if the -# enable_performance_data option (above) is set to 1. - -#host_perfdata_file=/var/log/nagios/host-perfdata -#service_perfdata_file=/var/log/nagios/service-perfdata - - - -# HOST AND SERVICE PERFORMANCE DATA FILE TEMPLATES -# These options determine what data is written (and how) to the -# performance data files. The templates may contain macros, special -# characters (\t for tab, \r for carriage return, \n for newline) -# and plain text. A newline is automatically added after each write -# to the performance data file. Some examples of what you can do are -# shown below. - -#host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$ -#service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$ - - - -# HOST AND SERVICE PERFORMANCE DATA FILE MODES -# This option determines whether or not the host and service -# performance data files are opened in write ("w") or append ("a") -# mode. If you want to use named pipes, you should use the special -# pipe ("p") mode which avoid blocking at startup, otherwise you will -# likely want the default append ("a") mode. - -#host_perfdata_file_mode=a -#service_perfdata_file_mode=a - - - -# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING INTERVAL -# These options determine how often (in seconds) the host and service -# performance data files are processed using the commands defined -# below. A value of 0 indicates the files should not be periodically -# processed. - -#host_perfdata_file_processing_interval=0 -#service_perfdata_file_processing_interval=0 - - - -# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS -# These commands are used to periodically process the host and -# service performance data files. The interval at which the -# processing occurs is determined by the options above. - -#host_perfdata_file_processing_command=process-host-perfdata-file -#service_perfdata_file_processing_command=process-service-perfdata-file - - - -# HOST AND SERVICE PERFORMANCE DATA PROCESS EMPTY RESULTS -# These options determine whether the core will process empty perfdata -# results or not. This is needed for distributed monitoring, and intentionally -# turned on by default. -# If you don't require empty perfdata - saving some cpu cycles -# on unwanted macro calculation - you can turn that off. Be careful! -# Values: 1 = enable, 0 = disable - -#host_perfdata_process_empty_results=1 -#service_perfdata_process_empty_results=1 - +interval_length=<%= @ng_interval_length %> +check_for_updates=<%= @ng_check_for_updates %> +bare_update_check=<%= @ng_bare_update_check %> + +use_aggressive_host_checking=<%= @ng_use_aggr_host_checking %> +execute_service_checks=<%= @ng_execute_service_checks %> +accept_passive_service_checks=<%= @ng_accept_pass_svc_checks %> +execute_host_checks=<%= @ng_execute_host_checks %> +accept_passive_host_checks=<%= @ng_accept_pass_host_checks %> + +enable_notifications=<%= @ng_enable_notifications %> +enable_event_handlers=<%= @ng_enable_event_handlers %> +process_performance_data=<%= @ng_process_perf_data %> + +<% if @ng_process_perf_data == '1' -%> +host_perfdata_command=<%= @ng_host_perfdata_command %> +service_perfdata_command=<%= @ng_svc_perfdata_command %> +host_perfdata_file=<%= @ng_host_perfdata_file %> +service_perfdata_file=<%= @ng_service_perfdata_file %> +host_perfdata_file_template=<%= @ng_host_perfdata_template %> +service_perfdata_file_template=<%= @ng_svc_perfdata_template %> +host_perfdata_file_mode=<%= @ng_host_perfdata_file_mode %> +service_perfdata_file_mode=<%= @ng_svc_perfdata_file_mode %> +host_perfdata_file_processing_interval=<%= @ng_h_perfdata_proc_intval %> +service_perfdata_file_processing_interval=<%= @ng_s_perfdata_proc_intval %> +host_perfdata_file_processing_command=<%= @ng_h_perfdata_proc_cmd %> +service_perfdata_file_processing_command=<%= @ng_s_perfdata_proc_cmd %> +host_perfdata_process_empty_results=<%= @ng_h_perfdata_proc_e_res %> +service_perfdata_process_empty_results=<%= @ng_s_perfdata_proc_e_res %> +<% end -%> # OBSESS OVER SERVICE CHECKS OPTION # This determines whether or not Nagios will obsess over service