mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge branch 'feature/previous_hard_state' into 'master'
Schema: add {notification,state}_history#previous_hard_state
See merge request icingadb/icingadb-main!29
This commit is contained in:
commit
69b17f53e8
3 changed files with 12 additions and 8 deletions
|
|
@ -52,8 +52,8 @@ func StartHistoryWorkers(super *supervisor.Supervisor) {
|
|||
func notificationHistoryWorker(super *supervisor.Supervisor) {
|
||||
statements := []string{
|
||||
`REPLACE INTO notification_history (id, environment_id, endpoint_id, object_type, host_id, service_id, notification_id, type,` +
|
||||
`send_time, state, output, long_output, users_notified)` +
|
||||
`VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
||||
`send_time, state, previous_hard_state, output, long_output, users_notified)` +
|
||||
`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 (?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
||||
|
|
@ -73,6 +73,7 @@ func notificationHistoryWorker(super *supervisor.Supervisor) {
|
|||
values["type"],
|
||||
values["send_time"],
|
||||
values["state"],
|
||||
values["previous_hard_state"],
|
||||
values["output"],
|
||||
values["long_output"],
|
||||
values["users_notified"],
|
||||
|
|
@ -109,8 +110,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, change_time, state_type,` +
|
||||
`soft_state, hard_state, attempt, last_soft_state, last_hard_state, output, long_output, max_check_attempts)` +
|
||||
`VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
||||
`soft_state, hard_state, previous_hard_state, attempt, last_soft_state, last_hard_state, output, long_output, max_check_attempts)` +
|
||||
`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 (?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
||||
|
|
@ -136,6 +137,7 @@ func stateHistoryWorker(super *supervisor.Supervisor) {
|
|||
utils.IcingaStateTypeToString(float32(stateType)),
|
||||
values["soft_state"],
|
||||
values["hard_state"],
|
||||
values["previous_hard_state"],
|
||||
values["attempt"],
|
||||
values["last_soft_state"],
|
||||
values["last_hard_state"],
|
||||
|
|
|
|||
|
|
@ -64,15 +64,15 @@ func InsertNullRows(super *supervisor.Supervisor) {
|
|||
// notification_history
|
||||
execFunc(
|
||||
"notification_history",
|
||||
"REPLACE INTO notification_history(id, environment_id, object_type, host_id, service_id, notification_id, type, send_time, state, output, long_output, users_notified) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
emptyUUID[:], super.EnvId, "host", nil, nil, emptyID, 0, 0, 0, "", "", 0,
|
||||
"REPLACE INTO notification_history(id, environment_id, object_type, host_id, service_id, notification_id, type, send_time, state, previous_hard_state, output, long_output, users_notified) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
emptyUUID[:], super.EnvId, "host", nil, nil, emptyID, 0, 0, 0, 0, "", "", 0,
|
||||
)
|
||||
|
||||
// state_history
|
||||
execFunc(
|
||||
"state_history",
|
||||
"REPLACE INTO state_history(id, environment_id, object_type, host_id, service_id, change_time, state_type, soft_state, hard_state, attempt, last_soft_state, last_hard_state, output, long_output, max_check_attempts) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
emptyUUID[:], super.EnvId, "host", nil, nil, 0, "hard", 0, 0, 0, 0, 0, "", "", 0,
|
||||
"REPLACE INTO state_history(id, environment_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) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
emptyUUID[:], super.EnvId, "host", nil, nil, 0, "hard", 0, 0, 0, 0, 0, 0, "", "", 0,
|
||||
)
|
||||
|
||||
log.Info("Inserted \"NULL\" rows")
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ CREATE TABLE notification_history (
|
|||
type smallint(3) unsigned NOT NULL,
|
||||
send_time bigint(20) unsigned NOT NULL,
|
||||
state tinyint(1) unsigned NOT NULL,
|
||||
previous_hard_state tinyint(1) unsigned NOT NULL,
|
||||
output text DEFAULT NULL,
|
||||
long_output text DEFAULT NULL,
|
||||
users_notified smallint(5) unsigned NOT NULL,
|
||||
|
|
@ -32,6 +33,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_hard_state tinyint(1) unsigned NOT NULL,
|
||||
attempt tinyint(1) unsigned NOT NULL,
|
||||
last_soft_state tinyint(1) unsigned NOT NULL,
|
||||
last_hard_state tinyint(1) unsigned NOT NULL,
|
||||
|
|
|
|||
Loading…
Reference in a new issue