/*****************************************************************************
*
* DOWNTIME.C - Scheduled downtime functions for Nagios
*
* Copyright (c) 2000-2007 Ethan Galstad (nagios@nagios.org)
* Last Modified: 03-05-2007
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/comments.h"
#include "../include/downtime.h"
#include "../include/objects.h"
#include "../include/statusdata.h"
/***** IMPLEMENTATION-SPECIFIC INCLUDES *****/
#ifdef USE_XDDDEFAULT
#include "../xdata/xdddefault.h"
#endif
#ifdef NSCORE
#include "../include/nagios.h"
#include "../include/broker.h"
#endif
#ifdef NSCGI
#include "../include/cgiutils.h"
#endif
scheduled_downtime *scheduled_downtime_list=NULL;
#ifdef NSCORE
extern timed_event *event_list_high;
#endif
#ifdef NSCORE
/******************************************************************/
/**************** INITIALIZATION/CLEANUP FUNCTIONS ****************/
/******************************************************************/
/* initializes scheduled downtime data */
int initialize_downtime_data(char *config_file){
int result;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XDDDEFAULT
result=xdddefault_initialize_downtime_data(config_file);
#endif
return result;
}
/* cleans up scheduled downtime data */
int cleanup_downtime_data(char *config_file){
int result;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XDDDEFAULT
result=xdddefault_cleanup_downtime_data(config_file);
#endif
/* free memory allocated to downtime data */
free_downtime_data();
return result;
}
/******************************************************************/
/********************** SCHEDULING FUNCTIONS **********************/
/******************************************************************/
/* schedules a host or service downtime */
int schedule_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 *new_downtime_id){
unsigned long downtime_id;
/* don't add old or invalid downtimes */
=1= |