From 77e3333cd3836081300db2d934d80bef70d90404 Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Wed, 30 Oct 2019 08:37:10 +0100 Subject: [PATCH] Fix previous hard state --- configobject/history/history.go | 2 +- configobject/objecttypes/host/hoststate/hoststate.go | 2 +- configobject/objecttypes/service/servicestate/servicestate.go | 2 +- configobject/statesync/statesync.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configobject/history/history.go b/configobject/history/history.go index 5d02a67e..e8dc6ed7 100644 --- a/configobject/history/history.go +++ b/configobject/history/history.go @@ -111,7 +111,7 @@ func stateHistoryWorker(super *supervisor.Supervisor) { statements := []string{ `REPLACE INTO state_history (id, environment_id, endpoint_id, object_type, host_id, service_id, change_time, state_type,` + `soft_state, hard_state, previous_hard_state, attempt, last_soft_state, last_hard_state, output, long_output, max_check_attempts, check_source)` + - `VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, + `VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, `REPLACE INTO history (id, environment_id, endpoint_id, object_type, host_id, service_id, notification_history_id,` + `state_history_id, downtime_history_id, comment_history_id, flapping_history_id, event_type, event_time)` + `VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)`, diff --git a/configobject/objecttypes/host/hoststate/hoststate.go b/configobject/objecttypes/host/hoststate/hoststate.go index 4da59f81..fb7dcf56 100644 --- a/configobject/objecttypes/host/hoststate/hoststate.go +++ b/configobject/objecttypes/host/hoststate/hoststate.go @@ -47,7 +47,7 @@ type HostState struct { StateType float32 `json:"state_type"` SoftState float32 `json:"state"` HardState float32 `json:"NONE"` //TODO (NoH): I'm not sure where to get this from - PreviousHardState uint8 `json:"previous_hard_state"` + PreviousHardState float32 `json:"previous_hard_state"` Attempt float32 `json:"check_attempt"` Severity float32 `json:"severity"` Output string `json:"output"` diff --git a/configobject/objecttypes/service/servicestate/servicestate.go b/configobject/objecttypes/service/servicestate/servicestate.go index feb2fbcf..1c28983e 100644 --- a/configobject/objecttypes/service/servicestate/servicestate.go +++ b/configobject/objecttypes/service/servicestate/servicestate.go @@ -47,7 +47,7 @@ type ServiceState struct { StateType float32 `json:"state_type"` SoftState float32 `json:"state"` HardState float32 `json:"NONE"` //TODO (NoH): I'm not sure where to get this from - PreviousHardState uint8 `json:"previous_hard_state"` + PreviousHardState float32 `json:"previous_hard_state"` Attempt float32 `json:"check_attempt"` Severity float32 `json:"severity"` Output string `json:"output"` diff --git a/configobject/statesync/statesync.go b/configobject/statesync/statesync.go index bf1bf439..ae32a233 100644 --- a/configobject/statesync/statesync.go +++ b/configobject/statesync/statesync.go @@ -104,7 +104,7 @@ func syncStates(super *supervisor.Supervisor, objectType string) { `REPLACE INTO `+objectType+`_state (`+objectType+`_id, environment_id, state_type, soft_state, hard_state, previous_hard_state, attempt, severity, output, long_output, performance_data,`+ `check_commandline, is_problem, is_handled, is_reachable, is_flapping, is_acknowledged, acknowledgement_comment_id,`+ `in_downtime, execution_time, latency, timeout, check_source, last_update, last_state_change, last_soft_state,`+ - `last_hard_state, next_check, next_update) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, + `last_hard_state, next_check, next_update) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, id, super.EnvId, redisStateTypeToDBStateType(values["state_type"]),