Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
default downtime duration is configurable in cgi.cfg #1642
Browse files Browse the repository at this point in the history
refs: #1642
  • Loading branch information
bb-Ricardo committed Jun 14, 2011
1 parent ed57201 commit 57e6579
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changelog
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cgi/cgiutils.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
12 changes: 9 additions & 3 deletions cgi/cmd.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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("<tr><td class=\"objectDescription descriptionleft\">");
if (element == PRINT_START_TIME ){
Expand All @@ -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 <i>fixed</i> option, the downtime will be in effect between the start and end times you specify. If you do not select the <i>fixed</i> "
"option, %s will treat this as <i>flexible</i> downtime. Flexible downtime starts when the host goes down or becomes unreachable / service becomes critical (sometime between the "
Expand All @@ -971,9 +977,9 @@ void print_form_element(int element,int cmd) {
printf("</td><td align=\"left\">\n");
printf("\t<table border=0 cellspacing=0 cellpadding=0>\n");
printf("\t\t<tr>\n");
printf("\t\t\t<td><INPUT TYPE='TEXT' NAME='hours' VALUE='2' SIZE=2 MAXLENGTH=2></td>\n");
printf("\t\t\t<td><INPUT TYPE='TEXT' NAME='hours' VALUE='%d' SIZE=2 MAXLENGTH=2></td>\n",t_hour);
printf("\t\t\t<td width=\"50\">&nbsp;Hours</td>\n");
printf("\t\t\t<td><INPUT TYPE='TEXT' NAME='minutes' VALUE='0' SIZE=2 MAXLENGTH=2></td>\n");
printf("\t\t\t<td><INPUT TYPE='TEXT' NAME='minutes' VALUE='%d' SIZE=2 MAXLENGTH=2></td>\n",t_min);
printf("\t\t\t<td width=\"50\">&nbsp;Minutes</td>\n");
printf("\t\t</tr>\n");
printf("\t</table>\n");
Expand Down
7 changes: 7 additions & 0 deletions sample-config/cgi.cfg.in
Expand Up @@ -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
Expand Down

0 comments on commit 57e6579

Please sign in to comment.