diff --git a/Changelog b/Changelog index f45cf4414..52e946392 100644 --- a/Changelog +++ b/Changelog @@ -10,6 +10,7 @@ ENHANCEMENTS * classic ui: Added option to suppress coloring of hosts/services in maintenance (Matthew Brooks) #992 * classic ui: Added option to show partial hostgroups (Matthew Brooks) #1013 * classic ui: changing drop down menu in status.cgi to jquery-dd #1644 +* classic ui: default downtime duration is configurable in cgi.cfg #1642 FIXES * core: remove duplicated unlinks for check result files with multiple results #1615 diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c index c7d46f0d5..e9ad28ef0 100644 --- a/cgi/cgiutils.c +++ b/cgi/cgiutils.c @@ -143,6 +143,7 @@ int enforce_comments_on_actions=FALSE; int week_starts_on_monday=FALSE; int show_partial_hostgroups=FALSE; +int default_downtime_duration=7200; extern hostgroup *hostgroup_list; extern contactgroup *contactgroup_list; @@ -553,6 +554,9 @@ int read_cgi_config_file(char *filename){ else if(!strcmp(var,"lock_author_names")) lock_author_names=(atoi(val)>0)?TRUE:FALSE; + else if(!strcmp(var,"default_downtime_duration")) + default_downtime_duration=atoi(val); + else if(!strcmp(var,"use_ssl_authentication")) use_ssl_authentication=(atoi(val)>0)?TRUE:FALSE; diff --git a/cgi/cmd.c b/cgi/cmd.c index bd4d98178..81d545375 100644 --- a/cgi/cmd.c +++ b/cgi/cmd.c @@ -61,6 +61,7 @@ extern int daemon_check; extern int enforce_comments_on_actions; extern int date_format; extern int use_logging; +extern int default_downtime_duration; extern scheduled_downtime *scheduled_downtime_list; extern comment *comment_list; @@ -823,6 +824,7 @@ void print_help_box(char *content) { void print_form_element(int element,int cmd) { time_t t; + int t_hour,t_min; char buffer[MAX_INPUT_BUFFER]; switch(element) { @@ -930,7 +932,7 @@ void print_form_element(int element,int cmd) { case PRINT_CHECK_TIME: time(&t); if (element == PRINT_END_TIME ) - t+=(unsigned long)7200; + t+=(unsigned long)default_downtime_duration; get_time_string(&t,buffer,sizeof(buffer)-1,SHORT_DATE_TIME); printf(""); if (element == PRINT_START_TIME ){ @@ -948,6 +950,10 @@ void print_form_element(int element,int cmd) { break; case PRINT_FIXED_FLEXIBLE_TYPE: + default_downtime_duration = default_downtime_duration / 60; + t_min = default_downtime_duration % 60; + default_downtime_duration = default_downtime_duration - t_min; + t_hour = (default_downtime_duration / 60 ) ; snprintf(help_text,sizeof(help_text),"If you select the fixed option, the downtime will be in effect between the start and end times you specify. If you do not select the fixed " "option, %s will treat this as flexible downtime. Flexible downtime starts when the host goes down or becomes unreachable / service becomes critical (sometime between the " @@ -971,9 +977,9 @@ void print_form_element(int element,int cmd) { printf("\n"); printf("\t\n"); printf("\t\t\n"); - printf("\t\t\t\n"); + printf("\t\t\t\n",t_hour); printf("\t\t\t\n"); - printf("\t\t\t\n"); + printf("\t\t\t\n",t_min); printf("\t\t\t\n"); printf("\t\t\n"); printf("\t
 Hours Minutes
\n"); diff --git a/sample-config/cgi.cfg.in b/sample-config/cgi.cfg.in index 973182411..0fdce28d8 100644 --- a/sample-config/cgi.cfg.in +++ b/sample-config/cgi.cfg.in @@ -434,6 +434,13 @@ lock_author_names=1 +# DEFAULT DOWNTIME DURATION +# This option defines the default duration (in seconds) of fixed and +# flexible downtimes. Default is 7200 seconds (2 hours). +#default_donwtime_duration=7200 + + + # SHOW LONG PLUGIN OUTPUT IN STATUS OPTION # This option allows you to specify the length of status information # in output of status.cgi. If you set the value to 1 it shows the