PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|C|nagios-2.9|common|downtime.c =

page 7 of 11




#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=

1|2|3|4|5|6| < PREV = PAGE 7 = NEXT > |8|9|10|11

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.00805092 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)