db_updater: Put parentheses back
[merlin.git] / ocimp.h
blobd31629615f06e1f9daecf121856f63cdc19910aa
1 #ifndef ocimp_h__
2 #define ocimp_h__
4 #define CFG_IGNORE (-1)
5 #define CFG_acknowledgement_type CFG_IGNORE
6 #define CFG_active_checks_enabled 2
7 #define CFG_active_host_checks_enabled 3
8 #define CFG_active_ondemand_host_check_stats 4
9 #define CFG_active_ondemand_service_check_stats 5
10 #define CFG_active_scheduled_host_check_stats 6
11 #define CFG_active_scheduled_service_check_stats 7
12 #define CFG_active_service_checks_enabled 8
13 #define CFG_author 9
14 #define CFG_cached_host_check_stats 10
15 #define CFG_cached_service_check_stats 11
16 #define CFG_check_command 12
17 #define CFG_check_execution_time 13
18 #define CFG_check_host_freshness 14
19 #define CFG_check_interval 15
20 #define CFG_check_latency 16
21 #define CFG_check_options CFG_IGNORE
22 #define CFG_check_period 18
23 #define CFG_check_service_freshness 19
24 #define CFG_check_type 20
25 #define CFG_comment 21
26 #define CFG_comment_data 22
27 #define CFG_comment_id 23
28 #define CFG_contact_name 24
29 #define CFG_created 25
30 #define CFG_current_attempt 26
31 #define CFG_current_event_id 27
32 #define CFG_current_notification_id 28
33 #define CFG_current_notification_number 29
34 #define CFG_current_problem_id 30
35 #define CFG_current_state 31
36 #define CFG_daemon_mode 32
37 #define CFG_downtime_id 33
38 #define CFG_duration 34
39 #define CFG_enable_event_handlers 35
40 #define CFG_enable_failure_prediction CFG_IGNORE
41 #define CFG_enable_flap_detection 37
42 #define CFG_enable_notifications 38
43 #define CFG_end_time 39
44 #define CFG_entry_time 40
45 #define CFG_entry_type 41
46 #define CFG_event_handler 42
47 #define CFG_event_handler_enabled 43
48 #define CFG_expires 44
49 #define CFG_expire_time 45
50 #define CFG_external_command_stats 46
51 #define CFG_failure_prediction_enabled CFG_IGNORE
52 #define CFG_fixed 48
53 #define CFG_flap_detection_enabled 49
54 #define CFG_global_host_event_handler 50
55 #define CFG_global_service_event_handler 51
56 #define CFG_has_been_checked 52
57 #define CFG_high_external_command_buffer_slots 53
58 #define CFG_host_name 54
59 #define CFG_host_notification_period 55
60 #define CFG_host_notifications_enabled 56
61 #define CFG_is_flapping 57
62 #define CFG_last_check 58
63 #define CFG_last_command_check 59
64 #define CFG_last_event_id 60
65 #define CFG_last_hard_state 61
66 #define CFG_last_hard_state_change 62
67 #define CFG_last_host_notification 63
68 #define CFG_last_log_rotation 64
69 #define CFG_last_notification 65
70 #define CFG_last_problem_id 66
71 #define CFG_last_service_notification 67
72 #define CFG_last_state 68
73 #define CFG_last_state_change 69
74 #define CFG_last_time_critical CFG_IGNORE
75 #define CFG_last_time_down CFG_IGNORE
76 #define CFG_last_time_ok CFG_IGNORE
77 #define CFG_last_time_unknown CFG_IGNORE
78 #define CFG_last_time_unreachable CFG_IGNORE
79 #define CFG_last_time_up CFG_IGNORE
80 #define CFG_last_time_warning CFG_IGNORE
81 #define CFG_last_update 77
82 #define CFG_last_update_check 78
83 #define CFG_last_version 79
84 #define CFG_long_plugin_output 80
85 #define CFG_max_attempts 81
86 #define CFG_modified_attributes CFG_IGNORE
87 #define CFG_modified_host_attributes 83
88 #define CFG_modified_service_attributes 84
89 #define CFG_nagios_pid 85
90 #define CFG_new_version 87
91 #define CFG_next_check 87
92 #define CFG_next_comment_id 89
93 #define CFG_next_downtime_id 90
94 #define CFG_next_event_id 91
95 #define CFG_next_notification 92
96 #define CFG_next_notification_id 93
97 #define CFG_next_problem_id 94
98 #define CFG_no_more_notifications CFG_IGNORE
99 #define CFG_notification_period 96
100 #define CFG_notifications_enabled 97
101 #define CFG_obsess 98
102 #define CFG_obsess_over_hosts 99
103 #define CFG_hourly_value 100
104 #define CFG_obsess_over_services 101
105 #define CFG_parallel_host_check_stats 102
106 #define CFG_passive_checks_enabled 103
107 #define CFG_passive_host_checks_enabled 104
108 #define CFG_passive_host_check_stats 105
109 #define CFG_passive_service_checks_enabled 106
110 #define CFG_passive_service_check_stats 107
111 #define CFG_percent_state_change 108
112 #define CFG_performance_data 109
113 #define CFG_persistent 110
114 #define CFG_plugin_output 111
115 #define CFG_problem_has_been_acknowledged 112
116 #define CFG_process_performance_data 113
117 #define CFG_program_start 114
118 #define CFG_retry_interval 115
119 #define CFG_scheduled_downtime_depth 116
120 #define CFG_serial_host_check_stats 117
121 #define CFG_service_description 118
122 #define CFG_service_notification_period 119
123 #define CFG_service_notifications_enabled 120
124 #define CFG_should_be_scheduled 121
125 #define CFG_source 122
126 #define CFG_start_time 123
127 #define CFG_state_type 124
128 #define CFG_total_external_command_buffer_slots 125
129 #define CFG_triggered_by 126
130 #define CFG_update_available 127
131 #define CFG_used_external_command_buffer_slots 128
132 #define CFG_version 129
133 /* below are found only in objects.cache */
134 #define CFG_action_url 200
135 #define CFG_address 201
136 #define CFG_alias 202
137 #define CFG_check_freshness 203
138 #define CFG_contact_groups 204
139 #define CFG_contacts 205
140 #define CFG_display_name 206
141 #define CFG_first_notification_delay 207
142 #define CFG_flap_detection_options 208
143 #define CFG_freshness_threshold 209
144 #define CFG_high_flap_threshold 210
145 #define CFG_icon_image 211
146 #define CFG_initial_state 212
147 #define CFG_is_volatile 213
148 #define CFG_low_flap_threshold 214
149 #define CFG_max_check_attempts CFG_max_attempts
150 #define CFG_notes 216
151 #define CFG_notes_url 217
152 #define CFG_notification_interval 218
153 #define CFG_notification_options 219
154 #define CFG_parallelize_check 220
155 #define CFG_parents 221
156 #define CFG_process_perf_data 222
157 #define CFG_retain_nonstatus_information 223
158 #define CFG_retain_status_information 224
159 #define CFG_stalking_options 225
160 #define CFG_statusmap_image CFG_IGNORE
161 #define CFG_icon_image_alt 227
163 /* for contacts. We should probably optimize this somewhat */
164 #define CFG_host_notification_options 228
165 #define CFG_service_notification_commands 229
166 #define CFG_host_notification_commands 230
167 #define CFG_email 231
168 #define CFG_pager 232
169 #define CFG_can_submit_commands 233
170 #define CFG_address1 234
171 #define CFG_address2 235
172 #define CFG_address3 236
173 #define CFG_address4 237
174 #define CFG_address5 238
175 #define CFG_address6 239
176 #define CFG_service_notification_options 240
177 #define CFG_minimum_value 241
181 * this matches merlin_service_status exactly up until the additional
182 * variables. This means we can reuse this struct as if it was a
183 * merlin_service_status (or merlin_host_status) struct so long as we
184 * only pass it as a pointer.
186 struct id_object {
187 char *host_name;
188 char *service_description;
189 int id, instance_id;
191 typedef struct id_object id_object;
193 /* we reuse these for timeperiods */
194 struct ocimp_group_object {
195 char *name;
196 int id;
197 union {
198 char *exclude;
199 char *members;
201 strvec *strv;
203 typedef struct ocimp_group_object ocimp_group_object;
204 typedef struct ocimp_group_object ocimp_timeperiod_object;
206 struct ocimp_contact_object {
207 char *name;
208 int id;
209 int login_enabled;
211 typedef struct ocimp_contact_object ocimp_contact_object;
213 struct state_object
215 monitored_object_state state;
216 id_object ido;
218 char *notification_period;
219 char *check_period;
220 char *check_command;
221 int check_interval;
222 int retry_interval;
223 char *event_handler;
224 int last_update;
225 int max_attempts;
227 char *action_url;
228 char *address;
229 char *alias;
230 char *display_name;
231 char *stalking_options;
232 char *flap_detection_options;
233 char *icon_image;
234 char *icon_image_alt;
235 char *notes;
236 char *notes_url;
237 char *notification_options;
238 int first_notification_delay;
239 double freshness_threshold;
240 double high_flap_threshold;
241 double low_flap_threshold;
242 int initial_state;
243 int is_volatile;
244 int notification_interval;
245 int parallelize_check;
246 int process_perf_data;
247 int retain_nonstatus_information;
248 int retain_status_information;
249 char *parents;
250 char *contact_groups;
251 char *contacts;
253 slist *contact_slist;
255 typedef struct state_object state_object;
257 struct comment_object
259 int entry_type;
260 int comment_id;
261 int source;
262 int persistent;
263 int entry_time;
264 int expires;
265 int expire_time;
267 typedef struct comment_object comment_object;
269 typedef struct cfg_code {
270 long len;
271 const char *key;
272 long code;
273 } cfg_code;
275 #define get_cfg_code(v, codes) real_get_cfg_code(v, codes, ARRAY_SIZE(codes))
277 #define OCIMP_CFG_ENTRY(config_key) \
278 sizeof(#config_key) - 1, #config_key, CFG_##config_key
279 static cfg_code slog_options[] = {
280 { OCIMP_CFG_ENTRY(acknowledgement_type) },
281 { OCIMP_CFG_ENTRY(active_checks_enabled) },
282 { OCIMP_CFG_ENTRY(active_host_checks_enabled) },
283 { OCIMP_CFG_ENTRY(active_ondemand_host_check_stats) },
284 { OCIMP_CFG_ENTRY(active_ondemand_service_check_stats) },
285 { OCIMP_CFG_ENTRY(active_scheduled_host_check_stats) },
286 { OCIMP_CFG_ENTRY(active_scheduled_service_check_stats) },
287 { OCIMP_CFG_ENTRY(active_service_checks_enabled) },
288 { OCIMP_CFG_ENTRY(address1) },
289 { OCIMP_CFG_ENTRY(address2) },
290 { OCIMP_CFG_ENTRY(address3) },
291 { OCIMP_CFG_ENTRY(address4) },
292 { OCIMP_CFG_ENTRY(address5) },
293 { OCIMP_CFG_ENTRY(address6) },
294 { OCIMP_CFG_ENTRY(author) },
295 { OCIMP_CFG_ENTRY(cached_host_check_stats) },
296 { OCIMP_CFG_ENTRY(cached_service_check_stats) },
297 { OCIMP_CFG_ENTRY(check_command) },
298 { OCIMP_CFG_ENTRY(check_execution_time) },
299 { OCIMP_CFG_ENTRY(check_host_freshness) },
300 { OCIMP_CFG_ENTRY(check_interval) },
301 { OCIMP_CFG_ENTRY(check_latency) },
302 { OCIMP_CFG_ENTRY(check_options) },
303 { OCIMP_CFG_ENTRY(check_period) },
304 { OCIMP_CFG_ENTRY(check_service_freshness) },
305 { OCIMP_CFG_ENTRY(check_type) },
306 { OCIMP_CFG_ENTRY(comment) },
307 { OCIMP_CFG_ENTRY(comment_data) },
308 { OCIMP_CFG_ENTRY(comment_id) },
309 { OCIMP_CFG_ENTRY(contact_name) },
310 { OCIMP_CFG_ENTRY(created) },
311 { OCIMP_CFG_ENTRY(current_attempt) },
312 { OCIMP_CFG_ENTRY(current_event_id) },
313 { OCIMP_CFG_ENTRY(current_notification_id) },
314 { OCIMP_CFG_ENTRY(current_notification_number) },
315 { OCIMP_CFG_ENTRY(current_problem_id) },
316 { OCIMP_CFG_ENTRY(current_state) },
317 { OCIMP_CFG_ENTRY(daemon_mode) },
318 { OCIMP_CFG_ENTRY(downtime_id) },
319 { OCIMP_CFG_ENTRY(duration) },
320 { OCIMP_CFG_ENTRY(enable_event_handlers) },
321 { OCIMP_CFG_ENTRY(enable_failure_prediction) },
322 { OCIMP_CFG_ENTRY(enable_flap_detection) },
323 { OCIMP_CFG_ENTRY(enable_notifications) },
324 { OCIMP_CFG_ENTRY(end_time) },
325 { OCIMP_CFG_ENTRY(entry_time) },
326 { OCIMP_CFG_ENTRY(entry_type) },
327 { OCIMP_CFG_ENTRY(event_handler) },
328 { OCIMP_CFG_ENTRY(event_handler_enabled) },
329 { OCIMP_CFG_ENTRY(expires) },
330 { OCIMP_CFG_ENTRY(expire_time) },
331 { OCIMP_CFG_ENTRY(external_command_stats) },
332 { OCIMP_CFG_ENTRY(failure_prediction_enabled) },
333 { OCIMP_CFG_ENTRY(fixed) },
334 { OCIMP_CFG_ENTRY(flap_detection_enabled) },
335 { OCIMP_CFG_ENTRY(global_host_event_handler) },
336 { OCIMP_CFG_ENTRY(global_service_event_handler) },
337 { OCIMP_CFG_ENTRY(has_been_checked) },
338 { OCIMP_CFG_ENTRY(high_external_command_buffer_slots) },
339 { OCIMP_CFG_ENTRY(host_name) },
340 { OCIMP_CFG_ENTRY(host_notification_period) },
341 { OCIMP_CFG_ENTRY(host_notifications_enabled) },
342 { OCIMP_CFG_ENTRY(hourly_value) },
343 { OCIMP_CFG_ENTRY(is_flapping) },
344 { OCIMP_CFG_ENTRY(last_check) },
345 { OCIMP_CFG_ENTRY(last_command_check) },
346 { OCIMP_CFG_ENTRY(last_event_id) },
347 { OCIMP_CFG_ENTRY(last_hard_state) },
348 { OCIMP_CFG_ENTRY(last_hard_state_change) },
349 { OCIMP_CFG_ENTRY(last_host_notification) },
350 { OCIMP_CFG_ENTRY(last_log_rotation) },
351 { OCIMP_CFG_ENTRY(last_notification) },
352 { OCIMP_CFG_ENTRY(last_problem_id) },
353 { OCIMP_CFG_ENTRY(last_service_notification) },
354 { OCIMP_CFG_ENTRY(last_state_change) },
355 { OCIMP_CFG_ENTRY(last_time_critical) },
356 { OCIMP_CFG_ENTRY(last_time_down) },
357 { OCIMP_CFG_ENTRY(last_time_ok) },
358 { OCIMP_CFG_ENTRY(last_time_unknown) },
359 { OCIMP_CFG_ENTRY(last_time_unreachable) },
360 { OCIMP_CFG_ENTRY(last_time_up) },
361 { OCIMP_CFG_ENTRY(last_time_warning) },
362 { OCIMP_CFG_ENTRY(last_update) },
363 { OCIMP_CFG_ENTRY(last_update_check) },
364 { OCIMP_CFG_ENTRY(last_version) },
365 { OCIMP_CFG_ENTRY(long_plugin_output) },
366 { OCIMP_CFG_ENTRY(max_attempts) },
367 { OCIMP_CFG_ENTRY(minimum_value) },
368 { OCIMP_CFG_ENTRY(modified_attributes) },
369 { OCIMP_CFG_ENTRY(modified_host_attributes) },
370 { OCIMP_CFG_ENTRY(modified_service_attributes) },
371 { OCIMP_CFG_ENTRY(nagios_pid) },
372 { OCIMP_CFG_ENTRY(new_version) },
373 { OCIMP_CFG_ENTRY(next_check) },
374 { OCIMP_CFG_ENTRY(next_comment_id) },
375 { OCIMP_CFG_ENTRY(next_downtime_id) },
376 { OCIMP_CFG_ENTRY(next_event_id) },
377 { OCIMP_CFG_ENTRY(next_notification) },
378 { OCIMP_CFG_ENTRY(next_notification_id) },
379 { OCIMP_CFG_ENTRY(next_problem_id) },
380 { OCIMP_CFG_ENTRY(no_more_notifications) },
381 { OCIMP_CFG_ENTRY(notification_period) },
382 { OCIMP_CFG_ENTRY(notifications_enabled) },
383 { OCIMP_CFG_ENTRY(obsess) },
384 { OCIMP_CFG_ENTRY(obsess_over_hosts) },
385 { OCIMP_CFG_ENTRY(obsess_over_services) },
386 { OCIMP_CFG_ENTRY(parallel_host_check_stats) },
387 { OCIMP_CFG_ENTRY(passive_checks_enabled) },
388 { OCIMP_CFG_ENTRY(passive_host_checks_enabled) },
389 { OCIMP_CFG_ENTRY(passive_host_check_stats) },
390 { OCIMP_CFG_ENTRY(passive_service_checks_enabled) },
391 { OCIMP_CFG_ENTRY(passive_service_check_stats) },
392 { OCIMP_CFG_ENTRY(percent_state_change) },
393 { OCIMP_CFG_ENTRY(performance_data) },
394 { OCIMP_CFG_ENTRY(persistent) },
395 { OCIMP_CFG_ENTRY(plugin_output) },
396 { OCIMP_CFG_ENTRY(problem_has_been_acknowledged) },
397 { OCIMP_CFG_ENTRY(process_performance_data) },
398 { OCIMP_CFG_ENTRY(program_start) },
399 { OCIMP_CFG_ENTRY(retry_interval) },
400 { OCIMP_CFG_ENTRY(scheduled_downtime_depth) },
401 { OCIMP_CFG_ENTRY(serial_host_check_stats) },
402 { OCIMP_CFG_ENTRY(service_description) },
403 { OCIMP_CFG_ENTRY(service_notification_period) },
404 { OCIMP_CFG_ENTRY(service_notifications_enabled) },
405 { OCIMP_CFG_ENTRY(should_be_scheduled) },
406 { OCIMP_CFG_ENTRY(source) },
407 { OCIMP_CFG_ENTRY(start_time) },
408 { OCIMP_CFG_ENTRY(state_type) },
409 { OCIMP_CFG_ENTRY(total_external_command_buffer_slots) },
410 { OCIMP_CFG_ENTRY(triggered_by) },
411 { OCIMP_CFG_ENTRY(update_available) },
412 { OCIMP_CFG_ENTRY(used_external_command_buffer_slots) },
413 { OCIMP_CFG_ENTRY(version) },
414 { OCIMP_CFG_ENTRY(action_url) },
415 { OCIMP_CFG_ENTRY(address) },
416 { OCIMP_CFG_ENTRY(alias) },
417 { OCIMP_CFG_ENTRY(check_freshness) },
418 { OCIMP_CFG_ENTRY(contact_groups) },
419 { OCIMP_CFG_ENTRY(contacts) },
420 { OCIMP_CFG_ENTRY(display_name) },
421 { OCIMP_CFG_ENTRY(first_notification_delay) },
422 { OCIMP_CFG_ENTRY(flap_detection_options) },
423 { OCIMP_CFG_ENTRY(freshness_threshold) },
424 { OCIMP_CFG_ENTRY(high_flap_threshold) },
425 { OCIMP_CFG_ENTRY(icon_image) },
426 { OCIMP_CFG_ENTRY(icon_image_alt) },
427 { OCIMP_CFG_ENTRY(initial_state) },
428 { OCIMP_CFG_ENTRY(is_volatile) },
429 { OCIMP_CFG_ENTRY(low_flap_threshold) },
430 { OCIMP_CFG_ENTRY(max_check_attempts) },
431 { OCIMP_CFG_ENTRY(notes) },
432 { OCIMP_CFG_ENTRY(notes_url) },
433 { OCIMP_CFG_ENTRY(notification_interval) },
434 { OCIMP_CFG_ENTRY(notification_options) },
435 { OCIMP_CFG_ENTRY(parallelize_check) },
436 { OCIMP_CFG_ENTRY(parents) },
437 { OCIMP_CFG_ENTRY(process_perf_data) },
438 { OCIMP_CFG_ENTRY(retain_nonstatus_information) },
439 { OCIMP_CFG_ENTRY(retain_status_information) },
440 { OCIMP_CFG_ENTRY(stalking_options) },
441 { OCIMP_CFG_ENTRY(statusmap_image) },
442 { OCIMP_CFG_ENTRY(service_notification_options) },
443 { OCIMP_CFG_ENTRY(host_notification_options) },
444 { OCIMP_CFG_ENTRY(service_notification_commands) },
445 { OCIMP_CFG_ENTRY(host_notification_commands) },
446 { OCIMP_CFG_ENTRY(email) },
447 { OCIMP_CFG_ENTRY(pager) },
448 { OCIMP_CFG_ENTRY(can_submit_commands) },
452 * This basic query is used for both hosts and services
454 #define INSERT_QUERY(type, vals, valsf) \
455 "INSERT INTO " type " (" vals ",\n" \
456 "id, instance_id,\n" \
457 "host_name, display_name, stalking_options,\n" /* 5 */ \
458 "flap_detection_options, icon_image, notes,\n" \
459 "notes_url, notification_options,\n" /* 10 */ \
460 "initial_state, flap_detection_enabled,\n" \
461 "low_flap_threshold, high_flap_threshold,\n" \
462 "check_freshness, freshness_threshold,\n" \
463 "process_performance_data,\n" \
464 "active_checks_enabled, passive_checks_enabled,\n" \
465 "event_handler_enabled,\n" /* 20 */ \
466 "obsess_over_" type ", problem_has_been_acknowledged,\n" \
467 "acknowledgement_type, check_type,\n" \
468 "current_state, last_state,\n" \
469 "last_hard_state, state_type,\n" \
470 "current_attempt, current_event_id,\n" /* 30 */ \
471 "last_event_id, current_problem_id,\n" \
472 "last_problem_id,\n" \
473 "latency, execution_time,\n" \
474 "notifications_enabled,\n" \
475 "last_notification,\n" \
476 "next_check, should_be_scheduled, last_check,\n" /* 40 */ \
477 "last_state_change, last_hard_state_change,\n" \
478 "has_been_checked,\n" \
479 "current_notification_number, current_notification_id,\n" /* 45 */ \
480 "check_flapping_recovery_notifi,\n" \
481 "scheduled_downtime_depth, pending_flex_downtime,\n" \
482 "is_flapping, flapping_comment_id,\n" /* 50 */ \
483 "max_attempts, max_check_attempts,\n" \
484 "percent_state_change, output, long_output,\n" /* 55 */ \
485 "perf_data, action_url, icon_image_alt,\n" \
486 "check_command, check_period,\n" /* 60 */ \
487 "notification_period, retry_interval,\n" \
488 "check_interval, first_notification_delay,\n" \
489 "notification_interval,\n" \
490 "retain_nonstatus_information, retain_status_information\n" /* 67 */ \
491 ") VALUES(" valsf ",\n" \
492 "%d, %d,\n" \
493 "%s, %s, %s,\n" /* 5 */ \
494 "%s, %s, %s,\n" \
495 "%s, %s,\n" /* 10 */ \
496 "%d, %d,\n" \
497 "%f, %f,\n" \
498 "%d, %d,\n" /* 16 */ \
499 "%d,\n" \
500 "%d, %d,\n" \
501 "%d,\n" /* 20 */ \
502 "%d, %d,\n" \
503 "%d, %d,\n" \
504 "%d, %d,\n" /* 26 */ \
505 "%d, %d,\n" \
506 "%d, %lu,\n" /* 30 */ \
507 "%lu, %lu,\n" \
508 "%lu,\n" \
509 "%f, %lf,\n" /* 35 */ \
510 "%d,\n" \
511 "%lu,\n" \
512 "%lu, %d, %lu,\n" /* 40 */ \
513 "%lu, %lu,\n" \
514 "%d,\n" \
515 "%d, %lu,\n" \
516 "%d,\n" \
517 "%d, %d,\n" \
518 "%d, %lu,\n" /* 50 */ \
519 "%d, %d,\n" \
520 "%f, %s, %s,\n" \
521 "%s, %s, %s,\n" \
522 "%s, %s,\n" /* 60 */ \
523 "%s, %d,\n" \
524 "%d, %d,\n" \
525 "%d,\n" /* 65 */ \
526 "%d, %d\n" /* 67 */ \
529 #define NINJA_PENDING 6 /* marks object as pending in ninja */
530 #define real_current_state(p) \
531 (p->state.has_been_checked ? p->state.current_state : NINJA_PENDING)
533 #define INSERT_VALUES() \
534 p->ido.id, p->ido.instance_id, \
535 host_name, safe_str(display_name), safe_str(stalking_options), \
536 safe_str(flap_detection_options), safe_str(icon_image), safe_str(notes), \
537 safe_str(notes_url), safe_str(notification_options), \
538 p->state.initial_state, p->state.flap_detection_enabled, \
539 p->state.low_flap_threshold, p->state.high_flap_threshold, \
540 p->state.check_freshness, p->state.freshness_threshold, \
541 p->state.process_performance_data, \
542 p->state.checks_enabled, p->state.accept_passive_checks, \
543 p->state.event_handler_enabled, \
544 p->state.obsess, p->state.problem_has_been_acknowledged, \
545 p->state.acknowledgement_type, p->state.check_type, \
546 real_current_state(p), p->state.last_state, \
547 p->state.last_hard_state, p->state.state_type, \
548 p->state.current_attempt, p->state.current_event_id, \
549 p->state.last_event_id, p->state.current_problem_id, \
550 p->state.last_problem_id, \
551 p->state.latency, p->state.execution_time, \
552 p->state.notifications_enabled, \
553 p->state.last_notification, \
554 p->state.next_check, p->state.should_be_scheduled, p->state.last_check, \
555 p->state.last_state_change, p->state.last_hard_state_change, \
556 p->state.has_been_checked, \
557 p->state.current_notification_number, p->state.current_notification_id, \
558 p->state.check_flapping_recovery_notification, \
559 p->state.scheduled_downtime_depth, p->state.pending_flex_downtime, \
560 p->state.is_flapping, p->state.flapping_comment_id, \
561 p->max_attempts, p->max_attempts, \
562 p->state.percent_state_change, safe_str(output), safe_str(long_output), \
563 safe_str(perf_data), safe_str(action_url), safe_str(icon_image_alt), \
564 safe_str(check_command), safe_str(check_period), \
565 safe_str(notification_period), p->retry_interval, \
566 p->check_interval, p->first_notification_delay, \
567 p->notification_interval, \
568 p->retain_nonstatus_information, p->retain_status_information
570 #endif