From 17bdb9c5d1658e9d91e9f53d34f5c6eadbf21926 Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Wed, 29 Jan 2020 14:33:26 +0100 Subject: [PATCH] State: Allow last_update to be null --- .../objecttypes/host/hoststate/hoststate.go | 54 +++++++++---------- etc/schema/mysql/mysql.schema.sql | 4 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/configobject/objecttypes/host/hoststate/hoststate.go b/configobject/objecttypes/host/hoststate/hoststate.go index 8c2d1e9a..c24b21f6 100644 --- a/configobject/objecttypes/host/hoststate/hoststate.go +++ b/configobject/objecttypes/host/hoststate/hoststate.go @@ -44,33 +44,33 @@ var ( ) type HostState struct { - HostId string `json:"id"` - EnvId string `json:"environment_id"` - StateType float32 `json:"state_type"` - SoftState float32 `json:"state"` - HardState float32 `json:"hard_state"` - PreviousHardState float32 `json:"previous_hard_state"` - Attempt float32 `json:"check_attempt"` - Severity float32 `json:"severity"` - Output string `json:"output"` - LongOutput string `json:"long_output"` - PerformanceData string `json:"performance_data"` - CheckCommandline string `json:"commandline"` - IsProblem bool `json:"is_problem"` - IsHandled bool `json:"is_handled"` - IsReachable bool `json:"is_reachable"` - IsFlapping bool `json:"is_flapping"` - IsAcknowledged bool `json:"is_acknowledged"` - AcknowledgementCommentId string `json:"acknowledgement_comment_id"` - InDowntime bool `json:"in_downtime"` - ExecutionTime float32 `json:"execution_time"` - Latency float32 `json:"latency"` - Timeout float32 `json:"check_timeout"` - CheckSource string `json:"check_source"` - LastUpdate float32 `json:"last_update"` - LastStateChange float32 `json:"last_state_change"` - NextCheck float32 `json:"next_check"` - NextUpdate float32 `json:"next_update"` + HostId string `json:"id"` + EnvId string `json:"environment_id"` + StateType float32 `json:"state_type"` + SoftState float32 `json:"state"` + HardState float32 `json:"hard_state"` + PreviousHardState float32 `json:"previous_hard_state"` + Attempt float32 `json:"check_attempt"` + Severity float32 `json:"severity"` + Output string `json:"output"` + LongOutput string `json:"long_output"` + PerformanceData string `json:"performance_data"` + CheckCommandline string `json:"commandline"` + IsProblem bool `json:"is_problem"` + IsHandled bool `json:"is_handled"` + IsReachable bool `json:"is_reachable"` + IsFlapping bool `json:"is_flapping"` + IsAcknowledged bool `json:"is_acknowledged"` + AcknowledgementCommentId string `json:"acknowledgement_comment_id"` + InDowntime bool `json:"in_downtime"` + ExecutionTime float32 `json:"execution_time"` + Latency float32 `json:"latency"` + Timeout float32 `json:"check_timeout"` + CheckSource string `json:"check_source"` + LastUpdate interface{} `json:"last_update"` + LastStateChange float32 `json:"last_state_change"` + NextCheck float32 `json:"next_check"` + NextUpdate float32 `json:"next_update"` } func NewHostState() connection.Row { diff --git a/etc/schema/mysql/mysql.schema.sql b/etc/schema/mysql/mysql.schema.sql index 7dfe0ccf..91dcffa8 100644 --- a/etc/schema/mysql/mysql.schema.sql +++ b/etc/schema/mysql/mysql.schema.sql @@ -138,7 +138,7 @@ CREATE TABLE host_state ( timeout int(10) unsigned DEFAULT NULL, check_source text DEFAULT NULL, - last_update bigint(20) unsigned NOT NULL, + last_update bigint(20) unsigned DEFAULT NULL, last_state_change bigint(20) unsigned NOT NULL, next_check bigint(20) unsigned NOT NULL, next_update bigint(20) unsigned NOT NULL, @@ -274,7 +274,7 @@ CREATE TABLE service_state ( timeout int(10) unsigned DEFAULT NULL, check_source text DEFAULT NULL, - last_update bigint(20) unsigned NOT NULL, + last_update bigint(20) unsigned DEFAULT NULL, last_state_change bigint(20) unsigned NOT NULL, next_check bigint(20) unsigned NOT NULL, next_update bigint(20) unsigned NOT NULL,