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