Fix previous hard state

This commit is contained in:
Noah Hilverling 2019-10-30 08:37:10 +01:00
parent 2181150007
commit 77e3333cd3
4 changed files with 4 additions and 4 deletions

View file

@ -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 (?,?,?,?,?,?,?,?,?,?,?,?,?)`,

View file

@ -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"`

View file

@ -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"`

View file

@ -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"]),