[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: new config option to set initial state of persistence for acknowledgements

git at icinga.org git at icinga.org
Mon Jul 26 10:28:43 CEST 2010


Module: icinga-core
Branch: mfriedrich/core
Commit: 182d3514911f87c6cda76b1646887cfa0cc9eafd
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=182d3514911f87c6cda76b1646887cfa0cc9eafd

Author: Christoph Maser <cmr at financial.com>
Date:   Sun Jul 25 10:08:56 2010 +0200

new config option to set initial state of persistence for acknowledgements

This options determines whether the initial state of the
checkbox "Persistent Comment:" for service and host
problem acknowledgements is checked or unchecked

refs #583

---

 cgi/cgiutils.c           |    5 +++++
 cgi/cmd.c                |   14 ++++++++++++--
 sample-config/cgi.cfg.in |   40 ++++++++++++++++++++++++----------------
 3 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index b84f4c9..cd07287 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -109,6 +109,8 @@ int             refresh_rate=DEFAULT_REFRESH_RATE;
 
 int             escape_html_tags=FALSE;
 
+int             persistent_ack_comments=FALSE;
+
 int             use_ssl_authentication=FALSE;
 
 int             default_statusmap_layout_method=0;
@@ -429,6 +431,9 @@ int read_cgi_config_file(char *filename){
 		else if(!strcmp(var,"escape_html_tags"))
 			escape_html_tags=(atoi(val)>0)?TRUE:FALSE;
 
+		else if(!strcmp(var,"persistent_ack_comments"))
+			persistent_ack_comments=(atoi(val)>0)?TRUE:FALSE;
+
 		else if(!strcmp(var,"lock_author_names"))
 			lock_author_names=(atoi(val)>0)?TRUE:FALSE;
 
diff --git a/cgi/cmd.c b/cgi/cmd.c
index f8cde83..8324f3c 100644
--- a/cgi/cmd.c
+++ b/cgi/cmd.c
@@ -50,6 +50,8 @@ extern int  use_authentication;
 
 extern int  lock_author_names;
 
+extern int  persistent_ack_comments;
+
 extern scheduled_downtime *scheduled_downtime_list;
 extern comment *comment_list;
 
@@ -960,7 +962,11 @@ void request_command_data(int cmd){
 			printf("</b></td></tr>\n");
 		        }
 		printf("<tr><td CLASS='optBoxItem'>Persistent%s:</td><td><b>",(cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM)?" Comment":"");
-		printf("<INPUT TYPE='checkbox' NAME='persistent' %s>",(cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM)?"":"CHECKED");
+		if ( (persistent_ack_comments==TRUE) || (cmd==CMD_ADD_HOST_COMMENT) ) {
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s>","CHECKED");
+		} else {
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s>","");
+		}
 		printf("</b></td></tr>\n");
 		printf("<tr><td CLASS='optBoxRequiredItem'>Author (Your Name):</td><td><b>");
 		printf("<INPUT TYPE='TEXT' NAME='com_author' VALUE='%s' %s>",escape_string(comment_author),(lock_author_names==TRUE)?"READONLY DISABLED":"");
@@ -986,7 +992,11 @@ void request_command_data(int cmd){
 			printf("</b></td></tr>\n");
 		        }
 		printf("<tr><td CLASS='optBoxItem'>Persistent%s:</td><td><b>",(cmd==CMD_ACKNOWLEDGE_SVC_PROBLEM)?" Comment":"");
-		printf("<INPUT TYPE='checkbox' NAME='persistent' %s",(cmd==CMD_ACKNOWLEDGE_SVC_PROBLEM)?"":"CHECKED");
+		if ( (persistent_ack_comments==TRUE) || (cmd==CMD_ADD_SVC_COMMENT) ){
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s","CHECKED");
+		} else {
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s","");
+		}
 		printf("</b></td></tr>\n");
 		printf("<tr><td CLASS='optBoxRequiredItem'>Author (Your Name):</td><td><b>");
 		printf("<INPUT TYPE='TEXT' NAME='com_author' VALUE='%s' %s>",escape_string(comment_author),(lock_author_names==TRUE)?"READONLY DISABLED":"");
diff --git a/sample-config/cgi.cfg.in b/sample-config/cgi.cfg.in
index 200cdd0..56dd672 100644
--- a/sample-config/cgi.cfg.in
+++ b/sample-config/cgi.cfg.in
@@ -57,9 +57,9 @@ use_pending_states=1
 
 
 # AUTHENTICATION USAGE
-# This option controls whether or not the CGIs will use any 
+# This option controls whether or not the CGIs will use any
 # authentication when displaying host and service information, as
-# well as committing commands to Icinga for processing.  
+# well as committing commands to Icinga for processing.
 #
 # Read the HTML documentation to learn how the authorization works!
 #
@@ -101,7 +101,7 @@ use_ssl_authentication=0
 # access to the CGIs has been authenticated in some manner!  If you
 # define this variable, anyone who has not authenticated to the web
 # server will inherit all rights you assign to this user!
- 
+
 #default_user_name=guest
 
 
@@ -160,9 +160,9 @@ authorized_for_all_hosts=icingaadmin
 # GLOBAL HOST/SERVICE COMMAND ACCESS
 # These two options are comma-delimited lists of all usernames that
 # can issue host or service related commands via the command
-# CGI (cmd.cgi) for all hosts and services that are being monitored. 
-# By default, users can only issue commands for hosts or services 
-# that they are contacts for (unless you you choose to not use 
+# CGI (cmd.cgi) for all hosts and services that are being monitored.
+# By default, users can only issue commands for hosts or services
+# that they are contacts for (unless you you choose to not use
 # authorization).  You may use an asterisk (*) to authorize any
 # user who has authenticated to the web server.
 
@@ -181,9 +181,9 @@ authorized_for_all_host_commands=icingaadmin
 
 
 # SHOW ALL SERVICES THE HOST IS AUTHORIZED FOR
-# By default, a user can see all services on a host, if the user is 
-# authorized as contact for the host only. By disabling this option, 
-# the user must be an authorized contact for the service too in order 
+# By default, a user can see all services on a host, if the user is
+# authorized as contact for the host only. By disabling this option,
+# the user must be an authorized contact for the service too in order
 # to view it.
 # Values: 0 - disabled, user must be authorized for services too
 #         1 - enabled, user can view all services on authorized host
@@ -192,7 +192,7 @@ show_all_services_host_is_authorized_for=1
 
 
 # STATUSMAP BACKGROUND IMAGE
-# This option allows you to specify an image to be used as a 
+# 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/icinga/share/images).
 # This path is automatically determined by appending "/images"
@@ -210,7 +210,7 @@ show_all_services_host_is_authorized_for=1
 # 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).  
+# a background color instead (to make it look pretty).
 # Defaults to white: (R,G,B) = (255,255,255).
 
 #color_transparency_index_r=255
@@ -251,7 +251,7 @@ default_statuswrl_layout=4
 
 
 # STATUSWRL INCLUDE
-# This option allows you to include your own objects in the 
+# 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/icinga/share).
 
@@ -277,7 +277,7 @@ 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).  
+# of various CGIs (status, statusmap, extinfo, and outages).
 
 refresh_rate=90
 
@@ -292,6 +292,14 @@ escape_html_tags=1
 
 
 
+# PERSISTENT ACKNOWLEDGEMENT COMMENTS
+# This options determines whether the initial state of the
+# checkbox "Persistent Comment:" for service and host problem
+# acknowledgements is checked or unchecked
+
+persistent_ack_comments=0
+
+
 
 # SOUND OPTIONS
 # These options allow you to specify an optional audio file
@@ -320,7 +328,7 @@ escape_html_tags=1
 
 
 # URL TARGET FRAMES
-# These options determine the target frames in which notes and 
+# These options determine the target frames in which notes and
 # action URLs will open.
 
 action_url_target=_blank
@@ -330,8 +338,8 @@ 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 
+# 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 Icinga.
 # Values: 0 = allow editing author names
 #         1 = lock author names (disallow editing)





More information about the icinga-checkins mailing list