mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge branch 'feature/history-schema' into 'master'
Schema: add history tables See merge request icingadb/icingadb-main!18
This commit is contained in:
commit
c9bc00bb0d
2 changed files with 226 additions and 0 deletions
|
|
@ -145,3 +145,116 @@ CREATE TABLE host_state (
|
|||
|
||||
PRIMARY KEY (host_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE host_notification_history (
|
||||
id binary(16) NOT NULL COMMENT 'UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
host_id binary(20) NOT NULL COMMENT 'host.id',
|
||||
notification_id binary(20) NOT NULL COMMENT 'notification.id',
|
||||
|
||||
type smallint(3) unsigned NOT NULL,
|
||||
send_time bigint(20) unsigned NOT NULL,
|
||||
state tinyint(1) unsigned NOT NULL,
|
||||
output text DEFAULT NULL,
|
||||
long_output text DEFAULT NULL,
|
||||
users_notified smallint(5) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE host_state_history (
|
||||
id binary(16) NOT NULL COMMENT 'UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
host_id binary(20) NOT NULL COMMENT 'host.id',
|
||||
|
||||
change_time bigint(20) unsigned NOT NULL,
|
||||
state_type enum('hard', 'soft') NOT NULL,
|
||||
soft_state tinyint(1) unsigned NOT NULL,
|
||||
hard_state tinyint(1) unsigned NOT NULL,
|
||||
attempt tinyint(1) unsigned NOT NULL,
|
||||
last_soft_state tinyint(1) unsigned NOT NULL,
|
||||
last_hard_state tinyint(1) unsigned NOT NULL,
|
||||
output text DEFAULT NULL,
|
||||
long_output text DEFAULT NULL,
|
||||
max_check_attempts int(10) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE host_downtime_history (
|
||||
downtime_id binary(20) NOT NULL COMMENT 'host_downtime.id',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
host_id binary(20) NOT NULL COMMENT 'host.id',
|
||||
triggered_by_id binary(20) NULL DEFAULT NULL COMMENT 'host_downtime.id',
|
||||
|
||||
entry_time bigint(20) unsigned NOT NULL,
|
||||
author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci,
|
||||
comment text NOT NULL,
|
||||
is_fixed enum('y', 'n') NOT NULL,
|
||||
duration bigint(20) unsigned NOT NULL,
|
||||
scheduled_start_time bigint(20) unsigned NOT NULL,
|
||||
scheduled_end_time bigint(20) unsigned NOT NULL,
|
||||
was_started enum('y', 'n') NOT NULL,
|
||||
actual_start_time bigint(20) unsigned DEFAULT NULL COMMENT 'Time when the host went into a problem state during the downtimes timeframe',
|
||||
actual_end_time bigint(20) unsigned DEFAULT NULL COMMENT 'Problem state assumed: scheduled_end_time if fixed, start_time + duration otherwise',
|
||||
was_cancelled enum('y', 'n') NOT NULL,
|
||||
is_in_effect enum('y', 'n') NOT NULL,
|
||||
trigger_time bigint(20) unsigned NOT NULL,
|
||||
deletion_time bigint(20) unsigned NULL DEFAULT NULL,
|
||||
|
||||
PRIMARY KEY (downtime_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE host_comment_history (
|
||||
comment_id binary(20) NOT NULL COMMENT 'host_comment.id',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
host_id binary(20) NOT NULL COMMENT 'host.id',
|
||||
|
||||
entry_time bigint(20) unsigned NOT NULL,
|
||||
author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci,
|
||||
comment text NOT NULL,
|
||||
entry_type enum('comment','ack','downtime','flapping') NOT NULL,
|
||||
is_persistent enum('y','n') NOT NULL,
|
||||
expire_time bigint(20) unsigned DEFAULT NULL,
|
||||
deletion_time bigint(20) unsigned NULL DEFAULT NULL,
|
||||
|
||||
PRIMARY KEY (comment_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE host_flapping_history (
|
||||
id binary(16) NOT NULL COMMENT 'UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
host_id binary(20) NOT NULL COMMENT 'host.id',
|
||||
|
||||
start_time bigint(20) unsigned NOT NULL,
|
||||
end_time bigint(20) unsigned NULL DEFAULT NULL,
|
||||
percent_state_change float unsigned NOT NULL,
|
||||
flapping_threshold_low float unsigned NOT NULL,
|
||||
flapping_threshold_high float unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE host_flapping_current (
|
||||
host_id binary(20) NOT NULL COMMENT 'host.id',
|
||||
flapping_history_id binary(16) NOT NULL COMMENT 'host_flapping_history.id',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
|
||||
PRIMARY KEY (host_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE host_history (
|
||||
id binary(16) NOT NULL COMMENT 'notification_history_id, state_history_id, flapping_history_id or UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
host_id binary(20) NOT NULL COMMENT 'host.id',
|
||||
notification_history_id binary(16) NOT NULL COMMENT 'host_notification_history.id or 00000000-0000-0000-0000-000000000000',
|
||||
state_history_id binary(16) NOT NULL COMMENT 'host_state_history.id or 00000000-0000-0000-0000-000000000000',
|
||||
downtime_history_id binary(20) NOT NULL COMMENT 'host_downtime_history.downtime_id or 0000000000000000000000000000000000000000',
|
||||
comment_history_id binary(20) NOT NULL COMMENT 'host_comment_history.comment_id or 0000000000000000000000000000000000000000',
|
||||
flapping_history_id binary(16) NOT NULL COMMENT 'host_flapping_history.id or 00000000-0000-0000-0000-000000000000',
|
||||
|
||||
event_type enum('notification','state','downtime','comment','flapping') NOT NULL,
|
||||
event_time bigint(20) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
|
|
|||
|
|
@ -138,3 +138,116 @@ CREATE TABLE service_state (
|
|||
|
||||
PRIMARY KEY (service_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE service_notification_history (
|
||||
id binary(16) NOT NULL COMMENT 'UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
service_id binary(20) NOT NULL COMMENT 'service.id',
|
||||
notification_id binary(20) NOT NULL COMMENT 'notification.id',
|
||||
|
||||
type smallint(3) unsigned NOT NULL,
|
||||
send_time bigint(20) unsigned NOT NULL,
|
||||
state tinyint(1) unsigned NOT NULL,
|
||||
output text DEFAULT NULL,
|
||||
long_output text DEFAULT NULL,
|
||||
users_notified smallint(5) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE service_state_history (
|
||||
id binary(16) NOT NULL COMMENT 'UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
service_id binary(20) NOT NULL COMMENT 'service.id',
|
||||
|
||||
change_time bigint(20) unsigned NOT NULL,
|
||||
state_type enum('hard', 'soft') NOT NULL,
|
||||
soft_state tinyint(1) unsigned NOT NULL,
|
||||
hard_state tinyint(1) unsigned NOT NULL,
|
||||
attempt tinyint(1) unsigned NOT NULL,
|
||||
last_soft_state tinyint(1) unsigned NOT NULL,
|
||||
last_hard_state tinyint(1) unsigned NOT NULL,
|
||||
output text DEFAULT NULL,
|
||||
long_output text DEFAULT NULL,
|
||||
max_check_attempts int(10) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE service_downtime_history (
|
||||
downtime_id binary(20) NOT NULL COMMENT 'service_downtime.id',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
service_id binary(20) NOT NULL COMMENT 'service.id',
|
||||
triggered_by_id binary(20) NULL DEFAULT NULL COMMENT 'service_downtime.id',
|
||||
|
||||
entry_time bigint(20) unsigned NOT NULL,
|
||||
author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci,
|
||||
comment text NOT NULL,
|
||||
is_fixed enum('y', 'n') NOT NULL,
|
||||
duration bigint(20) unsigned NOT NULL,
|
||||
scheduled_start_time bigint(20) unsigned NOT NULL,
|
||||
scheduled_end_time bigint(20) unsigned NOT NULL,
|
||||
was_started enum('y', 'n') NOT NULL,
|
||||
actual_start_time bigint(20) unsigned DEFAULT NULL COMMENT 'Time when the service went into a problem state during the downtimes timeframe',
|
||||
actual_end_time bigint(20) unsigned DEFAULT NULL COMMENT 'Problem state assumed: scheduled_end_time if fixed, start_time + duration otherwise',
|
||||
was_cancelled enum('y', 'n') NOT NULL,
|
||||
is_in_effect enum('y', 'n') NOT NULL,
|
||||
trigger_time bigint(20) unsigned NOT NULL,
|
||||
deletion_time bigint(20) unsigned NULL DEFAULT NULL,
|
||||
|
||||
PRIMARY KEY (downtime_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE service_comment_history (
|
||||
comment_id binary(20) NOT NULL COMMENT 'service_comment.id',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
service_id binary(20) NOT NULL COMMENT 'service.id',
|
||||
|
||||
entry_time bigint(20) unsigned NOT NULL,
|
||||
author varchar(255) NOT NULL COLLATE utf8mb4_unicode_ci,
|
||||
comment text NOT NULL,
|
||||
entry_type enum('comment','ack','downtime','flapping') NOT NULL,
|
||||
is_persistent enum('y','n') NOT NULL,
|
||||
expire_time bigint(20) unsigned DEFAULT NULL,
|
||||
deletion_time bigint(20) unsigned NULL DEFAULT NULL,
|
||||
|
||||
PRIMARY KEY (comment_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE service_flapping_history (
|
||||
id binary(16) NOT NULL COMMENT 'UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
service_id binary(20) NOT NULL COMMENT 'service.id',
|
||||
|
||||
start_time bigint(20) unsigned NOT NULL,
|
||||
end_time bigint(20) unsigned NULL DEFAULT NULL,
|
||||
percent_state_change float unsigned NOT NULL,
|
||||
flapping_threshold_low float unsigned NOT NULL,
|
||||
flapping_threshold_high float unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE service_flapping_current (
|
||||
service_id binary(20) NOT NULL COMMENT 'service.id',
|
||||
flapping_history_id binary(16) NOT NULL COMMENT 'service_flapping_history.id',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
|
||||
PRIMARY KEY (service_id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
||||
CREATE TABLE service_history (
|
||||
id binary(16) NOT NULL COMMENT 'notification_history_id, state_history_id, flapping_history_id or UUID',
|
||||
environment_id binary(20) NOT NULL COMMENT 'environment.id',
|
||||
service_id binary(20) NOT NULL COMMENT 'service.id',
|
||||
notification_history_id binary(16) NOT NULL COMMENT 'service_notification_history.id or 00000000-0000-0000-0000-000000000000',
|
||||
state_history_id binary(16) NOT NULL COMMENT 'service_state_history.id or 00000000-0000-0000-0000-000000000000',
|
||||
downtime_history_id binary(20) NOT NULL COMMENT 'service_downtime_history.downtime_id or 0000000000000000000000000000000000000000',
|
||||
comment_history_id binary(20) NOT NULL COMMENT 'service_comment_history.comment_id or 0000000000000000000000000000000000000000',
|
||||
flapping_history_id binary(16) NOT NULL COMMENT 'service_flapping_history.id or 00000000-0000-0000-0000-000000000000',
|
||||
|
||||
event_type enum('notification','state','downtime','comment','flapping') NOT NULL,
|
||||
event_time bigint(20) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDb ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;
|
||||
|
|
|
|||
Loading…
Reference in a new issue