From 0cc0bb42b5b44f74ad9e1efe2df330ef7900f52a Mon Sep 17 00:00:00 2001 From: 12ww1160 <12ww1160@confdroid.com> Date: Sat, 7 Mar 2026 16:59:51 +0100 Subject: [PATCH] OP#436 almost done cgi.cfg --- manifests/params.pp | 49 ++++++++++++++++++ templates/nagios/cgi_cfg.erb | 99 +++++++++--------------------------- 2 files changed, 72 insertions(+), 76 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 337bc46..8c8d13f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -388,6 +388,39 @@ # @param [String] ng_escape_html_tags Whether to escape HTML tags in the Nagios # web interface. Default is '1'. # @param [String] ng_statusmap_img The image to use for the status map in Nagios. +# Choose a suitable value or leave empty to use the default image. +# @param [Boolean] ng_use_sound Whether to use sound in the Nagios web interface. +# Default is false. +# @param [String] ng_host_unreachable The sound file to play when a host is +# unreachable. Default is 'hostdown.wav'. +# @param [String] ng_host_down The sound file to play when a host is down. +# Default is 'hostdown.wav'. +# @param [String] ng_svc_critical The sound file to play when a service is +# critical. Default is 'critical.wav'. +# @param [String] ng_svc_warn The sound file to play when a service is warning. +# Default is 'warning.wav'. +# @param [String] ng_svc_unknown The sound file to play when a service is unknown. +# Default is 'warning.wav'. +# @param [String] ng_normal_sound The sound file to play when a host or service +# returns to normal. Default is 'noproblem.wav'. +# @param [String] ng_action_url_target The target for action URLs in the Nagios +# web interface. Default is '_blank'. +# @param [String] ng_notes_url_target The target for notes URLs in the Nagios +# web interface. Default is '_blank'. +# @param [String] ng_lock_author_names Whether to lock author names in +# the Nagios web interface. Default is '1'. +# @param [Boolean] ng_enable_splunk Whether to enable Splunk integration +# in Nagios. Default is false. +# @param [String] ng_splunk_url The URL for the Splunk instance in Nagios. +# Default is 'https://splunk.example.net:8000'. +# @param [String] ng_navbar_addresses Whether to enable navbar search for +# addresses in Nagios. Default is '1'. +# @param [String] ng_navbar_aliases Whether to enable navbar search for aliases +# in Nagios. Default is '1'. +# @param [String] ng_ack_no_sticky Whether to allow non-sticky acknowledgements +# in Nagios. Default is '1'. +# @param [String] ng_ack_no_send Whether to allow non-send acknowledgements +# in Nagios. Default is '1'. ################################################################################ class confdroid_nagios::params ( @@ -571,6 +604,22 @@ class confdroid_nagios::params ( String $ng_enable_page_tour = '1', String $ng_result_limit = '100', String $ng_escape_html_tags = '1', + Boolean $ng_use_sound = false, + String $ng_host_unreachable = 'hostdown.wav', + String $ng_host_down = 'hostdown.wav', + String $ng_svc_critical = 'critical.wav', + String $ng_svc_warn = 'warning.wav', + String $ng_svc_unknown = 'warning.wav', + String $ng_normal_sound = 'noproblem.wav', + String $ng_action_url_target = '_blank', + String $ng_notes_url_target = '_blank', + String $ng_lock_author_names = '1', + Boolean $ng_enable_splunk = false, + String $ng_splunk_url = 'https://splunk.example.net:8000', + String $ng_navbar_addresses = '1', + String $ng_navbar_aliases = '1', + String $ng_ack_no_sticky = '0', + String $ng_ack_no_send = '0', # httpd Boolean $ng_use_https = false, diff --git a/templates/nagios/cgi_cfg.erb b/templates/nagios/cgi_cfg.erb index 455c12b..97754d3 100644 --- a/templates/nagios/cgi_cfg.erb +++ b/templates/nagios/cgi_cfg.erb @@ -58,96 +58,43 @@ statuswrl_include=<%= @ng_statuswrl_include %> ping_syntax=<%= @ng_ping_syntax %> refresh_rate=<%= @ng_refresh_rate %> enable_page_tour=<%= @ng_enable_page_tour %> -result_limit=1<%= @ng_result_limit %> +result_limit=<%= @ng_result_limit %> escape_html_tags=<%= @ng_escape_html_tags %> - - -# SOUND OPTIONS -# These options allow you to specify an optional audio file -# that should be played in your browser window when there are -# problems on the network. The audio files are used only in -# the status CGI. Only the sound for the most critical problem -# will be played. Order of importance (higher to lower) is as -# follows: unreachable hosts, down hosts, critical services, -# warning services, and unknown services. If there are no -# visible problems, the sound file optionally specified by -# 'normal_sound' variable will be played. -# -# -# = -# -# Note: All audio files must be placed in the /media subdirectory -# under the HTML path (i.e. /usr/local/nagios/share/media/). - +<% if @ng_use_sound == true -%> +host_unreachable_sound=<%= @ng_host_unreachable %> +host_down_sound=<%= @ng_host_down %> +service_critical_sound=<%= @ng_svc_critical %> +service_warning_sound=<%= @ng_svc_warn %> +service_unknown_sound=<%= @ng_svc_unknown %> +normal_sound=<%= @ng_normal_sound %> +<% else -%> #host_unreachable_sound=hostdown.wav #host_down_sound=hostdown.wav #service_critical_sound=critical.wav #service_warning_sound=warning.wav #service_unknown_sound=warning.wav #normal_sound=noproblem.wav +<% end -%> +action_url_target=<%= @ng_action_url_target %> +notes_url_target=<%= @ng_notes_url_target %> +lock_author_names=<%= @ng_lock_author_names %> -# URL TARGET FRAMES -# These options determine the target frames in which notes and -# action URLs will open. - -action_url_target=_blank -notes_url_target=_blank - - - -# LOCK AUTHOR NAMES OPTION -# This option determines whether users can change the author name -# when submitting comments, scheduling downtime. If disabled, the -# author names will be locked into their contact name, as defined in Nagios. -# Values: 0 = allow editing author names -# 1 = lock author names (disallow editing) - -lock_author_names=1 - - - -# SPLUNK INTEGRATION OPTIONS -# These options allow you to enable integration with Splunk -# in the web interface. If enabled, you'll be presented with -# "Splunk It" links in various places in the CGIs (log file, -# alert history, host/service detail, etc). Useful if you're -# trying to research why a particular problem occurred. -# For more information on Splunk, visit http://www.splunk.com/ - -# This option determines whether the Splunk integration is enabled -# Values: 0 = disable Splunk integration -# 1 = enable Splunk integration - -#enable_splunk_integration=1 - -# This option should be the URL used to access your instance of Splunk +<% if @ng_enable_splunk -%> +enable_splunk_integration=1 +splunk_url=<%= @ng_splunk_url %> +<% else -%> +enable_splunk_integration=0 #splunk_url=http://127.0.0.1:8000/ +<% end -%> +navbar_search_for_addresses=<%= @ng_navbar_addresses %> +navbar_search_for_aliases=<%= @ng_navbar_aliases %> - -# NAVIGATION BAR SEARCH OPTIONS -# The following options allow to configure the navbar search. Default -# is to search for hostnames. With enabled navbar_search_for_addresses, -# the navbar search queries IP addresses as well. It's also possible -# to enable search for aliases by setting navbar_search_for_aliases=1. - -navbar_search_for_addresses=1 -navbar_search_for_aliases=1 - - - -# DEFAULTS FOR CHECKBOXES FOR ACKNOWLEDGEMENTS -# Enabling ack_no_sticky will default the "Sticky Acknowledgement" to -# be unchecked. -# Enabling ack_no_send will default the "Send Notification" to -# be unchecked. - -#ack_no_sticky=0 -#ack_no_send=0 - +ack_no_sticky=<%= @ng_ack_no_sticky %> +ack_no_send=<%= @ng_ack_no_send %> # SHOW ONLY HARD STATES IS TACTICAL OVERVIEW