Debian Codegraph @

lib/db_ido_mysql/schema/mysql.sql

raw
1 -- --------------------------------------------------------
2 -- mysql.sql
3 -- DB definition for IDO MySQL
4 --
5 -- SPDX-FileCopyrightText: 2012 Icinga GmbH <https://icinga.com>
6 -- SPDX-License-Identifier: GPL-2.0-or-later
7 --
8 -- -- --------------------------------------------------------
9
10 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
11 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
12 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
13 /*!40101 SET NAMES utf8 */;
14
15 --
16 -- Database: icinga
17 --
18
19 -- --------------------------------------------------------
20
21 --
22 -- Table structure for table icinga_acknowledgements
23 --
24
25 CREATE TABLE IF NOT EXISTS icinga_acknowledgements (
26 acknowledgement_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
27 instance_id bigint unsigned default 0,
28 entry_time timestamp NULL,
29 entry_time_usec int default 0,
30 acknowledgement_type smallint default 0,
31 object_id bigint unsigned default 0,
32 state smallint default 0,
33 author_name varchar(64) character set latin1 default '',
34 comment_data TEXT character set latin1,
35 is_sticky smallint default 0,
36 persistent_comment smallint default 0,
37 notify_contacts smallint default 0,
38 end_time timestamp NULL,
39 PRIMARY KEY (acknowledgement_id)
40 ) ENGINE=InnoDB COMMENT='Current and historical host and service acknowledgements';
41
42 -- --------------------------------------------------------
43
44 --
45 -- Table structure for table icinga_commands
46 --
47
48 CREATE TABLE IF NOT EXISTS icinga_commands (
49 command_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
50 instance_id bigint unsigned default 0,
51 config_type smallint default 0,
52 object_id bigint unsigned default 0,
53 command_line TEXT character set latin1,
54 config_hash varchar(64) DEFAULT NULL,
55 PRIMARY KEY (command_id),
56 UNIQUE KEY instance_id (instance_id,object_id,config_type)
57 ) ENGINE=InnoDB COMMENT='Command definitions';
58
59 -- --------------------------------------------------------
60
61 --
62 -- Table structure for table icinga_commenthistory
63 --
64
65 CREATE TABLE IF NOT EXISTS icinga_commenthistory (
66 commenthistory_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
67 instance_id bigint unsigned default 0,
68 entry_time timestamp NULL,
69 entry_time_usec int default 0,
70 comment_type smallint default 0,
71 entry_type smallint default 0,
72 object_id bigint unsigned default 0,
73 comment_time timestamp NULL,
74 internal_comment_id bigint unsigned default 0,
75 author_name varchar(64) character set latin1 default '',
76 comment_data TEXT character set latin1,
77 is_persistent smallint default 0,
78 comment_source smallint default 0,
79 expires smallint default 0,
80 expiration_time timestamp NULL,
81 deletion_time timestamp NULL,
82 deletion_time_usec int default 0,
83 name TEXT character set latin1 default NULL,
84 PRIMARY KEY (commenthistory_id)
85 ) ENGINE=InnoDB COMMENT='Historical host and service comments';
86
87 -- --------------------------------------------------------
88
89 --
90 -- Table structure for table icinga_comments
91 --
92
93 CREATE TABLE IF NOT EXISTS icinga_comments (
94 comment_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
95 instance_id bigint unsigned default 0,
96 entry_time timestamp NULL,
97 entry_time_usec int default 0,
98 comment_type smallint default 0,
99 entry_type smallint default 0,
100 object_id bigint unsigned default 0,
101 comment_time timestamp NULL,
102 internal_comment_id bigint unsigned default 0,
103 author_name varchar(64) character set latin1 default '',
104 comment_data TEXT character set latin1,
105 is_persistent smallint default 0,
106 comment_source smallint default 0,
107 expires smallint default 0,
108 expiration_time timestamp NULL,
109 name TEXT character set latin1 default NULL,
110 session_token int default NULL,
111 PRIMARY KEY (comment_id)
112 ) ENGINE=InnoDB COMMENT='Usercomments on Icinga objects';
113
114 -- --------------------------------------------------------
115
116 --
117 -- Table structure for table icinga_configfiles
118 --
119
120 CREATE TABLE IF NOT EXISTS icinga_configfiles (
121 configfile_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
122 instance_id bigint unsigned default 0,
123 configfile_type smallint default 0,
124 configfile_path varchar(255) character set latin1 default '',
125 PRIMARY KEY (configfile_id),
126 UNIQUE KEY instance_id (instance_id,configfile_type,configfile_path)
127 ) ENGINE=InnoDB COMMENT='Configuration files';
128
129 -- --------------------------------------------------------
130
131 --
132 -- Table structure for table icinga_configfilevariables
133 --
134
135 CREATE TABLE IF NOT EXISTS icinga_configfilevariables (
136 configfilevariable_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
137 instance_id bigint unsigned default 0,
138 configfile_id bigint unsigned default 0,
139 varname varchar(64) character set latin1 default '',
140 varvalue TEXT character set latin1,
141 PRIMARY KEY (configfilevariable_id)
142 ) ENGINE=InnoDB COMMENT='Configuration file variables';
143
144 -- --------------------------------------------------------
145
146 --
147 -- Table structure for table icinga_conninfo
148 --
149
150 CREATE TABLE IF NOT EXISTS icinga_conninfo (
151 conninfo_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
152 instance_id bigint unsigned default 0,
153 agent_name varchar(32) character set latin1 default '',
154 agent_version varchar(32) character set latin1 default '',
155 disposition varchar(32) character set latin1 default '',
156 connect_source varchar(32) character set latin1 default '',
157 connect_type varchar(32) character set latin1 default '',
158 connect_time timestamp NULL,
159 disconnect_time timestamp NULL,
160 last_checkin_time timestamp NULL,
161 data_start_time timestamp NULL,
162 data_end_time timestamp NULL,
163 bytes_processed bigint unsigned default '0',
164 lines_processed bigint unsigned default '0',
165 entries_processed bigint unsigned default '0',
166 PRIMARY KEY (conninfo_id)
167 ) ENGINE=InnoDB COMMENT='IDO2DB daemon connection information';
168
169 -- --------------------------------------------------------
170
171 --
172 -- Table structure for table icinga_contactgroups
173 --
174
175 CREATE TABLE IF NOT EXISTS icinga_contactgroups (
176 contactgroup_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
177 instance_id bigint unsigned default 0,
178 config_type smallint default 0,
179 contactgroup_object_id bigint unsigned default 0,
180 alias varchar(255) character set latin1 default '',
181 config_hash varchar(64) DEFAULT NULL,
182 PRIMARY KEY (contactgroup_id),
183 UNIQUE KEY instance_id (instance_id,config_type,contactgroup_object_id)
184 ) ENGINE=InnoDB COMMENT='Contactgroup definitions';
185
186 -- --------------------------------------------------------
187
188 --
189 -- Table structure for table icinga_contactgroup_members
190 --
191
192 CREATE TABLE IF NOT EXISTS icinga_contactgroup_members (
193 contactgroup_member_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
194 instance_id bigint unsigned default 0,
195 contactgroup_id bigint unsigned default 0,
196 contact_object_id bigint unsigned default 0,
197 PRIMARY KEY (contactgroup_member_id)
198 ) ENGINE=InnoDB COMMENT='Contactgroup members';
199
200 -- --------------------------------------------------------
201
202 --
203 -- Table structure for table icinga_contactnotificationmethods
204 --
205
206 CREATE TABLE IF NOT EXISTS icinga_contactnotificationmethods (
207 contactnotificationmethod_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
208 instance_id bigint unsigned default 0,
209 contactnotification_id bigint unsigned default 0,
210 start_time timestamp NULL,
211 start_time_usec int default 0,
212 end_time timestamp NULL,
213 end_time_usec int default 0,
214 command_object_id bigint unsigned default 0,
215 command_args TEXT character set latin1,
216 PRIMARY KEY (contactnotificationmethod_id),
217 UNIQUE KEY instance_id (instance_id,contactnotification_id,start_time,start_time_usec)
218 ) ENGINE=InnoDB COMMENT='Historical record of contact notification methods';
219
220 -- --------------------------------------------------------
221
222 --
223 -- Table structure for table icinga_contactnotifications
224 --
225
226 CREATE TABLE IF NOT EXISTS icinga_contactnotifications (
227 contactnotification_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
228 instance_id bigint unsigned default 0,
229 notification_id bigint unsigned default 0,
230 contact_object_id bigint unsigned default 0,
231 start_time timestamp NULL,
232 start_time_usec int default 0,
233 end_time timestamp NULL,
234 end_time_usec int default 0,
235 PRIMARY KEY (contactnotification_id),
236 UNIQUE KEY instance_id (instance_id,contact_object_id,start_time,start_time_usec)
237 ) ENGINE=InnoDB COMMENT='Historical record of contact notifications';
238
239 -- --------------------------------------------------------
240
241 --
242 -- Table structure for table icinga_contacts
243 --
244
245 CREATE TABLE IF NOT EXISTS icinga_contacts (
246 contact_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
247 instance_id bigint unsigned default 0,
248 config_type smallint default 0,
249 contact_object_id bigint unsigned default 0,
250 alias varchar(255) character set latin1 default '',
251 email_address varchar(255) character set latin1 default '',
252 pager_address varchar(64) character set latin1 default '',
253 host_timeperiod_object_id bigint unsigned default 0,
254 service_timeperiod_object_id bigint unsigned default 0,
255 host_notifications_enabled smallint default 0,
256 service_notifications_enabled smallint default 0,
257 can_submit_commands smallint default 0,
258 notify_service_recovery smallint default 0,
259 notify_service_warning smallint default 0,
260 notify_service_unknown smallint default 0,
261 notify_service_critical smallint default 0,
262 notify_service_flapping smallint default 0,
263 notify_service_downtime smallint default 0,
264 notify_host_recovery smallint default 0,
265 notify_host_down smallint default 0,
266 notify_host_unreachable smallint default 0,
267 notify_host_flapping smallint default 0,
268 notify_host_downtime smallint default 0,
269 config_hash varchar(64) DEFAULT NULL,
270 PRIMARY KEY (contact_id),
271 UNIQUE KEY instance_id (instance_id,config_type,contact_object_id)
272 ) ENGINE=InnoDB COMMENT='Contact definitions';
273
274 -- --------------------------------------------------------
275
276 --
277 -- Table structure for table icinga_contactstatus
278 --
279
280 CREATE TABLE IF NOT EXISTS icinga_contactstatus (
281 contactstatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
282 instance_id bigint unsigned default 0,
283 contact_object_id bigint unsigned default 0,
284 status_update_time timestamp NULL,
285 host_notifications_enabled smallint default 0,
286 service_notifications_enabled smallint default 0,
287 last_host_notification timestamp NULL,
288 last_service_notification timestamp NULL,
289 modified_attributes int default 0,
290 modified_host_attributes int default 0,
291 modified_service_attributes int default 0,
292 PRIMARY KEY (contactstatus_id),
293 UNIQUE KEY contact_object_id (contact_object_id)
294 ) ENGINE=InnoDB COMMENT='Contact status';
295
296 -- --------------------------------------------------------
297
298 --
299 -- Table structure for table icinga_contact_addresses
300 --
301
302 CREATE TABLE IF NOT EXISTS icinga_contact_addresses (
303 contact_address_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
304 instance_id bigint unsigned default 0,
305 contact_id bigint unsigned default 0,
306 address_number smallint default 0,
307 address varchar(255) character set latin1 default '',
308 PRIMARY KEY (contact_address_id),
309 UNIQUE KEY contact_id (contact_id,address_number)
310 ) ENGINE=InnoDB COMMENT='Contact addresses';
311
312 -- --------------------------------------------------------
313
314 --
315 -- Table structure for table icinga_contact_notificationcommands
316 --
317
318 CREATE TABLE IF NOT EXISTS icinga_contact_notificationcommands (
319 contact_notificationcommand_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
320 instance_id bigint unsigned default 0,
321 contact_id bigint unsigned default 0,
322 notification_type smallint default 0,
323 command_object_id bigint unsigned default 0,
324 command_args varchar(255) character set latin1 default '',
325 PRIMARY KEY (contact_notificationcommand_id),
326 UNIQUE KEY contact_id (contact_id,notification_type,command_object_id,command_args)
327 ) ENGINE=InnoDB COMMENT='Contact host and service notification commands';
328
329 -- --------------------------------------------------------
330
331 --
332 -- Table structure for table icinga_customvariables
333 --
334
335 CREATE TABLE IF NOT EXISTS icinga_customvariables (
336 customvariable_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
337 instance_id bigint unsigned default 0,
338 object_id bigint unsigned default 0,
339 config_type smallint default 0,
340 has_been_modified smallint default 0,
341 varname varchar(255) character set latin1 collate latin1_general_cs default NULL,
342 varvalue TEXT character set latin1,
343 is_json smallint default 0,
344 PRIMARY KEY (customvariable_id),
345 UNIQUE KEY object_id_2 (object_id,config_type,varname),
346 KEY varname (varname)
347 ) ENGINE=InnoDB COMMENT='Custom variables';
348
349 -- --------------------------------------------------------
350
351 --
352 -- Table structure for table icinga_customvariablestatus
353 --
354
355 CREATE TABLE IF NOT EXISTS icinga_customvariablestatus (
356 customvariablestatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
357 instance_id bigint unsigned default 0,
358 object_id bigint unsigned default 0,
359 status_update_time timestamp NULL,
360 has_been_modified smallint default 0,
361 varname varchar(255) character set latin1 collate latin1_general_cs default NULL,
362 varvalue TEXT character set latin1,
363 is_json smallint default 0,
364 PRIMARY KEY (customvariablestatus_id),
365 UNIQUE KEY object_id_2 (object_id,varname),
366 KEY varname (varname)
367 ) ENGINE=InnoDB COMMENT='Custom variable status information';
368
369 -- --------------------------------------------------------
370
371 --
372 -- Table structure for table icinga_dbversion
373 --
374
375 CREATE TABLE IF NOT EXISTS icinga_dbversion (
376 dbversion_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
377 name varchar(10) character set latin1 default '',
378 version varchar(10) character set latin1 default '',
379 create_time timestamp NULL,
380 modify_time timestamp NULL,
381 PRIMARY KEY (dbversion_id),
382 UNIQUE KEY dbversion (name)
383 ) ENGINE=InnoDB;
384
385 -- --------------------------------------------------------
386
387 --
388 -- Table structure for table icinga_downtimehistory
389 --
390
391 CREATE TABLE IF NOT EXISTS icinga_downtimehistory (
392 downtimehistory_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
393 instance_id bigint unsigned default 0,
394 downtime_type smallint default 0,
395 object_id bigint unsigned default 0,
396 entry_time timestamp NULL,
397 author_name varchar(64) character set latin1 default '',
398 comment_data TEXT character set latin1,
399 internal_downtime_id bigint unsigned default 0,
400 triggered_by_id bigint unsigned default 0,
401 is_fixed smallint default 0,
402 duration bigint(20) default 0,
403 scheduled_start_time timestamp NULL,
404 scheduled_end_time timestamp NULL,
405 was_started smallint default 0,
406 actual_start_time timestamp NULL,
407 actual_start_time_usec int default 0,
408 actual_end_time timestamp NULL,
409 actual_end_time_usec int default 0,
410 was_cancelled smallint default 0,
411 is_in_effect smallint default 0,
412 trigger_time timestamp NULL,
413 name TEXT character set latin1 default NULL,
414 PRIMARY KEY (downtimehistory_id)
415 ) ENGINE=InnoDB COMMENT='Historical scheduled host and service downtime';
416
417 -- --------------------------------------------------------
418
419 --
420 -- Table structure for table icinga_eventhandlers
421 --
422
423 CREATE TABLE IF NOT EXISTS icinga_eventhandlers (
424 eventhandler_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
425 instance_id bigint unsigned default 0,
426 eventhandler_type smallint default 0,
427 object_id bigint unsigned default 0,
428 state smallint default 0,
429 state_type smallint default 0,
430 start_time timestamp NULL,
431 start_time_usec int default 0,
432 end_time timestamp NULL,
433 end_time_usec int default 0,
434 command_object_id bigint unsigned default 0,
435 command_args TEXT character set latin1,
436 command_line TEXT character set latin1,
437 timeout smallint default 0,
438 early_timeout smallint default 0,
439 execution_time double default '0',
440 return_code smallint default 0,
441 output TEXT character set latin1,
442 long_output TEXT,
443 PRIMARY KEY (eventhandler_id),
444 UNIQUE KEY instance_id (instance_id,object_id,start_time,start_time_usec)
445 ) ENGINE=InnoDB COMMENT='Historical host and service event handlers';
446
447 -- --------------------------------------------------------
448
449 --
450 -- Table structure for table icinga_externalcommands
451 --
452
453 CREATE TABLE IF NOT EXISTS icinga_externalcommands (
454 externalcommand_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
455 instance_id bigint unsigned default 0,
456 entry_time timestamp NULL,
457 command_type smallint default 0,
458 command_name varchar(128) character set latin1 default '',
459 command_args TEXT character set latin1,
460 PRIMARY KEY (externalcommand_id)
461 ) ENGINE=InnoDB COMMENT='Historical record of processed external commands';
462
463 -- --------------------------------------------------------
464
465 --
466 -- Table structure for table icinga_flappinghistory
467 --
468
469 CREATE TABLE IF NOT EXISTS icinga_flappinghistory (
470 flappinghistory_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
471 instance_id bigint unsigned default 0,
472 event_time timestamp NULL,
473 event_time_usec int default 0,
474 event_type smallint default 0,
475 reason_type smallint default 0,
476 flapping_type smallint default 0,
477 object_id bigint unsigned default 0,
478 percent_state_change double default '0',
479 low_threshold double default '0',
480 high_threshold double default '0',
481 comment_time timestamp NULL,
482 internal_comment_id bigint unsigned default 0,
483 PRIMARY KEY (flappinghistory_id)
484 ) ENGINE=InnoDB COMMENT='Current and historical record of host and service flapping';
485
486 -- --------------------------------------------------------
487
488 --
489 -- Table structure for table icinga_hostchecks
490 --
491
492 CREATE TABLE IF NOT EXISTS icinga_hostchecks (
493 hostcheck_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
494 instance_id bigint unsigned default 0,
495 host_object_id bigint unsigned default 0,
496 check_type smallint default 0,
497 is_raw_check smallint default 0,
498 current_check_attempt smallint default 0,
499 max_check_attempts smallint default 0,
500 state smallint default 0,
501 state_type smallint default 0,
502 start_time timestamp NULL,
503 start_time_usec int default 0,
504 end_time timestamp NULL,
505 end_time_usec int default 0,
506 command_object_id bigint unsigned default 0,
507 command_args TEXT character set latin1,
508 command_line TEXT character set latin1,
509 timeout smallint default 0,
510 early_timeout smallint default 0,
511 execution_time double default '0',
512 latency double default '0',
513 return_code smallint default 0,
514 output TEXT character set latin1,
515 long_output TEXT,
516 perfdata TEXT character set latin1,
517 PRIMARY KEY (hostcheck_id)
518 ) ENGINE=InnoDB COMMENT='Historical host checks';
519
520 -- --------------------------------------------------------
521
522 --
523 -- Table structure for table icinga_hostdependencies
524 --
525
526 CREATE TABLE IF NOT EXISTS icinga_hostdependencies (
527 hostdependency_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
528 instance_id bigint unsigned default 0,
529 config_type smallint default 0,
530 host_object_id bigint unsigned default 0,
531 dependent_host_object_id bigint unsigned default 0,
532 dependency_type smallint default 0,
533 inherits_parent smallint default 0,
534 timeperiod_object_id bigint unsigned default 0,
535 fail_on_up smallint default 0,
536 fail_on_down smallint default 0,
537 fail_on_unreachable smallint default 0,
538 PRIMARY KEY (hostdependency_id),
539 KEY instance_id (instance_id,config_type,host_object_id,dependent_host_object_id,dependency_type,inherits_parent,fail_on_up,fail_on_down,fail_on_unreachable)
540 ) ENGINE=InnoDB COMMENT='Host dependency definitions';
541
542 -- --------------------------------------------------------
543
544 --
545 -- Table structure for table icinga_hostescalations
546 --
547
548 CREATE TABLE IF NOT EXISTS icinga_hostescalations (
549 hostescalation_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
550 instance_id bigint unsigned default 0,
551 config_type smallint default 0,
552 host_object_id bigint unsigned default 0,
553 timeperiod_object_id bigint unsigned default 0,
554 first_notification smallint default 0,
555 last_notification smallint default 0,
556 notification_interval double default '0',
557 escalate_on_recovery smallint default 0,
558 escalate_on_down smallint default 0,
559 escalate_on_unreachable smallint default 0,
560 PRIMARY KEY (hostescalation_id),
561 UNIQUE KEY instance_id (instance_id,config_type,host_object_id,timeperiod_object_id,first_notification,last_notification)
562 ) ENGINE=InnoDB COMMENT='Host escalation definitions';
563
564 -- --------------------------------------------------------
565
566 --
567 -- Table structure for table icinga_hostescalation_contactgroups
568 --
569
570 CREATE TABLE IF NOT EXISTS icinga_hostescalation_contactgroups (
571 hostescalation_contactgroup_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
572 instance_id bigint unsigned default 0,
573 hostescalation_id bigint unsigned default 0,
574 contactgroup_object_id bigint unsigned default 0,
575 PRIMARY KEY (hostescalation_contactgroup_id),
576 UNIQUE KEY instance_id (hostescalation_id,contactgroup_object_id)
577 ) ENGINE=InnoDB COMMENT='Host escalation contact groups';
578
579 -- --------------------------------------------------------
580
581 --
582 -- Table structure for table icinga_hostescalation_contacts
583 --
584
585 CREATE TABLE IF NOT EXISTS icinga_hostescalation_contacts (
586 hostescalation_contact_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
587 instance_id bigint unsigned default 0,
588 hostescalation_id bigint unsigned default 0,
589 contact_object_id bigint unsigned default 0,
590 PRIMARY KEY (hostescalation_contact_id),
591 UNIQUE KEY instance_id (instance_id,hostescalation_id,contact_object_id)
592 ) ENGINE=InnoDB COMMENT='Host escalation contacts';
593
594 -- --------------------------------------------------------
595
596 --
597 -- Table structure for table icinga_hostgroups
598 --
599
600 CREATE TABLE IF NOT EXISTS icinga_hostgroups (
601 hostgroup_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
602 instance_id bigint unsigned default 0,
603 config_type smallint default 0,
604 hostgroup_object_id bigint unsigned default 0,
605 alias varchar(255) character set latin1 default '',
606 notes TEXT character set latin1 default NULL,
607 notes_url TEXT character set latin1 default NULL,
608 action_url TEXT character set latin1 default NULL,
609 config_hash varchar(64) DEFAULT NULL,
610 PRIMARY KEY (hostgroup_id),
611 UNIQUE KEY instance_id (instance_id,hostgroup_object_id)
612 ) ENGINE=InnoDB COMMENT='Hostgroup definitions';
613
614 -- --------------------------------------------------------
615
616 --
617 -- Table structure for table icinga_hostgroup_members
618 --
619
620 CREATE TABLE IF NOT EXISTS icinga_hostgroup_members (
621 hostgroup_member_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
622 instance_id bigint unsigned default 0,
623 hostgroup_id bigint unsigned default 0,
624 host_object_id bigint unsigned default 0,
625 PRIMARY KEY (hostgroup_member_id)
626 ) ENGINE=InnoDB COMMENT='Hostgroup members';
627
628 -- --------------------------------------------------------
629
630 --
631 -- Table structure for table icinga_hosts
632 --
633
634 CREATE TABLE IF NOT EXISTS icinga_hosts (
635 host_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
636 instance_id bigint unsigned default 0,
637 config_type smallint default 0,
638 host_object_id bigint unsigned default 0,
639 alias varchar(255) character set latin1 default '',
640 display_name varchar(255) character set latin1 collate latin1_general_cs default '',
641 address varchar(128) character set latin1 default '',
642 address6 varchar(128) character set latin1 default '',
643 check_command_object_id bigint unsigned default 0,
644 check_command_args TEXT character set latin1,
645 eventhandler_command_object_id bigint unsigned default 0,
646 eventhandler_command_args TEXT character set latin1,
647 notification_timeperiod_object_id bigint unsigned default 0,
648 check_timeperiod_object_id bigint unsigned default 0,
649 failure_prediction_options varchar(128) character set latin1 default '',
650 check_interval double default '0',
651 retry_interval double default '0',
652 max_check_attempts smallint default 0,
653 first_notification_delay double default '0',
654 notification_interval double default '0',
655 notify_on_down smallint default 0,
656 notify_on_unreachable smallint default 0,
657 notify_on_recovery smallint default 0,
658 notify_on_flapping smallint default 0,
659 notify_on_downtime smallint default 0,
660 stalk_on_up smallint default 0,
661 stalk_on_down smallint default 0,
662 stalk_on_unreachable smallint default 0,
663 flap_detection_enabled smallint default 0,
664 flap_detection_on_up smallint default 0,
665 flap_detection_on_down smallint default 0,
666 flap_detection_on_unreachable smallint default 0,
667 low_flap_threshold double default '0',
668 high_flap_threshold double default '0',
669 process_performance_data smallint default 0,
670 freshness_checks_enabled smallint default 0,
671 freshness_threshold int default 0,
672 passive_checks_enabled smallint default 0,
673 event_handler_enabled smallint default 0,
674 active_checks_enabled smallint default 0,
675 retain_status_information smallint default 0,
676 retain_nonstatus_information smallint default 0,
677 notifications_enabled smallint default 0,
678 obsess_over_host smallint default 0,
679 failure_prediction_enabled smallint default 0,
680 notes TEXT character set latin1,
681 notes_url TEXT character set latin1,
682 action_url TEXT character set latin1,
683 icon_image TEXT character set latin1,
684 icon_image_alt TEXT character set latin1,
685 vrml_image TEXT character set latin1,
686 statusmap_image TEXT character set latin1,
687 have_2d_coords smallint default 0,
688 x_2d smallint default 0,
689 y_2d smallint default 0,
690 have_3d_coords smallint default 0,
691 x_3d double default '0',
692 y_3d double default '0',
693 z_3d double default '0',
694 config_hash varchar(64) DEFAULT NULL,
695 PRIMARY KEY (host_id),
696 UNIQUE KEY instance_id (instance_id,config_type,host_object_id)
697 ) ENGINE=InnoDB COMMENT='Host definitions';
698
699 -- --------------------------------------------------------
700
701 --
702 -- Table structure for table icinga_hoststatus
703 --
704
705 CREATE TABLE IF NOT EXISTS icinga_hoststatus (
706 hoststatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
707 instance_id bigint unsigned default 0,
708 host_object_id bigint unsigned default 0,
709 status_update_time timestamp NULL,
710 output TEXT character set latin1,
711 long_output TEXT,
712 perfdata TEXT character set latin1,
713 check_source varchar(255) character set latin1 default '',
714 current_state smallint default 0,
715 has_been_checked smallint default 0,
716 should_be_scheduled smallint default 0,
717 current_check_attempt smallint default 0,
718 max_check_attempts smallint default 0,
719 last_check timestamp NULL,
720 next_check timestamp NULL,
721 check_type smallint default 0,
722 last_state_change timestamp NULL,
723 last_hard_state_change timestamp NULL,
724 last_hard_state smallint default 0,
725 last_time_up timestamp NULL,
726 last_time_down timestamp NULL,
727 last_time_unreachable timestamp NULL,
728 state_type smallint default 0,
729 last_notification timestamp NULL,
730 next_notification timestamp NULL,
731 no_more_notifications smallint default 0,
732 notifications_enabled smallint default 0,
733 problem_has_been_acknowledged smallint default 0,
734 acknowledgement_type smallint default 0,
735 current_notification_number int unsigned default 0,
736 passive_checks_enabled smallint default 0,
737 active_checks_enabled smallint default 0,
738 event_handler_enabled smallint default 0,
739 flap_detection_enabled smallint default 0,
740 is_flapping smallint default 0,
741 percent_state_change double default '0',
742 latency double default '0',
743 execution_time double default '0',
744 scheduled_downtime_depth smallint default 0,
745 failure_prediction_enabled smallint default 0,
746 process_performance_data smallint default 0,
747 obsess_over_host smallint default 0,
748 modified_host_attributes int default 0,
749 original_attributes TEXT character set latin1 default NULL,
750 event_handler TEXT character set latin1,
751 check_command TEXT character set latin1,
752 normal_check_interval double default '0',
753 retry_check_interval double default '0',
754 check_timeperiod_object_id bigint unsigned default 0,
755 is_reachable smallint default 0,
756 PRIMARY KEY (hoststatus_id),
757 UNIQUE KEY object_id (host_object_id)
758 ) ENGINE=InnoDB COMMENT='Current host status information';
759
760 -- --------------------------------------------------------
761
762 --
763 -- Table structure for table icinga_host_contactgroups
764 --
765
766 CREATE TABLE IF NOT EXISTS icinga_host_contactgroups (
767 host_contactgroup_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
768 instance_id bigint unsigned default 0,
769 host_id bigint unsigned default 0,
770 contactgroup_object_id bigint unsigned default 0,
771 PRIMARY KEY (host_contactgroup_id)
772 ) ENGINE=InnoDB COMMENT='Host contact groups';
773
774 -- --------------------------------------------------------
775
776 --
777 -- Table structure for table icinga_host_contacts
778 --
779
780 CREATE TABLE IF NOT EXISTS icinga_host_contacts (
781 host_contact_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
782 instance_id bigint unsigned default 0,
783 host_id bigint unsigned default 0,
784 contact_object_id bigint unsigned default 0,
785 PRIMARY KEY (host_contact_id)
786 ) ENGINE=InnoDB COMMENT='Host contacts';
787
788 -- --------------------------------------------------------
789
790 --
791 -- Table structure for table icinga_host_parenthosts
792 --
793
794 CREATE TABLE IF NOT EXISTS icinga_host_parenthosts (
795 host_parenthost_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
796 instance_id bigint unsigned default 0,
797 host_id bigint unsigned default 0,
798 parent_host_object_id bigint unsigned default 0,
799 PRIMARY KEY (host_parenthost_id)
800 ) ENGINE=InnoDB COMMENT='Parent hosts';
801
802 -- --------------------------------------------------------
803
804 --
805 -- Table structure for table icinga_instances
806 --
807
808 CREATE TABLE IF NOT EXISTS icinga_instances (
809 instance_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
810 instance_name varchar(64) character set latin1 default '',
811 instance_description varchar(128) character set latin1 default '',
812 PRIMARY KEY (instance_id)
813 ) ENGINE=InnoDB COMMENT='Location names of various Icinga installations';
814
815 -- --------------------------------------------------------
816
817 --
818 -- Table structure for table icinga_logentries
819 --
820
821 CREATE TABLE IF NOT EXISTS icinga_logentries (
822 logentry_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
823 instance_id bigint unsigned default 0,
824 logentry_time timestamp NULL,
825 entry_time timestamp NULL,
826 entry_time_usec int default 0,
827 logentry_type int default 0,
828 logentry_data TEXT character set latin1,
829 realtime_data smallint default 0,
830 inferred_data_extracted smallint default 0,
831 object_id bigint unsigned default NULL,
832 PRIMARY KEY (logentry_id)
833 ) ENGINE=InnoDB COMMENT='Historical record of log entries';
834
835 -- --------------------------------------------------------
836
837 --
838 -- Table structure for table icinga_notifications
839 --
840
841 CREATE TABLE IF NOT EXISTS icinga_notifications (
842 notification_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
843 instance_id bigint unsigned default 0,
844 notification_type smallint default 0,
845 notification_reason smallint default 0,
846 object_id bigint unsigned default 0,
847 start_time timestamp NULL,
848 start_time_usec int default 0,
849 end_time timestamp NULL,
850 end_time_usec int default 0,
851 state smallint default 0,
852 output TEXT character set latin1,
853 long_output TEXT,
854 escalated smallint default 0,
855 contacts_notified smallint default 0,
856 PRIMARY KEY (notification_id),
857 UNIQUE KEY instance_id (instance_id,object_id,start_time,start_time_usec)
858 ) ENGINE=InnoDB COMMENT='Historical record of host and service notifications';
859
860 -- --------------------------------------------------------
861
862 --
863 -- Table structure for table icinga_objects
864 --
865
866 CREATE TABLE IF NOT EXISTS icinga_objects (
867 object_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
868 instance_id bigint unsigned default 0,
869 objecttype_id bigint unsigned default 0,
870 name1 varchar(255) character set latin1 collate latin1_general_cs default '',
871 name2 varchar(255) character set latin1 collate latin1_general_cs default NULL,
872 is_active smallint default 0,
873 PRIMARY KEY (object_id),
874 KEY objecttype_id (objecttype_id,name1,name2)
875 ) ENGINE=InnoDB COMMENT='Current and historical objects of all kinds';
876
877 -- --------------------------------------------------------
878
879 --
880 -- Table structure for table icinga_processevents
881 --
882
883 CREATE TABLE IF NOT EXISTS icinga_processevents (
884 processevent_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
885 instance_id bigint unsigned default 0,
886 event_type smallint default 0,
887 event_time timestamp NULL,
888 event_time_usec int default 0,
889 process_id bigint unsigned default 0,
890 program_name varchar(16) character set latin1 default '',
891 program_version varchar(20) character set latin1 default '',
892 program_date varchar(10) character set latin1 default '',
893 PRIMARY KEY (processevent_id)
894 ) ENGINE=InnoDB COMMENT='Historical Icinga process events';
895
896 -- --------------------------------------------------------
897
898 --
899 -- Table structure for table icinga_programstatus
900 --
901
902 CREATE TABLE IF NOT EXISTS icinga_programstatus (
903 programstatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
904 instance_id bigint unsigned default 0,
905 program_version varchar(64) character set latin1 collate latin1_general_cs default NULL,
906 status_update_time timestamp NULL,
907 program_start_time timestamp NULL,
908 program_end_time timestamp NULL,
909 endpoint_name varchar(255) character set latin1 collate latin1_general_cs default NULL,
910 is_currently_running smallint default 0,
911 process_id bigint unsigned default 0,
912 daemon_mode smallint default 0,
913 last_command_check timestamp NULL,
914 last_log_rotation timestamp NULL,
915 notifications_enabled smallint default 0,
916 disable_notif_expire_time timestamp NULL,
917 active_service_checks_enabled smallint default 0,
918 passive_service_checks_enabled smallint default 0,
919 active_host_checks_enabled smallint default 0,
920 passive_host_checks_enabled smallint default 0,
921 event_handlers_enabled smallint default 0,
922 flap_detection_enabled smallint default 0,
923 failure_prediction_enabled smallint default 0,
924 process_performance_data smallint default 0,
925 obsess_over_hosts smallint default 0,
926 obsess_over_services smallint default 0,
927 modified_host_attributes int default 0,
928 modified_service_attributes int default 0,
929 global_host_event_handler TEXT character set latin1,
930 global_service_event_handler TEXT character set latin1,
931 config_dump_in_progress smallint default 0,
932 PRIMARY KEY (programstatus_id),
933 UNIQUE KEY instance_id (instance_id)
934 ) ENGINE=InnoDB COMMENT='Current program status information';
935
936 -- --------------------------------------------------------
937
938 --
939 -- Table structure for table icinga_runtimevariables
940 --
941
942 CREATE TABLE IF NOT EXISTS icinga_runtimevariables (
943 runtimevariable_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
944 instance_id bigint unsigned default 0,
945 varname varchar(64) character set latin1 default '',
946 varvalue TEXT character set latin1,
947 PRIMARY KEY (runtimevariable_id)
948 ) ENGINE=InnoDB COMMENT='Runtime variables from the Icinga daemon';
949
950 -- --------------------------------------------------------
951
952 --
953 -- Table structure for table icinga_scheduleddowntime
954 --
955
956 CREATE TABLE IF NOT EXISTS icinga_scheduleddowntime (
957 scheduleddowntime_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
958 instance_id bigint unsigned default 0,
959 downtime_type smallint default 0,
960 object_id bigint unsigned default 0,
961 entry_time timestamp NULL,
962 author_name varchar(64) character set latin1 default '',
963 comment_data TEXT character set latin1,
964 internal_downtime_id bigint unsigned default 0,
965 triggered_by_id bigint unsigned default 0,
966 is_fixed smallint default 0,
967 duration bigint(20) default 0,
968 scheduled_start_time timestamp NULL,
969 scheduled_end_time timestamp NULL,
970 was_started smallint default 0,
971 actual_start_time timestamp NULL,
972 actual_start_time_usec int default 0,
973 is_in_effect smallint default 0,
974 trigger_time timestamp NULL,
975 name TEXT character set latin1 default NULL,
976 session_token int default NULL,
977 PRIMARY KEY (scheduleddowntime_id)
978 ) ENGINE=InnoDB COMMENT='Current scheduled host and service downtime';
979
980 -- --------------------------------------------------------
981
982 --
983 -- Table structure for table icinga_servicechecks
984 --
985
986 CREATE TABLE IF NOT EXISTS icinga_servicechecks (
987 servicecheck_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
988 instance_id bigint unsigned default 0,
989 service_object_id bigint unsigned default 0,
990 check_type smallint default 0,
991 current_check_attempt smallint default 0,
992 max_check_attempts smallint default 0,
993 state smallint default 0,
994 state_type smallint default 0,
995 start_time timestamp NULL,
996 start_time_usec int default 0,
997 end_time timestamp NULL,
998 end_time_usec int default 0,
999 command_object_id bigint unsigned default 0,
1000 command_args TEXT character set latin1,
1001 command_line TEXT character set latin1,
1002 timeout smallint default 0,
1003 early_timeout smallint default 0,
1004 execution_time double default '0',
1005 latency double default '0',
1006 return_code smallint default 0,
1007 output TEXT character set latin1,
1008 long_output TEXT,
1009 perfdata TEXT character set latin1,
1010 PRIMARY KEY (servicecheck_id)
1011 ) ENGINE=InnoDB COMMENT='Historical service checks';
1012
1013 -- --------------------------------------------------------
1014
1015 --
1016 -- Table structure for table icinga_servicedependencies
1017 --
1018
1019 CREATE TABLE IF NOT EXISTS icinga_servicedependencies (
1020 servicedependency_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1021 instance_id bigint unsigned default 0,
1022 config_type smallint default 0,
1023 service_object_id bigint unsigned default 0,
1024 dependent_service_object_id bigint unsigned default 0,
1025 dependency_type smallint default 0,
1026 inherits_parent smallint default 0,
1027 timeperiod_object_id bigint unsigned default 0,
1028 fail_on_ok smallint default 0,
1029 fail_on_warning smallint default 0,
1030 fail_on_unknown smallint default 0,
1031 fail_on_critical smallint default 0,
1032 PRIMARY KEY (servicedependency_id),
1033 KEY instance_id (instance_id,config_type,service_object_id,dependent_service_object_id,dependency_type,inherits_parent,fail_on_ok,fail_on_warning,fail_on_unknown,fail_on_critical)
1034 ) ENGINE=InnoDB COMMENT='Service dependency definitions';
1035
1036 -- --------------------------------------------------------
1037
1038 --
1039 -- Table structure for table icinga_serviceescalations
1040 --
1041
1042 CREATE TABLE IF NOT EXISTS icinga_serviceescalations (
1043 serviceescalation_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1044 instance_id bigint unsigned default 0,
1045 config_type smallint default 0,
1046 service_object_id bigint unsigned default 0,
1047 timeperiod_object_id bigint unsigned default 0,
1048 first_notification smallint default 0,
1049 last_notification smallint default 0,
1050 notification_interval double default '0',
1051 escalate_on_recovery smallint default 0,
1052 escalate_on_warning smallint default 0,
1053 escalate_on_unknown smallint default 0,
1054 escalate_on_critical smallint default 0,
1055 PRIMARY KEY (serviceescalation_id),
1056 UNIQUE KEY instance_id (instance_id,config_type,service_object_id,timeperiod_object_id,first_notification,last_notification)
1057 ) ENGINE=InnoDB COMMENT='Service escalation definitions';
1058
1059 -- --------------------------------------------------------
1060
1061 --
1062 -- Table structure for table icinga_serviceescalation_contactgroups
1063 --
1064
1065 CREATE TABLE IF NOT EXISTS icinga_serviceescalation_contactgroups (
1066 serviceescalation_contactgroup_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1067 instance_id bigint unsigned default 0,
1068 serviceescalation_id bigint unsigned default 0,
1069 contactgroup_object_id bigint unsigned default 0,
1070 PRIMARY KEY (serviceescalation_contactgroup_id),
1071 UNIQUE KEY instance_id (serviceescalation_id,contactgroup_object_id)
1072 ) ENGINE=InnoDB COMMENT='Service escalation contact groups';
1073
1074 -- --------------------------------------------------------
1075
1076 --
1077 -- Table structure for table icinga_serviceescalation_contacts
1078 --
1079
1080 CREATE TABLE IF NOT EXISTS icinga_serviceescalation_contacts (
1081 serviceescalation_contact_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1082 instance_id bigint unsigned default 0,
1083 serviceescalation_id bigint unsigned default 0,
1084 contact_object_id bigint unsigned default 0,
1085 PRIMARY KEY (serviceescalation_contact_id),
1086 UNIQUE KEY instance_id (instance_id,serviceescalation_id,contact_object_id)
1087 ) ENGINE=InnoDB COMMENT='Service escalation contacts';
1088
1089 -- --------------------------------------------------------
1090
1091 --
1092 -- Table structure for table icinga_servicegroups
1093 --
1094
1095 CREATE TABLE IF NOT EXISTS icinga_servicegroups (
1096 servicegroup_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1097 instance_id bigint unsigned default 0,
1098 config_type smallint default 0,
1099 servicegroup_object_id bigint unsigned default 0,
1100 alias varchar(255) character set latin1 default '',
1101 notes TEXT character set latin1 default NULL,
1102 notes_url TEXT character set latin1 default NULL,
1103 action_url TEXT character set latin1 default NULL,
1104 config_hash varchar(64) DEFAULT NULL,
1105 PRIMARY KEY (servicegroup_id),
1106 UNIQUE KEY instance_id (instance_id,config_type,servicegroup_object_id)
1107 ) ENGINE=InnoDB COMMENT='Servicegroup definitions';
1108
1109 -- --------------------------------------------------------
1110
1111 --
1112 -- Table structure for table icinga_servicegroup_members
1113 --
1114
1115 CREATE TABLE IF NOT EXISTS icinga_servicegroup_members (
1116 servicegroup_member_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1117 instance_id bigint unsigned default 0,
1118 servicegroup_id bigint unsigned default 0,
1119 service_object_id bigint unsigned default 0,
1120 PRIMARY KEY (servicegroup_member_id)
1121 ) ENGINE=InnoDB COMMENT='Servicegroup members';
1122
1123 -- --------------------------------------------------------
1124
1125 --
1126 -- Table structure for table icinga_services
1127 --
1128
1129 CREATE TABLE IF NOT EXISTS icinga_services (
1130 service_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1131 instance_id bigint unsigned default 0,
1132 config_type smallint default 0,
1133 host_object_id bigint unsigned default 0,
1134 service_object_id bigint unsigned default 0,
1135 display_name varchar(255) character set latin1 collate latin1_general_cs default '',
1136 check_command_object_id bigint unsigned default 0,
1137 check_command_args TEXT character set latin1,
1138 eventhandler_command_object_id bigint unsigned default 0,
1139 eventhandler_command_args TEXT character set latin1,
1140 notification_timeperiod_object_id bigint unsigned default 0,
1141 check_timeperiod_object_id bigint unsigned default 0,
1142 failure_prediction_options varchar(64) character set latin1 default '',
1143 check_interval double default '0',
1144 retry_interval double default '0',
1145 max_check_attempts smallint default 0,
1146 first_notification_delay double default '0',
1147 notification_interval double default '0',
1148 notify_on_warning smallint default 0,
1149 notify_on_unknown smallint default 0,
1150 notify_on_critical smallint default 0,
1151 notify_on_recovery smallint default 0,
1152 notify_on_flapping smallint default 0,
1153 notify_on_downtime smallint default 0,
1154 stalk_on_ok smallint default 0,
1155 stalk_on_warning smallint default 0,
1156 stalk_on_unknown smallint default 0,
1157 stalk_on_critical smallint default 0,
1158 is_volatile smallint default 0,
1159 flap_detection_enabled smallint default 0,
1160 flap_detection_on_ok smallint default 0,
1161 flap_detection_on_warning smallint default 0,
1162 flap_detection_on_unknown smallint default 0,
1163 flap_detection_on_critical smallint default 0,
1164 low_flap_threshold double default '0',
1165 high_flap_threshold double default '0',
1166 process_performance_data smallint default 0,
1167 freshness_checks_enabled smallint default 0,
1168 freshness_threshold int default 0,
1169 passive_checks_enabled smallint default 0,
1170 event_handler_enabled smallint default 0,
1171 active_checks_enabled smallint default 0,
1172 retain_status_information smallint default 0,
1173 retain_nonstatus_information smallint default 0,
1174 notifications_enabled smallint default 0,
1175 obsess_over_service smallint default 0,
1176 failure_prediction_enabled smallint default 0,
1177 notes TEXT character set latin1,
1178 notes_url TEXT character set latin1,
1179 action_url TEXT character set latin1,
1180 icon_image TEXT character set latin1,
1181 icon_image_alt TEXT character set latin1,
1182 config_hash varchar(64) DEFAULT NULL,
1183 PRIMARY KEY (service_id),
1184 UNIQUE KEY instance_id (instance_id,config_type,service_object_id)
1185 ) ENGINE=InnoDB COMMENT='Service definitions';
1186
1187 -- --------------------------------------------------------
1188
1189 --
1190 -- Table structure for table icinga_servicestatus
1191 --
1192
1193 CREATE TABLE IF NOT EXISTS icinga_servicestatus (
1194 servicestatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1195 instance_id bigint unsigned default 0,
1196 service_object_id bigint unsigned default 0,
1197 status_update_time timestamp NULL,
1198 output TEXT character set latin1,
1199 long_output TEXT,
1200 perfdata TEXT character set latin1,
1201 check_source varchar(255) character set latin1 default '',
1202 current_state smallint default 0,
1203 has_been_checked smallint default 0,
1204 should_be_scheduled smallint default 0,
1205 current_check_attempt smallint default 0,
1206 max_check_attempts smallint default 0,
1207 last_check timestamp NULL,
1208 next_check timestamp NULL,
1209 check_type smallint default 0,
1210 last_state_change timestamp NULL,
1211 last_hard_state_change timestamp NULL,
1212 last_hard_state smallint default 0,
1213 last_time_ok timestamp NULL,
1214 last_time_warning timestamp NULL,
1215 last_time_unknown timestamp NULL,
1216 last_time_critical timestamp NULL,
1217 state_type smallint default 0,
1218 last_notification timestamp NULL,
1219 next_notification timestamp NULL,
1220 no_more_notifications smallint default 0,
1221 notifications_enabled smallint default 0,
1222 problem_has_been_acknowledged smallint default 0,
1223 acknowledgement_type smallint default 0,
1224 current_notification_number int unsigned default 0,
1225 passive_checks_enabled smallint default 0,
1226 active_checks_enabled smallint default 0,
1227 event_handler_enabled smallint default 0,
1228 flap_detection_enabled smallint default 0,
1229 is_flapping smallint default 0,
1230 percent_state_change double default '0',
1231 latency double default '0',
1232 execution_time double default '0',
1233 scheduled_downtime_depth smallint default 0,
1234 failure_prediction_enabled smallint default 0,
1235 process_performance_data smallint default 0,
1236 obsess_over_service smallint default 0,
1237 modified_service_attributes int default 0,
1238 original_attributes TEXT character set latin1 default NULL,
1239 event_handler TEXT character set latin1,
1240 check_command TEXT character set latin1,
1241 normal_check_interval double default '0',
1242 retry_check_interval double default '0',
1243 check_timeperiod_object_id bigint unsigned default 0,
1244 is_reachable smallint default 0,
1245 PRIMARY KEY (servicestatus_id),
1246 UNIQUE KEY object_id (service_object_id)
1247 ) ENGINE=InnoDB COMMENT='Current service status information';
1248
1249 -- --------------------------------------------------------
1250
1251 --
1252 -- Table structure for table icinga_service_contactgroups
1253 --
1254
1255 CREATE TABLE IF NOT EXISTS icinga_service_contactgroups (
1256 service_contactgroup_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1257 instance_id bigint unsigned default 0,
1258 service_id bigint unsigned default 0,
1259 contactgroup_object_id bigint unsigned default 0,
1260 PRIMARY KEY (service_contactgroup_id)
1261 ) ENGINE=InnoDB COMMENT='Service contact groups';
1262
1263 -- --------------------------------------------------------
1264
1265 --
1266 -- Table structure for table icinga_service_contacts
1267 --
1268
1269 CREATE TABLE IF NOT EXISTS icinga_service_contacts (
1270 service_contact_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1271 instance_id bigint unsigned default 0,
1272 service_id bigint unsigned default 0,
1273 contact_object_id bigint unsigned default 0,
1274 PRIMARY KEY (service_contact_id)
1275 ) ENGINE=InnoDB COMMENT='Service contacts';
1276
1277 -- --------------------------------------------------------
1278
1279 --
1280 -- Table structure for table icinga_statehistory
1281 --
1282
1283 CREATE TABLE IF NOT EXISTS icinga_statehistory (
1284 statehistory_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1285 instance_id bigint unsigned default 0,
1286 state_time timestamp NULL,
1287 state_time_usec int default 0,
1288 object_id bigint unsigned default 0,
1289 state_change smallint default 0,
1290 state smallint default 0,
1291 state_type smallint default 0,
1292 current_check_attempt smallint default 0,
1293 max_check_attempts smallint default 0,
1294 last_state smallint default 0,
1295 last_hard_state smallint default 0,
1296 output TEXT character set latin1,
1297 long_output TEXT,
1298 check_source varchar(255) character set latin1 default NULL,
1299 PRIMARY KEY (statehistory_id)
1300 ) ENGINE=InnoDB COMMENT='Historical host and service state changes';
1301
1302 -- --------------------------------------------------------
1303
1304 --
1305 -- Table structure for table icinga_systemcommands
1306 --
1307
1308 CREATE TABLE IF NOT EXISTS icinga_systemcommands (
1309 systemcommand_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1310 instance_id bigint unsigned default 0,
1311 start_time timestamp NULL,
1312 start_time_usec int default 0,
1313 end_time timestamp NULL,
1314 end_time_usec int default 0,
1315 command_line TEXT character set latin1,
1316 timeout smallint default 0,
1317 early_timeout smallint default 0,
1318 execution_time double default '0',
1319 return_code smallint default 0,
1320 output TEXT character set latin1,
1321 long_output TEXT,
1322 PRIMARY KEY (systemcommand_id),
1323 UNIQUE KEY instance_id (instance_id,start_time,start_time_usec)
1324 ) ENGINE=InnoDB COMMENT='Historical system commands that are executed';
1325
1326 -- --------------------------------------------------------
1327
1328 --
1329 -- Table structure for table icinga_timeperiods
1330 --
1331
1332 CREATE TABLE IF NOT EXISTS icinga_timeperiods (
1333 timeperiod_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1334 instance_id bigint unsigned default 0,
1335 config_type smallint default 0,
1336 timeperiod_object_id bigint unsigned default 0,
1337 alias varchar(255) character set latin1 default '',
1338 config_hash varchar(64) DEFAULT NULL,
1339 PRIMARY KEY (timeperiod_id),
1340 UNIQUE KEY instance_id (instance_id,config_type,timeperiod_object_id)
1341 ) ENGINE=InnoDB COMMENT='Timeperiod definitions';
1342
1343 -- --------------------------------------------------------
1344
1345 --
1346 -- Table structure for table icinga_timeperiod_timeranges
1347 --
1348
1349 CREATE TABLE IF NOT EXISTS icinga_timeperiod_timeranges (
1350 timeperiod_timerange_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1351 instance_id bigint unsigned default 0,
1352 timeperiod_id bigint unsigned default 0,
1353 day smallint default 0,
1354 start_sec int default 0,
1355 end_sec int default 0,
1356 PRIMARY KEY (timeperiod_timerange_id)
1357 ) ENGINE=InnoDB COMMENT='Timeperiod definitions';
1358
1359
1360 -- --------------------------------------------------------
1361 -- Icinga 2 specific schema extensions
1362 -- --------------------------------------------------------
1363
1364 --
1365 -- Table structure for table icinga_endpoints
1366 --
1367
1368 CREATE TABLE IF NOT EXISTS icinga_endpoints (
1369 endpoint_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1370 instance_id bigint unsigned default 0,
1371 endpoint_object_id bigint(20) unsigned DEFAULT '0',
1372 zone_object_id bigint(20) unsigned DEFAULT '0',
1373 config_type smallint(6) DEFAULT '0',
1374 identity varchar(255) DEFAULT NULL,
1375 node varchar(255) DEFAULT NULL,
1376 config_hash varchar(64) DEFAULT NULL,
1377 PRIMARY KEY (endpoint_id)
1378 ) ENGINE=InnoDB COMMENT='Endpoint configuration';
1379
1380 -- --------------------------------------------------------
1381
1382 --
1383 -- Table structure for table icinga_endpointstatus
1384 --
1385
1386 CREATE TABLE IF NOT EXISTS icinga_endpointstatus (
1387 endpointstatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1388 instance_id bigint unsigned default 0,
1389 endpoint_object_id bigint(20) unsigned DEFAULT '0',
1390 zone_object_id bigint(20) unsigned DEFAULT '0',
1391 status_update_time timestamp NULL,
1392 identity varchar(255) DEFAULT NULL,
1393 node varchar(255) DEFAULT NULL,
1394 is_connected smallint(6),
1395 PRIMARY KEY (endpointstatus_id)
1396 ) ENGINE=InnoDB COMMENT='Endpoint status';
1397
1398 --
1399 -- Table structure for table icinga_zones
1400 --
1401
1402 CREATE TABLE IF NOT EXISTS icinga_zones (
1403 zone_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1404 instance_id bigint unsigned default 0,
1405 zone_object_id bigint(20) unsigned DEFAULT '0',
1406 config_type smallint(6) DEFAULT '0',
1407 parent_zone_object_id bigint(20) unsigned DEFAULT '0',
1408 is_global smallint(6),
1409 config_hash varchar(64) DEFAULT NULL,
1410 PRIMARY KEY (zone_id)
1411 ) ENGINE=InnoDB COMMENT='Zone configuration';
1412
1413 -- --------------------------------------------------------
1414
1415 --
1416 -- Table structure for table icinga_zonestatus
1417 --
1418
1419 CREATE TABLE IF NOT EXISTS icinga_zonestatus (
1420 zonestatus_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1421 instance_id bigint unsigned default 0,
1422 zone_object_id bigint(20) unsigned DEFAULT '0',
1423 status_update_time timestamp NULL,
1424 parent_zone_object_id bigint(20) unsigned DEFAULT '0',
1425 PRIMARY KEY (zonestatus_id)
1426 ) ENGINE=InnoDB COMMENT='Zone status';
1427
1428
1429
1430
1431 ALTER TABLE icinga_servicestatus ADD COLUMN endpoint_object_id bigint default NULL;
1432 ALTER TABLE icinga_hoststatus ADD COLUMN endpoint_object_id bigint default NULL;
1433 ALTER TABLE icinga_contactstatus ADD COLUMN endpoint_object_id bigint default NULL;
1434 ALTER TABLE icinga_programstatus ADD COLUMN endpoint_object_id bigint default NULL;
1435 ALTER TABLE icinga_comments ADD COLUMN endpoint_object_id bigint default NULL;
1436 ALTER TABLE icinga_scheduleddowntime ADD COLUMN endpoint_object_id bigint default NULL;
1437 ALTER TABLE icinga_runtimevariables ADD COLUMN endpoint_object_id bigint default NULL;
1438 ALTER TABLE icinga_customvariablestatus ADD COLUMN endpoint_object_id bigint default NULL;
1439
1440 ALTER TABLE icinga_acknowledgements ADD COLUMN endpoint_object_id bigint default NULL;
1441 ALTER TABLE icinga_commenthistory ADD COLUMN endpoint_object_id bigint default NULL;
1442 ALTER TABLE icinga_contactnotifications ADD COLUMN endpoint_object_id bigint default NULL;
1443 ALTER TABLE icinga_downtimehistory ADD COLUMN endpoint_object_id bigint default NULL;
1444 ALTER TABLE icinga_eventhandlers ADD COLUMN endpoint_object_id bigint default NULL;
1445 ALTER TABLE icinga_externalcommands ADD COLUMN endpoint_object_id bigint default NULL;
1446 ALTER TABLE icinga_flappinghistory ADD COLUMN endpoint_object_id bigint default NULL;
1447 ALTER TABLE icinga_hostchecks ADD COLUMN endpoint_object_id bigint default NULL;
1448 ALTER TABLE icinga_logentries ADD COLUMN endpoint_object_id bigint default NULL;
1449 ALTER TABLE icinga_notifications ADD COLUMN endpoint_object_id bigint default NULL;
1450 ALTER TABLE icinga_processevents ADD COLUMN endpoint_object_id bigint default NULL;
1451 ALTER TABLE icinga_servicechecks ADD COLUMN endpoint_object_id bigint default NULL;
1452 ALTER TABLE icinga_statehistory ADD COLUMN endpoint_object_id bigint default NULL;
1453 ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;
1454
1455 -- -----------------------------------------
1456 -- add index (delete)
1457 -- -----------------------------------------
1458
1459 -- for periodic delete
1460 -- instance_id and
1461 -- SYSTEMCOMMANDS, SERVICECHECKS, HOSTCHECKS, EVENTHANDLERS => start_time
1462 -- EXTERNALCOMMANDS => entry_time
1463
1464 -- instance_id
1465 CREATE INDEX servicechecks_i_id_idx on icinga_servicechecks(instance_id);
1466 CREATE INDEX hostchecks_i_id_idx on icinga_hostchecks(instance_id);
1467 CREATE INDEX externalcommands_i_id_idx on icinga_externalcommands(instance_id);
1468
1469 -- time
1470 CREATE INDEX systemcommands_time_id_idx on icinga_systemcommands(start_time);
1471 CREATE INDEX servicechecks_time_id_idx on icinga_servicechecks(start_time);
1472 CREATE INDEX hostchecks_time_id_idx on icinga_hostchecks(start_time);
1473 CREATE INDEX eventhandlers_time_id_idx on icinga_eventhandlers(start_time);
1474 CREATE INDEX externalcommands_time_id_idx on icinga_externalcommands(entry_time);
1475
1476
1477 -- for starting cleanup - referenced in dbhandler.c:882
1478 -- instance_id only
1479
1480 -- realtime data
1481 CREATE INDEX hoststatus_i_id_idx on icinga_hoststatus(instance_id);
1482 CREATE INDEX servicestatus_i_id_idx on icinga_servicestatus(instance_id);
1483 CREATE INDEX contactstatus_i_id_idx on icinga_contactstatus(instance_id);
1484 CREATE INDEX customvariablestatus_i_id_idx on icinga_customvariablestatus(instance_id);
1485
1486 -- config data
1487 CREATE INDEX configfilevariables_i_id_idx on icinga_configfilevariables(instance_id);
1488 CREATE INDEX customvariables_i_id_idx on icinga_customvariables(instance_id);
1489 CREATE INDEX timeperiod_timeranges_i_id_idx on icinga_timeperiod_timeranges(instance_id);
1490 CREATE INDEX contactgroup_members_i_id_idx on icinga_contactgroup_members(instance_id);
1491 CREATE INDEX hostgroup_members_i_id_idx on icinga_hostgroup_members(instance_id);
1492 CREATE INDEX servicegroup_members_i_id_idx on icinga_servicegroup_members(instance_id);
1493 CREATE INDEX contact_addresses_i_id_idx on icinga_contact_addresses(instance_id);
1494 CREATE INDEX contact_notifcommands_i_id_idx on icinga_contact_notificationcommands(instance_id);
1495 CREATE INDEX host_parenthosts_i_id_idx on icinga_host_parenthosts(instance_id);
1496 CREATE INDEX host_contacts_i_id_idx on icinga_host_contacts(instance_id);
1497 CREATE INDEX service_contacts_i_id_idx on icinga_service_contacts(instance_id);
1498 CREATE INDEX service_contactgroups_i_id_idx on icinga_service_contactgroups(instance_id);
1499 CREATE INDEX host_contactgroups_i_id_idx on icinga_host_contactgroups(instance_id);
1500 CREATE INDEX hostesc_cgroups_i_id_idx on icinga_hostescalation_contactgroups(instance_id);
1501 CREATE INDEX serviceesc_cgroups_i_id_idx on icinga_serviceescalation_contactgroups(instance_id);
1502
1503 -- -----------------------------------------
1504 -- more index stuff (WHERE clauses)
1505 -- -----------------------------------------
1506
1507 -- hosts
1508 CREATE INDEX hosts_host_object_id_idx on icinga_hosts(host_object_id);
1509
1510 -- hoststatus
1511 CREATE INDEX hoststatus_stat_upd_time_idx on icinga_hoststatus(status_update_time);
1512 CREATE INDEX hoststatus_current_state_idx on icinga_hoststatus(current_state);
1513 CREATE INDEX hoststatus_check_type_idx on icinga_hoststatus(check_type);
1514 CREATE INDEX hoststatus_state_type_idx on icinga_hoststatus(state_type);
1515 CREATE INDEX hoststatus_last_state_chg_idx on icinga_hoststatus(last_state_change);
1516 CREATE INDEX hoststatus_notif_enabled_idx on icinga_hoststatus(notifications_enabled);
1517 CREATE INDEX hoststatus_problem_ack_idx on icinga_hoststatus(problem_has_been_acknowledged);
1518 CREATE INDEX hoststatus_act_chks_en_idx on icinga_hoststatus(active_checks_enabled);
1519 CREATE INDEX hoststatus_pas_chks_en_idx on icinga_hoststatus(passive_checks_enabled);
1520 CREATE INDEX hoststatus_event_hdl_en_idx on icinga_hoststatus(event_handler_enabled);
1521 CREATE INDEX hoststatus_flap_det_en_idx on icinga_hoststatus(flap_detection_enabled);
1522 CREATE INDEX hoststatus_is_flapping_idx on icinga_hoststatus(is_flapping);
1523 CREATE INDEX hoststatus_p_state_chg_idx on icinga_hoststatus(percent_state_change);
1524 CREATE INDEX hoststatus_latency_idx on icinga_hoststatus(latency);
1525 CREATE INDEX hoststatus_ex_time_idx on icinga_hoststatus(execution_time);
1526 CREATE INDEX hoststatus_sch_downt_d_idx on icinga_hoststatus(scheduled_downtime_depth);
1527
1528 -- services
1529 CREATE INDEX services_host_object_id_idx on icinga_services(host_object_id);
1530
1531 -- servicestatus
1532 CREATE INDEX srvcstatus_stat_upd_time_idx on icinga_servicestatus(status_update_time);
1533 CREATE INDEX srvcstatus_current_state_idx on icinga_servicestatus(current_state);
1534 CREATE INDEX srvcstatus_check_type_idx on icinga_servicestatus(check_type);
1535 CREATE INDEX srvcstatus_state_type_idx on icinga_servicestatus(state_type);
1536 CREATE INDEX srvcstatus_last_state_chg_idx on icinga_servicestatus(last_state_change);
1537 CREATE INDEX srvcstatus_notif_enabled_idx on icinga_servicestatus(notifications_enabled);
1538 CREATE INDEX srvcstatus_problem_ack_idx on icinga_servicestatus(problem_has_been_acknowledged);
1539 CREATE INDEX srvcstatus_act_chks_en_idx on icinga_servicestatus(active_checks_enabled);
1540 CREATE INDEX srvcstatus_pas_chks_en_idx on icinga_servicestatus(passive_checks_enabled);
1541 CREATE INDEX srvcstatus_event_hdl_en_idx on icinga_servicestatus(event_handler_enabled);
1542 CREATE INDEX srvcstatus_flap_det_en_idx on icinga_servicestatus(flap_detection_enabled);
1543 CREATE INDEX srvcstatus_is_flapping_idx on icinga_servicestatus(is_flapping);
1544 CREATE INDEX srvcstatus_p_state_chg_idx on icinga_servicestatus(percent_state_change);
1545 CREATE INDEX srvcstatus_latency_idx on icinga_servicestatus(latency);
1546 CREATE INDEX srvcstatus_ex_time_idx on icinga_servicestatus(execution_time);
1547 CREATE INDEX srvcstatus_sch_downt_d_idx on icinga_servicestatus(scheduled_downtime_depth);
1548
1549 -- hostchecks
1550 CREATE INDEX hostchks_h_obj_id_idx on icinga_hostchecks(host_object_id);
1551
1552 -- servicechecks
1553 CREATE INDEX servicechks_s_obj_id_idx on icinga_servicechecks(service_object_id);
1554
1555 -- objects
1556 CREATE INDEX objects_name1_idx ON icinga_objects(name1);
1557 CREATE INDEX objects_name2_idx ON icinga_objects(name2);
1558 CREATE INDEX objects_inst_id_idx ON icinga_objects(instance_id);
1559
1560 -- instances
1561 -- CREATE INDEX instances_name_idx on icinga_instances(instance_name);
1562
1563 -- logentries
1564 -- CREATE INDEX loge_instance_id_idx on icinga_logentries(instance_id);
1565 -- #236
1566 CREATE INDEX loge_time_idx on icinga_logentries(logentry_time);
1567 -- CREATE INDEX loge_data_idx on icinga_logentries(logentry_data);
1568 CREATE INDEX loge_inst_id_time_idx on icinga_logentries (instance_id ASC, logentry_time DESC);
1569
1570 -- commenthistory
1571 -- CREATE INDEX c_hist_instance_id_idx on icinga_logentries(instance_id);
1572 -- CREATE INDEX c_hist_c_time_idx on icinga_logentries(comment_time);
1573 -- CREATE INDEX c_hist_i_c_id_idx on icinga_logentries(internal_comment_id);
1574
1575 -- downtimehistory
1576 -- CREATE INDEX d_t_hist_nstance_id_idx on icinga_downtimehistory(instance_id);
1577 -- CREATE INDEX d_t_hist_type_idx on icinga_downtimehistory(downtime_type);
1578 -- CREATE INDEX d_t_hist_object_id_idx on icinga_downtimehistory(object_id);
1579 -- CREATE INDEX d_t_hist_entry_time_idx on icinga_downtimehistory(entry_time);
1580 -- CREATE INDEX d_t_hist_sched_start_idx on icinga_downtimehistory(scheduled_start_time);
1581 -- CREATE INDEX d_t_hist_sched_end_idx on icinga_downtimehistory(scheduled_end_time);
1582
1583 -- scheduleddowntime
1584 -- CREATE INDEX sched_d_t_downtime_type_idx on icinga_scheduleddowntime(downtime_type);
1585 -- CREATE INDEX sched_d_t_object_id_idx on icinga_scheduleddowntime(object_id);
1586 -- CREATE INDEX sched_d_t_entry_time_idx on icinga_scheduleddowntime(entry_time);
1587 -- CREATE INDEX sched_d_t_start_time_idx on icinga_scheduleddowntime(scheduled_start_time);
1588 -- CREATE INDEX sched_d_t_end_time_idx on icinga_scheduleddowntime(scheduled_end_time);
1589
1590 -- statehistory
1591 CREATE INDEX statehist_i_id_o_id_s_ty_s_ti on icinga_statehistory(instance_id, object_id, state_type, state_time);
1592 -- #2274
1593 create index statehist_state_idx on icinga_statehistory(object_id,state);
1594
1595
1596 -- Icinga Web Notifications
1597 CREATE INDEX notification_idx ON icinga_notifications(notification_type, object_id, start_time);
1598 CREATE INDEX notification_object_id_idx ON icinga_notifications(object_id);
1599 CREATE INDEX contact_notification_idx ON icinga_contactnotifications(notification_id, contact_object_id);
1600 CREATE INDEX contacts_object_id_idx ON icinga_contacts(contact_object_id);
1601 CREATE INDEX contact_notif_meth_notif_idx ON icinga_contactnotificationmethods(contactnotification_id, command_object_id);
1602 CREATE INDEX command_object_idx ON icinga_commands(object_id);
1603 CREATE INDEX services_combined_object_idx ON icinga_services(service_object_id, host_object_id);
1604
1605
1606 -- #2618
1607 CREATE INDEX cntgrpmbrs_cgid_coid ON icinga_contactgroup_members (contactgroup_id,contact_object_id);
1608 CREATE INDEX hstgrpmbrs_hgid_hoid ON icinga_hostgroup_members (hostgroup_id,host_object_id);
1609 CREATE INDEX hstcntgrps_hid_cgoid ON icinga_host_contactgroups (host_id,contactgroup_object_id);
1610 CREATE INDEX hstprnthsts_hid_phoid ON icinga_host_parenthosts (host_id,parent_host_object_id);
1611 CREATE INDEX runtimevars_iid_varn ON icinga_runtimevariables (instance_id,varname);
1612 CREATE INDEX sgmbrs_sgid_soid ON icinga_servicegroup_members (servicegroup_id,service_object_id);
1613 CREATE INDEX scgrps_sid_cgoid ON icinga_service_contactgroups (service_id,contactgroup_object_id);
1614 CREATE INDEX tperiod_tid_d_ss_es ON icinga_timeperiod_timeranges (timeperiod_id,day,start_sec,end_sec);
1615
1616 -- #3649
1617 CREATE INDEX sla_idx_sthist ON icinga_statehistory (object_id, state_time DESC);
1618 CREATE INDEX sla_idx_dohist ON icinga_downtimehistory (object_id, actual_start_time, actual_end_time);
1619 CREATE INDEX sla_idx_obj ON icinga_objects (objecttype_id, is_active, name1);
1620
1621 -- #4985
1622 CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, comment_time, internal_comment_id);
1623
1624 -- #10066
1625 CREATE INDEX idx_endpoints_object_id on icinga_endpoints(endpoint_object_id);
1626 CREATE INDEX idx_endpointstatus_object_id on icinga_endpointstatus(endpoint_object_id);
1627
1628 CREATE INDEX idx_endpoints_zone_object_id on icinga_endpoints(zone_object_id);
1629 CREATE INDEX idx_endpointstatus_zone_object_id on icinga_endpointstatus(zone_object_id);
1630
1631 CREATE INDEX idx_zones_object_id on icinga_zones(zone_object_id);
1632 CREATE INDEX idx_zonestatus_object_id on icinga_zonestatus(zone_object_id);
1633
1634 CREATE INDEX idx_zones_parent_object_id on icinga_zones(parent_zone_object_id);
1635 CREATE INDEX idx_zonestatus_parent_object_id on icinga_zonestatus(parent_zone_object_id);
1636
1637 -- #12210
1638 CREATE INDEX idx_comments_session_del ON icinga_comments (instance_id, session_token);
1639 CREATE INDEX idx_downtimes_session_del ON icinga_scheduleddowntime (instance_id, session_token);
1640
1641 -- #12107
1642 CREATE INDEX idx_statehistory_cleanup on icinga_statehistory(instance_id, state_time);
1643
1644 -- #12435
1645 CREATE INDEX idx_contactgroup_members_object_id on icinga_contactgroup_members(contact_object_id);
1646 CREATE INDEX idx_hostgroup_members_object_id on icinga_hostgroup_members(host_object_id);
1647 CREATE INDEX idx_servicegroup_members_object_id on icinga_servicegroup_members(service_object_id);
1648 CREATE INDEX idx_servicedependencies_dependent_service_object_id on icinga_servicedependencies(dependent_service_object_id);
1649 CREATE INDEX idx_hostdependencies_dependent_host_object_id on icinga_hostdependencies(dependent_host_object_id);
1650 CREATE INDEX idx_service_contacts_service_id on icinga_service_contacts(service_id);
1651 CREATE INDEX idx_host_contacts_host_id on icinga_host_contacts(host_id);
1652
1653 -- #5458
1654 create index idx_downtimehistory_remove on icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
1655 create index idx_scheduleddowntime_remove on icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
1656
1657 -- #5492
1658 CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
1659 CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
1660
1661 -- -----------------------------------------
1662 -- set dbversion
1663 -- -----------------------------------------
1664 INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.15.1', NOW(), NOW())
1665 ON DUPLICATE KEY UPDATE version='1.15.1', modify_time=NOW();
1666
1667