From c5778d0cc9cbf444196b101b6bfe48dcd6db520a Mon Sep 17 00:00:00 2001 From: 12ww1160 <12ww1160@confdroid.com> Date: Sat, 7 Mar 2026 16:29:42 +0100 Subject: [PATCH] OP#436 more cgi.cfg --- manifests/params.pp | 42 ++++++++++- templates/nagios/cgi_cfg.erb | 141 +++++------------------------------ 2 files changed, 59 insertions(+), 124 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 53e15df..5ad235f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -336,8 +336,6 @@ # options in Nagios. Default is false. # @param [String] ng_load_ctl_options The load control options for Nagios. # Default is 'jobs_max=100;backoff_limit=10;rampup_change=5'. -# @param [String] ng_context_help Whether to enable context-sensitive -# help in Nagios. Default is '1'. # @param [String] ng_pending_states Whether to use pending states in Nagios. # Default is '1'. # @param [String] ng_use_auth Whether to use authentication in Nagios. @@ -348,7 +346,7 @@ # Nagios. Default is false. # @param [String] ng_def_user_name The name of the default user in Nagios. # Change to a suitable value. -# @param [String] ng_sysinfo_auth Additional username for the sysinfo +# @param [String] ng_sysinfo_auth Additional username for the sysinfo # authentication in Nagios. Choose a suitable value or leave empty # @param [String] ng_confinfo_auth Additional username for the confinfo # authentication in Nagios. Choose a suitable value or leave empty @@ -364,6 +362,31 @@ # authentication in Nagios. Choose a suitable value or leave empty # @param [String] ng_readonly_auth Additional username for the read-only # authentication in Nagios. Choose a suitable value or leave empty +# @param [Boolean] ng_use_colormap Whether to use colormap in Nagios. +# Default is false. +# @param [String] ng_colormap_red The color code for red in the colormap for +# Nagios. Default is '255'. +# @param [String] ng_colormap_green The color code for green in the colormap for +# Nagios. Default is '255'. +# @param [String] ng_colormap_blue The color code for blue in the colormap for +# Nagios. Default is '255 '. +# @param [String] ng_statusmap_layout The layout for the status map in Nagios. +# Default is '6'. +# @param [String] ng_wrl_layout The layout for the WRL in Nagios. Default is '4'. +# @param [Boolean] ng_incl_own_wrl Whether to include own WRL in Nagios. +# Default is false. +# @param [String] ng_statuswrl_include The WRL file to include in Nagios. +# Default is empty. +# @param [String] ng_ping_syntax The syntax for the check_ping command in Nagios. +# Default is '/bin/ping -n -U -c 5 $HOSTADDRESS$'. +# @param [String] ng_refresh_rate The refresh rate for the Nagios CGIs. +# Default is '90'. +# @param [String] ng_enable_page_tour Whether to enable the page tour in the +# Nagios web interface. Default is '1'. +# @param [String] ng_result_limit The result limit for the Nagios CGIs. +# Default is '100'. +# @param [String] ng_escape_html_tags Whether to escape HTML tags in the Nagios +# web interface. Default is '1'. ################################################################################ class confdroid_nagios::params ( @@ -533,6 +556,19 @@ class confdroid_nagios::params ( String $ng_host_cmd_auth = '', String $ng_svc_cmd_auth = '', String $ng_readonly_auth = '' , + Boolean $ng_use_colormap = false, + String $ng_colormap_red = '255', + String $ng_colormap_green = '255', + String $ng_colormap_blue = '255', + String $ng_statusmap_layout = '6', + String $ng_wrl_layout = '4', + Boolean $ng_incl_own_wrl = false, + String $ng_statuswrl_include = '', + String $ng_ping_syntax = '/bin/ping -n -U -c 5 $HOSTADDRESS$', + String $ng_refresh_rate = '90', + String $ng_enable_page_tour = '1', + String $ng_result_limit = '100', + String $ng_escape_html_tags = '1', # httpd Boolean $ng_use_https = false, diff --git a/templates/nagios/cgi_cfg.erb b/templates/nagios/cgi_cfg.erb index f1e5a99..455c12b 100644 --- a/templates/nagios/cgi_cfg.erb +++ b/templates/nagios/cgi_cfg.erb @@ -32,135 +32,34 @@ authorized_for_all_host_commands=<%= @ng_main_user %>,<%= @ng_host_cmd_auth %> <% unless @ng_readonly_auth.empty? -%> authorized_for_read_only=<%= @ng_readonly_auth %> <% end -%> +<% unless @ng_statusmap_img.empty? -%> +statusmap_background_image=<%= @ng_statusmap_img %> +<% end -%> - -# STATUSMAP BACKGROUND IMAGE -# This option allows you to specify an image to be used as a -# background in the statusmap CGI. It is assumed that the image -# resides in the HTML images path (i.e. /usr/local/nagios/share/images). -# This path is automatically determined by appending "/images" -# to the path specified by the 'physical_html_path' directive. -# Note: The image file may be in GIF, PNG, JPEG, or GD2 format. -# However, I recommend that you convert your image to GD2 format -# (uncompressed) but ONLY IF YOU WILL USE THE LEGACY MAP EXCLUSIVELY, -# as this will cause less CPU load when the CGI generates the image. - -#statusmap_background_image=smbackground.gd2 - - - -# STATUSMAP TRANSPARENCY INDEX COLOR -# These options set the r,g,b values of the background color used the statusmap CGI, -# so normal browsers that can't show real png transparency set the desired color as -# a background color instead (to make it look pretty). -# Defaults to white: (R,G,B) = (255,255,255). - +<% if @ng_use_colormap == true -%> +color_transparency_index_r=<%= @ng_colormap_red %> +color_transparency_index_g=<%= @ng_colormap_green %> +color_transparency_index_b=<%= @ng_colormap_blue %> +<% else -%> #color_transparency_index_r=255 #color_transparency_index_g=255 #color_transparency_index_b=255 +<% end -%> +default_statusmap_layout=<%= @ng_statusmap_layout%> +default_statuswrl_layout=<%= @ng_wrl_layout %> - -# DEFAULT STATUSMAP LAYOUT METHOD -# This option allows you to specify the default layout method -# the statusmap CGI should use for drawing hosts. If you do -# not use this option, the default for the legacy map is to use -# user-defined coordinates and the default for the new map is "6" -# (Circular Balloon). -# Valid options for the legacy map are as follows: -# 0 = User-defined coordinates -# 1 = Depth layers -# 2 = Collapsed tree -# 3 = Balanced tree -# 4 = Circular -# 5 = Circular (Marked Up) -# Valid options for the new map are as follows: -# 0 = User-defined coordinates -# 1 = Depth Layers (Horizontal) -# 2 = Collapsed tree (Horizontal) -# 3 = Balanced tree (Horizontal) -# 4 = DON'T USE -# 5 = Circular Markup -# 6 = Circular Balloon -# 7 = Balanced tree (Vertical) -# 8 = Collapsed tree (Vertical) -# 9 = Depth Layers (Vertical) -# 10 = Force Map - -#default_statusmap_layout=6 - - - -# DEFAULT STATUSWRL LAYOUT METHOD -# This option allows you to specify the default layout method -# the statuswrl (VRML) CGI should use for drawing hosts. If you -# do not use this option, the default is to use user-defined -# coordinates. Valid options are as follows: -# 0 = User-defined coordinates -# 2 = Collapsed tree -# 3 = Balanced tree -# 4 = Circular - -default_statuswrl_layout=4 - - - -# STATUSWRL INCLUDE -# This option allows you to include your own objects in the -# generated VRML world. It is assumed that the file -# resides in the HTML path (i.e. /usr/local/nagios/share). - +<% if @ng_incl_own_wrl == true -%> +statuswrl_include=<%= @ng_statuswrl_include %> +<% else -%> #statuswrl_include=myworld.wrl +<% end -%> - - -# PING SYNTAX -# This option determines what syntax should be used when -# attempting to ping a host from the WAP interface (using -# the statuswml CGI. You must include the full path to -# the ping binary, along with all required options. The -# $HOSTADDRESS$ macro is substituted with the address of -# the host before the command is executed. -# Please note that the syntax for the ping binary is -# notorious for being different on virtually ever *NIX -# OS and distribution, so you may have to tweak this to -# work on your system. - -ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$ - - - -# REFRESH RATE -# This option allows you to specify the refresh rate in seconds -# of various CGIs (status, statusmap, extinfo, and outages). - -refresh_rate=90 - - - -# PAGE TOUR -# Enable page tour for helpful tips and tricks on various pages - -#enable_page_tour=1 - - - -# DEFAULT PAGE LIMIT -# This option allows you to specify the default number of results -# displayed on the status.cgi. This number can be adjusted from -# within the UI after the initial page load. Setting this to 0 -# will show all results. - -result_limit=100 - - - -# ESCAPE HTML TAGS -# This option determines whether HTML tags in host and service -# status output is escaped in the web interface. If enabled, -# your plugin output will not be able to contain clickable links. - -escape_html_tags=1 +ping_syntax=<%= @ng_ping_syntax %> +refresh_rate=<%= @ng_refresh_rate %> +enable_page_tour=<%= @ng_enable_page_tour %> +result_limit=1<%= @ng_result_limit %> +escape_html_tags=<%= @ng_escape_html_tags %>