Icinga-core 1.4.0
next gen monitoring
include/downtime.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * DOWNTIME.H - Header file for scheduled downtime functions
00004  *
00005  * Copyright (c) 2001-2009 Ethan Galstad (egalstad@nagios.org)
00006  * Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
00007  * Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
00008  *
00009  * License:
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License version 2 as
00013  * published by the Free Software Foundation.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023  *
00024  *****************************************************************************/
00025 
00026 
00027 #ifndef _DOWNTIME_H
00028 #define _DOWNTIME_H
00029 
00030 #include "config.h"
00031 #include "common.h"
00032 #include "objects.h"
00033 
00034 #ifdef __cplusplus
00035   extern "C" {
00036 #endif
00037 
00038 /* SCHEDULED_DOWNTIME_ENTRY structure */
00039 typedef struct scheduled_downtime_struct{
00040         int type;
00041         char *host_name;
00042         char *service_description;
00043         time_t entry_time;
00044         time_t start_time;
00045         time_t end_time;
00046         int fixed;
00047         unsigned long triggered_by;
00048         unsigned long duration;
00049         unsigned long downtime_id;
00050         char *author;
00051         char *comment;
00052         int is_in_effect;
00053 #ifdef NSCORE
00054         unsigned long comment_id;
00055         int start_flex_downtime;
00056         int incremented_pending_downtime;
00057 #endif
00058         struct scheduled_downtime_struct *next;
00059         }scheduled_downtime;
00060 
00061 
00062 
00063 #ifdef NSCORE
00064 int initialize_downtime_data(char *);                                /* initializes scheduled downtime data */
00065 int cleanup_downtime_data(char *);                                   /* cleans up scheduled downtime data */
00066 
00067 int add_new_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *,int);
00068 int add_new_host_downtime(char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *,int);
00069 int add_new_service_downtime(char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *,int);
00070 
00071 int delete_host_downtime(unsigned long);
00072 int delete_service_downtime(unsigned long);
00073 int delete_downtime(int,unsigned long);
00074 
00075 int schedule_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *);
00076 int unschedule_downtime(int,unsigned long);
00077 
00078 int register_downtime(int,unsigned long);
00079 int handle_scheduled_downtime(scheduled_downtime *);
00080 int handle_scheduled_downtime_by_id(unsigned long);
00081 
00082 int check_pending_flex_host_downtime(host *);
00083 int check_pending_flex_service_downtime(service *);
00084 
00085 int check_for_expired_downtime(void);
00086 #endif
00087 
00088 int add_host_downtime(char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,int);
00089 int add_service_downtime(char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,int);
00090 
00091 /* If you are going to be adding a lot of downtime in sequence, set
00092    defer_downtime_sorting to 1 before you start and then call
00093    sort_downtime afterwards. Things will go MUCH faster. */
00094 
00095 extern int defer_downtime_sorting;
00096 int add_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,int);
00097 int sort_downtime(void);
00098 
00099 scheduled_downtime *find_downtime(int,unsigned long);
00100 scheduled_downtime *find_host_downtime(unsigned long);
00101 scheduled_downtime *find_service_downtime(unsigned long);
00102 scheduled_downtime *find_downtime_by_similar_content(int,char *,char *,char *,char *,time_t,time_t,int,unsigned long);
00103 
00104 void free_downtime_data(void);                                       /* frees memory allocated to scheduled downtime list */
00105 
00106 int delete_downtime_by_hostname_service_description_start_time_comment(char *,char *,time_t,char *);
00107 
00108 #ifdef __cplusplus
00109   }
00110 #endif
00111 
00112 #endif
 All Data Structures Files Functions Variables Typedefs Defines