![]() |
Icinga-core 1.4.0
next gen monitoring
|
00001 /***************************************************************************** 00002 * 00003 * STATUSDATA.H - Header for external status data routines 00004 * 00005 * Copyright (c) 1999-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 #ifndef _STATUSDATA_H 00027 #define _STATUSDATA_H 00028 00029 #ifdef NSCORE 00030 #include "objects.h" 00031 #endif 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 #ifdef NSCGI 00038 00039 #define READ_PROGRAM_STATUS 1 00040 #define READ_HOST_STATUS 2 00041 #define READ_SERVICE_STATUS 4 00042 #define READ_CONTACT_STATUS 8 00043 00044 #define READ_ALL_STATUS_DATA READ_PROGRAM_STATUS | READ_HOST_STATUS | READ_SERVICE_STATUS | READ_CONTACT_STATUS 00045 00046 00047 00048 /*************************** CHAINED HASH LIMITS ***************************/ 00049 00050 #define SERVICESTATUS_HASHSLOTS 1024 00051 #define HOSTSTATUS_HASHSLOTS 1024 00052 00053 00054 /**************************** DATA STRUCTURES ******************************/ 00055 00056 00057 /* HOST STATUS structure */ 00058 typedef struct hoststatus_struct{ 00059 char *host_name; 00060 char *plugin_output; 00061 char *long_plugin_output; 00062 char *perf_data; 00063 int status; 00064 time_t last_update; 00065 int has_been_checked; 00066 int should_be_scheduled; 00067 int current_attempt; 00068 int max_attempts; 00069 time_t last_check; 00070 time_t next_check; 00071 int check_options; 00072 int check_type; 00073 time_t last_state_change; 00074 time_t last_hard_state_change; 00075 int last_hard_state; 00076 time_t last_time_up; 00077 time_t last_time_down; 00078 time_t last_time_unreachable; 00079 int state_type; 00080 time_t last_notification; 00081 time_t next_notification; 00082 int no_more_notifications; 00083 int notifications_enabled; 00084 int problem_has_been_acknowledged; 00085 int acknowledgement_type; 00086 int current_notification_number; 00087 #ifdef USE_ST_BASED_ESCAL_RANGES 00088 int current_down_notification_number; 00089 int current_unreachable_notification_number; 00090 #endif 00091 int accept_passive_host_checks; 00092 int event_handler_enabled; 00093 int checks_enabled; 00094 int flap_detection_enabled; 00095 int is_flapping; 00096 double percent_state_change; 00097 double latency; 00098 double execution_time; 00099 int scheduled_downtime_depth; 00100 int failure_prediction_enabled; 00101 int process_performance_data; 00102 int obsess_over_host; 00103 struct hoststatus_struct *next; 00104 struct hoststatus_struct *nexthash; 00105 }hoststatus; 00106 00107 00108 /* SERVICE STATUS structure */ 00109 typedef struct servicestatus_struct{ 00110 char *host_name; 00111 char *description; 00112 char *plugin_output; 00113 char *long_plugin_output; 00114 char *perf_data; 00115 int max_attempts; 00116 int current_attempt; 00117 int status; 00118 time_t last_update; 00119 int has_been_checked; 00120 int should_be_scheduled; 00121 time_t last_check; 00122 time_t next_check; 00123 int check_options; 00124 int check_type; 00125 int checks_enabled; 00126 time_t last_state_change; 00127 time_t last_hard_state_change; 00128 int last_hard_state; 00129 time_t last_time_ok; 00130 time_t last_time_warning; 00131 time_t last_time_unknown; 00132 time_t last_time_critical; 00133 int state_type; 00134 time_t last_notification; 00135 time_t next_notification; 00136 int no_more_notifications; 00137 int notifications_enabled; 00138 int problem_has_been_acknowledged; 00139 int acknowledgement_type; 00140 int current_notification_number; 00141 #ifdef USE_ST_BASED_ESCAL_RANGES 00142 int current_warning_notification_number; 00143 int current_critical_notification_number; 00144 int current_unknown_notification_number; 00145 #endif 00146 int accept_passive_service_checks; 00147 int event_handler_enabled; 00148 int flap_detection_enabled; 00149 int is_flapping; 00150 double percent_state_change; 00151 double latency; 00152 double execution_time; 00153 int scheduled_downtime_depth; 00154 int failure_prediction_enabled; 00155 int process_performance_data; 00156 int obsess_over_service; 00157 struct servicestatus_struct *next; 00158 struct servicestatus_struct *nexthash; 00159 }servicestatus; 00160 00161 00162 /*************************** SERVICE STATES ***************************/ 00163 00164 #define SERVICE_PENDING 1 00165 #define SERVICE_OK 2 00166 #define SERVICE_WARNING 4 00167 #define SERVICE_UNKNOWN 8 00168 #define SERVICE_CRITICAL 16 00169 00170 00171 00172 /**************************** HOST STATES ****************************/ 00173 00174 #define HOST_PENDING 1 00175 #define HOST_UP 2 00176 #define HOST_DOWN 4 00177 #define HOST_UNREACHABLE 8 00178 00179 00180 00181 /**************************** FUNCTIONS ******************************/ 00182 00183 int read_status_data(char *,int); /* reads all status data */ 00184 int add_host_status(hoststatus *); /* adds a host status entry to the list in memory */ 00185 int add_service_status(servicestatus *); /* adds a service status entry to the list in memory */ 00186 00187 int add_hoststatus_to_hashlist(hoststatus *); 00188 int add_servicestatus_to_hashlist(servicestatus *); 00189 00190 servicestatus *find_servicestatus(char *,char *); /* finds status information for a specific service */ 00191 hoststatus *find_hoststatus(char *); /* finds status information for a specific host */ 00192 int get_servicestatus_count(char *,int); /* gets total number of services of a certain type for a specific host */ 00193 00194 void free_status_data(void); /* free all memory allocated to status data */ 00195 #endif 00196 00197 #ifdef NSCORE 00198 int initialize_status_data(char *); /* initializes status data at program start */ 00199 int update_all_status_data(void); /* updates all status data */ 00200 int cleanup_status_data(char *,int); /* cleans up status data at program termination */ 00201 int update_program_status(int); /* updates program status data */ 00202 int update_host_status(host *,int); /* updates host status data */ 00203 int update_service_status(service *,int); /* updates service status data */ 00204 int update_contact_status(contact *,int); /* updates contact status data */ 00205 #endif 00206 00207 #ifdef __cplusplus 00208 } 00209 #endif 00210 00211 #endif