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 *_state#previous_hard_state See merge request icingadb/icingadb-main!31
This commit is contained in:
commit
0cd25379db
5 changed files with 10 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ var (
|
|||
"state_type",
|
||||
"soft_state",
|
||||
"hard_state",
|
||||
"previous_hard_state",
|
||||
"attempt",
|
||||
"severity",
|
||||
"output",
|
||||
|
|
@ -46,6 +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"`
|
||||
Attempt float32 `json:"check_attempt"`
|
||||
Severity float32 `json:"severity"`
|
||||
Output string `json:"output"`
|
||||
|
|
@ -92,6 +94,7 @@ func (h *HostState) UpdateValues() []interface{} {
|
|||
utils.IcingaStateTypeToString(h.StateType),
|
||||
h.SoftState,
|
||||
h.HardState,
|
||||
h.PreviousHardState,
|
||||
h.Attempt,
|
||||
h.Severity,
|
||||
h.Output,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ var (
|
|||
"state_type",
|
||||
"soft_state",
|
||||
"hard_state",
|
||||
"previous_hard_state",
|
||||
"attempt",
|
||||
"severity",
|
||||
"output",
|
||||
|
|
@ -46,6 +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"`
|
||||
Attempt float32 `json:"check_attempt"`
|
||||
Severity float32 `json:"severity"`
|
||||
Output string `json:"output"`
|
||||
|
|
@ -92,6 +94,7 @@ func (s *ServiceState) UpdateValues() []interface{} {
|
|||
utils.IcingaStateTypeToString(s.StateType),
|
||||
s.SoftState,
|
||||
s.HardState,
|
||||
s.PreviousHardState,
|
||||
s.Attempt,
|
||||
s.Severity,
|
||||
s.Output,
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ func syncStates(super *supervisor.Supervisor, objectType string) {
|
|||
_, errExec := super.Dbw.SqlExecTx(
|
||||
tx,
|
||||
mysqlObservers[objectType],
|
||||
`REPLACE INTO `+objectType+`_state (`+objectType+`_id, environment_id, state_type, soft_state, hard_state, attempt, severity, output, long_output, performance_data,`+
|
||||
`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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`,
|
||||
|
|
@ -110,6 +110,7 @@ func syncStates(super *supervisor.Supervisor, objectType string) {
|
|||
redisStateTypeToDBStateType(values["state_type"]),
|
||||
values["state"],
|
||||
values["last_hard_state"],
|
||||
values["previous_hard_state"],
|
||||
values["check_attempt"],
|
||||
redisIntToDBInt(values["severity"]),
|
||||
values["output"],
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ CREATE TABLE host_state (
|
|||
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,
|
||||
severity smallint unsigned NOT NULL,
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ CREATE TABLE service_state (
|
|||
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,
|
||||
severity smallint unsigned NOT NULL,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue