1 /*****************************************************************************
3 * BROKER.H - Event broker includes for Nagios
5 * Copyright (c) 2002-2006 Ethan Galstad (nagios@nagios.org)
6 * Last Modified: 12-12-2006
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *****************************************************************************/
35 /*************** EVENT BROKER OPTIONS *****************/
37 #define BROKER_NOTHING 0
38 #define BROKER_EVERYTHING 1048575
40 #define BROKER_PROGRAM_STATE 1 /* DONE */
41 #define BROKER_TIMED_EVENTS 2 /* DONE */
42 #define BROKER_SERVICE_CHECKS 4 /* DONE */
43 #define BROKER_HOST_CHECKS 8 /* DONE */
44 #define BROKER_EVENT_HANDLERS 16 /* DONE */
45 #define BROKER_LOGGED_DATA 32 /* DONE */
46 #define BROKER_NOTIFICATIONS 64 /* DONE */
47 #define BROKER_FLAPPING_DATA 128 /* DONE */
48 #define BROKER_COMMENT_DATA 256 /* DONE */
49 #define BROKER_DOWNTIME_DATA 512 /* DONE */
50 #define BROKER_SYSTEM_COMMANDS 1024 /* DONE */
51 #define BROKER_OCP_DATA 2048 /* DONE */
52 #define BROKER_STATUS_DATA 4096 /* DONE */
53 #define BROKER_ADAPTIVE_DATA 8192 /* DONE */
54 #define BROKER_EXTERNALCOMMAND_DATA 16384 /* DONE */
55 #define BROKER_RETENTION_DATA 32768 /* DONE */
56 #define BROKER_ACKNOWLEDGEMENT_DATA 65536
57 #define BROKER_STATECHANGE_DATA 131072
58 #define BROKER_RESERVED18 262144
59 #define BROKER_RESERVED19 524288
62 /****** EVENT TYPES ************************/
64 #define NEBTYPE_NONE 0
66 #define NEBTYPE_HELLO 1
67 #define NEBTYPE_GOODBYE 2
68 #define NEBTYPE_INFO 3
70 #define NEBTYPE_PROCESS_START 100
71 #define NEBTYPE_PROCESS_DAEMONIZE 101
72 #define NEBTYPE_PROCESS_RESTART 102
73 #define NEBTYPE_PROCESS_SHUTDOWN 103
74 #define NEBTYPE_PROCESS_PRELAUNCH 104 /* before objects are read or verified */
75 #define NEBTYPE_PROCESS_EVENTLOOPSTART 105
76 #define NEBTYPE_PROCESS_EVENTLOOPEND 106
78 #define NEBTYPE_TIMEDEVENT_ADD 200
79 #define NEBTYPE_TIMEDEVENT_REMOVE 201
80 #define NEBTYPE_TIMEDEVENT_EXECUTE 202
81 #define NEBTYPE_TIMEDEVENT_DELAY 203 /* NOT IMPLEMENTED */
82 #define NEBTYPE_TIMEDEVENT_SKIP 204 /* NOT IMPLEMENTED */
83 #define NEBTYPE_TIMEDEVENT_SLEEP 205
85 #define NEBTYPE_LOG_DATA 300
86 #define NEBTYPE_LOG_ROTATION 301
88 #define NEBTYPE_SYSTEM_COMMAND_START 400
89 #define NEBTYPE_SYSTEM_COMMAND_END 401
91 #define NEBTYPE_EVENTHANDLER_START 500
92 #define NEBTYPE_EVENTHANDLER_END 501
94 #define NEBTYPE_NOTIFICATION_START 600
95 #define NEBTYPE_NOTIFICATION_END 601
96 #define NEBTYPE_CONTACTNOTIFICATION_START 602
97 #define NEBTYPE_CONTACTNOTIFICATION_END 603
98 #define NEBTYPE_CONTACTNOTIFICATIONMETHOD_START 604
99 #define NEBTYPE_CONTACTNOTIFICATIONMETHOD_END 605
101 #define NEBTYPE_SERVICECHECK_INITIATE 700
102 #define NEBTYPE_SERVICECHECK_PROCESSED 701
103 #define NEBTYPE_SERVICECHECK_RAW_START 702 /* NOT IMPLEMENTED */
104 #define NEBTYPE_SERVICECHECK_RAW_END 703 /* NOT IMPLEMENTED */
105 #define NEBTYPE_SERVICECHECK_ASYNC_PRECHECK 704
107 #define NEBTYPE_HOSTCHECK_INITIATE 800 /* a check of the route to the host has been initiated */
108 #define NEBTYPE_HOSTCHECK_PROCESSED 801 /* the processed/final result of a host check */
109 #define NEBTYPE_HOSTCHECK_RAW_START 802 /* the start of a "raw" host check */
110 #define NEBTYPE_HOSTCHECK_RAW_END 803 /* a finished "raw" host check */
111 #define NEBTYPE_HOSTCHECK_ASYNC_PRECHECK 804
112 #define NEBTYPE_HOSTCHECK_SYNC_PRECHECK 805
114 #define NEBTYPE_COMMENT_ADD 900
115 #define NEBTYPE_COMMENT_DELETE 901
116 #define NEBTYPE_COMMENT_LOAD 902
118 #define NEBTYPE_FLAPPING_START 1000
119 #define NEBTYPE_FLAPPING_STOP 1001
121 #define NEBTYPE_DOWNTIME_ADD 1100
122 #define NEBTYPE_DOWNTIME_DELETE 1101
123 #define NEBTYPE_DOWNTIME_LOAD 1102
124 #define NEBTYPE_DOWNTIME_START 1103
125 #define NEBTYPE_DOWNTIME_STOP 1104
127 #define NEBTYPE_PROGRAMSTATUS_UPDATE 1200
128 #define NEBTYPE_HOSTSTATUS_UPDATE 1201
129 #define NEBTYPE_SERVICESTATUS_UPDATE 1202
130 #define NEBTYPE_CONTACTSTATUS_UPDATE 1203
132 #define NEBTYPE_ADAPTIVEPROGRAM_UPDATE 1300
133 #define NEBTYPE_ADAPTIVEHOST_UPDATE 1301
134 #define NEBTYPE_ADAPTIVESERVICE_UPDATE 1302
135 #define NEBTYPE_ADAPTIVECONTACT_UPDATE 1303
137 #define NEBTYPE_EXTERNALCOMMAND_START 1400
138 #define NEBTYPE_EXTERNALCOMMAND_END 1401
140 #define NEBTYPE_AGGREGATEDSTATUS_STARTDUMP 1500
141 #define NEBTYPE_AGGREGATEDSTATUS_ENDDUMP 1501
143 #define NEBTYPE_RETENTIONDATA_STARTLOAD 1600
144 #define NEBTYPE_RETENTIONDATA_ENDLOAD 1601
145 #define NEBTYPE_RETENTIONDATA_STARTSAVE 1602
146 #define NEBTYPE_RETENTIONDATA_ENDSAVE 1603
148 #define NEBTYPE_ACKNOWLEDGEMENT_ADD 1700
149 #define NEBTYPE_ACKNOWLEDGEMENT_REMOVE 1701 /* NOT IMPLEMENTED */
150 #define NEBTYPE_ACKNOWLEDGEMENT_LOAD 1702 /* NOT IMPLEMENTED */
152 #define NEBTYPE_STATECHANGE_START 1800 /* NOT IMPLEMENTED */
153 #define NEBTYPE_STATECHANGE_END 1801
157 /****** EVENT FLAGS ************************/
159 #define NEBFLAG_NONE 0
160 #define NEBFLAG_PROCESS_INITIATED 1 /* event was initiated by Nagios process */
161 #define NEBFLAG_USER_INITIATED 2 /* event was initiated by a user request */
162 #define NEBFLAG_MODULE_INITIATED 3 /* event was initiated by an event broker module */
167 /****** EVENT ATTRIBUTES *******************/
169 #define NEBATTR_NONE 0
171 #define NEBATTR_SHUTDOWN_NORMAL 1
172 #define NEBATTR_SHUTDOWN_ABNORMAL 2
173 #define NEBATTR_RESTART_NORMAL 4
174 #define NEBATTR_RESTART_ABNORMAL 8
176 #define NEBATTR_FLAPPING_STOP_NORMAL 1
177 #define NEBATTR_FLAPPING_STOP_DISABLED 2 /* flapping stopped because flap detection was disabled */
179 #define NEBATTR_DOWNTIME_STOP_NORMAL 1
180 #define NEBATTR_DOWNTIME_STOP_CANCELLED 2
184 /****** EVENT BROKER FUNCTIONS *************/
186 #ifdef USE_EVENT_BROKER
187 struct timeval
get_broker_timestamp(struct timeval
*);
188 void broker_program_state(int,int,int,struct timeval
*);
189 void broker_timed_event(int,int,int,timed_event
*,struct timeval
*);
190 void broker_log_data(int,int,int,char *,unsigned long,time_t,struct timeval
*);
191 void broker_event_handler(int,int,int,int,void *,int,int,struct timeval
,struct timeval
,double,int,int,int,char *,char *,char *,struct timeval
*);
192 void broker_ocp_data(int,int,int,void *,int,int,double,int,int,struct timeval
*);
193 void broker_system_command(int,int,int,struct timeval
,struct timeval
,double,int,int,int,char *,char *,struct timeval
*);
194 int broker_host_check(int,int,int,host
*,int,int,int,struct timeval
,struct timeval
,char *,double,double,int,int,int,char *,char *,char *,char *,struct timeval
*);
195 int broker_service_check(int,int,int,service
*,int,struct timeval
,struct timeval
,char *,double,double,int,int,int,char *,struct timeval
*);
196 void broker_comment_data(int,int,int,int,int,char *,char *,time_t,char *,char *,int,int,int,time_t,unsigned long,struct timeval
*);
197 void broker_downtime_data(int,int,int,int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,struct timeval
*);
198 void broker_flapping_data(int,int,int,int,void *,double,double,double,struct timeval
*);
199 void broker_program_status(int,int,int,struct timeval
*);
200 void broker_host_status(int,int,int,host
*,struct timeval
*);
201 void broker_service_status(int,int,int,service
*,struct timeval
*);
202 void broker_contact_status(int,int,int,contact
*,struct timeval
*);
203 void broker_notification_data(int,int,int,int,int,struct timeval
,struct timeval
,void *,char *,char *,int,int,struct timeval
*);
204 void broker_contact_notification_data(int,int,int,int,int,struct timeval
,struct timeval
,void *,contact
*,char *,char *,int,struct timeval
*);
205 void broker_contact_notification_method_data(int,int,int,int,int,struct timeval
,struct timeval
,void *,contact
*,char *,char *,char *,int,struct timeval
*);
206 void broker_adaptive_program_data(int,int,int,int,unsigned long,unsigned long,unsigned long,unsigned long,struct timeval
*);
207 void broker_adaptive_host_data(int,int,int,host
*,int,unsigned long,unsigned long,struct timeval
*);
208 void broker_adaptive_service_data(int,int,int,service
*,int,unsigned long,unsigned long,struct timeval
*);
209 void broker_adaptive_contact_data(int,int,int,contact
*,int,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long, struct timeval
*);
210 void broker_external_command(int,int,int,int,time_t,char *,char *,struct timeval
*);
211 void broker_aggregated_status_data(int,int,int,struct timeval
*);
212 void broker_retention_data(int,int,int,struct timeval
*);
213 void broker_acknowledgement_data(int,int,int,int,void *,char *,char *,int,int,int,struct timeval
*);
214 void broker_statechange_data(int,int,int,int,void *,int,int,int,int,struct timeval
*);