Merge pull request #8 from Icinga/bugfix/last_soft_states_raw

Schema: add state_history#previous_soft_state
This commit is contained in:
Noah Hilverling 2019-11-04 14:11:14 +01:00 committed by GitHub
commit 531a5c8493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -134,8 +134,8 @@ func notificationHistoryWorker(super *supervisor.Supervisor) {
func stateHistoryWorker(super *supervisor.Supervisor) {
statements := []string{
`REPLACE INTO state_history (id, environment_id, endpoint_id, object_type, host_id, service_id, event_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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
`soft_state, hard_state, previous_soft_state, previous_hard_state, attempt, last_soft_state, last_hard_state, output, long_output, max_check_attempts, check_source)` +
`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 (?,?,?,?,?,?,?,?,?,?,?,?,?)`,
@ -161,6 +161,7 @@ func stateHistoryWorker(super *supervisor.Supervisor) {
utils.IcingaStateTypeToString(float32(stateType)),
values["soft_state"],
values["hard_state"],
values["previous_soft_state"],
values["previous_hard_state"],
values["attempt"],
values["last_soft_state"],

View file

@ -824,6 +824,7 @@ CREATE TABLE state_history (
state_type enum('hard', 'soft') NOT NULL,
soft_state tinyint(1) unsigned NOT NULL,
hard_state tinyint(1) unsigned NOT NULL,
previous_soft_state tinyint(1) unsigned NOT NULL,
previous_hard_state tinyint(1) unsigned NOT NULL,
attempt tinyint(1) unsigned NOT NULL,
last_soft_state tinyint(1) unsigned NOT NULL,