#ifdef DEBUG0
printf("check_pending_flex_service_downtime() end\n");
#endif
return OK;
}
/* checks for (and removes) expired downtime entries */
int check_for_expired_downtime(void){
scheduled_downtime *temp_downtime;
scheduled_downtime *next_downtime;
time_t current_time;
#ifdef DEBUG0
printf("check_for_expired_downtime() start\n");
#endif
time(¤t_time);
/* check all downtime entries... */
for(temp_downtime=scheduled_downtime_list;temp_downtime!=NULL;temp_downtime=next_downtime){
next_downtime=temp_downtime->next;
/* this entry should be removed */
if(temp_downtime->is_in_effect==FALSE && temp_downtime->end_time<current_time){
/* delete the downtime entry */
if(temp_downtime->type==HOST_DOWNTIME)
delete_host_downtime(temp_downtime->downtime_id);
else
delete_service_downtime(temp_downtime->downtime_id);
}
}
#ifdef DEBUG0
printf("check_for_expired_downtime() end\n");
#endif
return OK;
}
/******************************************************************/
/************************* SAVE FUNCTIONS *************************/
/******************************************************************/
/* save a host or service downtime */
int add_new_downtime(int type, char *host_name, char *service_description, time_t entry_time, char *author, char
*comment_data, time_t start_time, time_t end_time, int fixed, unsigned long triggered_by, unsigned long duration, unsigned
long *downtime_id){
int result;
if(type==HOST_DOWNTIME)
result=add_new_host_downtime(host_name,entry_time,author,comment_data,start_time,end_time,fixed,triggered_by,duration,downtime_id);
else
result=add_new_service_downtime(host_name,service_description,entry_time,author,comment_data,start_time,end_time,fixed,triggered_by,duration,downtime_id);
return result;
}
/* saves a host downtime entry */
int add_new_host_downtime(char *host_name, time_t entry_time, char *author, char *comment_data, time_t start_time, time_t
end_time, int fixed, unsigned long triggered_by, unsigned long duration, unsigned long *downtime_id){
int result;
unsigned long new_downtime_id;
if(host_name==NULL)
return ERROR;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XDDDEFAULT
result=xdddefault_add_new_host_downtime(host_name,entry_time,author,comment_data,start_time,end_time,fixed,triggered_by,duration,&new_downtime_id);
#endif
/* save downtime id */
if(downtime_id!=NULL)
*downtime_id=new_downtime_id;
#ifdef USE_EVENT_BROKER
/* send data to event broker */
broker_downtime_data(NEBTYPE_DOWNTIME_ADD,NEBFLAG_NONE,NEBATTR_NONE,HOST_DOWNTIME,host_name,NULL,entry_time,author,comment_data,start_time,end_time,fixed,triggered_by,duration,new_downtime_id,NULL);
#endif
return result;
}
/* saves a service downtime entry */
int add_new_service_downtime(char *host_name, char *service_description, time_t entry_time, char *author, char *comment_data,
time_t start_time, time_t end_time, int fixed, unsigned long triggered_by, unsigned long duration, unsigned long
*downtime_id){
int result;
unsigned long new_downtime_id;
if(host_name==NULL || service_description==NULL)
return ERROR;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XDDDEFAULT
=7= |