From 825dcbc8174b79de996abf0141233eebaae52365 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 9 Aug 2021 20:12:10 +0200 Subject: [PATCH] Introduce downtime#scheduled_by --- pkg/icingadb/v1/downtime.go | 1 + pkg/icingadb/v1/history/downtime.go | 1 + schema/mysql/schema.sql | 2 ++ schema/mysql/upgrades/1.0.0-rc2.sql | 2 ++ 4 files changed, 6 insertions(+) diff --git a/pkg/icingadb/v1/downtime.go b/pkg/icingadb/v1/downtime.go index efbd0265..9208f4a5 100644 --- a/pkg/icingadb/v1/downtime.go +++ b/pkg/icingadb/v1/downtime.go @@ -24,6 +24,7 @@ type Downtime struct { IsInEffect types.Bool `json:"is_in_effect"` StartTime types.UnixMilli `json:"start_time"` EndTime types.UnixMilli `json:"end_time"` + ScheduledBy types.String `json:"scheduled_by"` ZoneId types.Binary `json:"zone_id"` } diff --git a/pkg/icingadb/v1/history/downtime.go b/pkg/icingadb/v1/history/downtime.go index 6de8847d..448c9ecf 100644 --- a/pkg/icingadb/v1/history/downtime.go +++ b/pkg/icingadb/v1/history/downtime.go @@ -51,6 +51,7 @@ type DowntimeHistory struct { ScheduledEndTime types.UnixMilli `json:"scheduled_end_time"` StartTime types.UnixMilli `json:"start_time"` EndTime types.UnixMilli `json:"end_time"` + ScheduledBy types.String `json:"scheduled_by"` TriggerTime types.UnixMilli `json:"trigger_time"` } diff --git a/schema/mysql/schema.sql b/schema/mysql/schema.sql index 63dddb03..5c834a74 100644 --- a/schema/mysql/schema.sql +++ b/schema/mysql/schema.sql @@ -594,6 +594,7 @@ CREATE TABLE downtime ( is_in_effect enum('n', 'y') NOT NULL, start_time bigint unsigned DEFAULT NULL COMMENT 'Time when the host went into a problem state during the downtimes timeframe', end_time bigint unsigned DEFAULT NULL COMMENT 'Problem state assumed: scheduled_end_time if fixed, start_time + flexible_duration otherwise', + scheduled_by varchar(767) DEFAULT NULL COMMENT 'Name of the ScheduledDowntime which created this Downtime. 255+1+255+1+255, i.e. "host.name!service.name!scheduled-downtime-name"', zone_id binary(20) DEFAULT NULL COMMENT 'zone.id', @@ -958,6 +959,7 @@ CREATE TABLE downtime_history ( scheduled_end_time bigint unsigned NOT NULL, start_time bigint unsigned NOT NULL COMMENT 'Time when the host went into a problem state during the downtimes timeframe', end_time bigint unsigned NOT NULL COMMENT 'Problem state assumed: scheduled_end_time if fixed, start_time + duration otherwise', + scheduled_by varchar(767) DEFAULT NULL COMMENT 'Name of the ScheduledDowntime which created this Downtime. 255+1+255+1+255, i.e. "host.name!service.name!scheduled-downtime-name"', has_been_cancelled enum('n', 'y') NOT NULL, trigger_time bigint unsigned NOT NULL, cancel_time bigint unsigned DEFAULT NULL, diff --git a/schema/mysql/upgrades/1.0.0-rc2.sql b/schema/mysql/upgrades/1.0.0-rc2.sql index 30f5f31c..be17a0d3 100644 --- a/schema/mysql/upgrades/1.0.0-rc2.sql +++ b/schema/mysql/upgrades/1.0.0-rc2.sql @@ -97,6 +97,7 @@ ALTER TABLE comment MODIFY is_persistent enum('n','y') NOT NULL, MODIFY is_sticky enum('n','y') NOT NULL; ALTER TABLE downtime + ADD COLUMN scheduled_by varchar(767) DEFAULT NULL COMMENT 'Name of the ScheduledDowntime which created this Downtime. 255+1+255+1+255, i.e. "host.name!service.name!scheduled-downtime-name"' AFTER end_time, MODIFY name varchar(548) NOT NULL COMMENT '255+1+255+1+36, i.e. "host.name!service.name!UUID"', MODIFY is_flexible enum('n','y') NOT NULL, MODIFY is_in_effect enum('n','y') NOT NULL; @@ -107,6 +108,7 @@ ALTER TABLE user ALTER TABLE zone MODIFY is_global enum('n','y') NOT NULL; ALTER TABLE downtime_history + ADD COLUMN scheduled_by varchar(767) DEFAULT NULL COMMENT 'Name of the ScheduledDowntime which created this Downtime. 255+1+255+1+255, i.e. "host.name!service.name!scheduled-downtime-name"' AFTER end_time, MODIFY is_flexible enum('n','y') NOT NULL, MODIFY has_been_cancelled enum('n','y') NOT NULL; ALTER TABLE comment_history