mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge pull request #110 from Icinga/bugfix/instance-table-not-updated-after-mysql-connection-is-lost-109
HA: Make sure we still write our instance, if the table got truncated
This commit is contained in:
commit
1eec608827
1 changed files with 8 additions and 7 deletions
15
ha/ha.go
15
ha/ha.go
|
|
@ -67,12 +67,14 @@ var mysqlObservers = struct {
|
|||
|
||||
func (h *HA) updateOwnInstance(env *Environment) error {
|
||||
_, err := h.super.Dbw.SqlExec(
|
||||
mysqlObservers.updateIcingadbInstanceById,
|
||||
"UPDATE icingadb_instance SET endpoint_id = ?, heartbeat = ?,"+
|
||||
" icinga2_version = ?, icinga2_start_time = ?, icinga2_notifications_enabled = ?,"+
|
||||
" icinga2_active_service_checks_enabled = ?, icinga2_active_host_checks_enabled = ?,"+
|
||||
" icinga2_event_handlers_enabled = ?, icinga2_flap_detection_enabled = ?,"+
|
||||
" icinga2_performance_data_enabled = ? WHERE id = ?",
|
||||
mysqlObservers.insertIntoIcingadbInstance,
|
||||
"REPLACE INTO icingadb_instance(id, environment_id, endpoint_id, heartbeat, responsible,"+
|
||||
" icinga2_version, icinga2_start_time, icinga2_notifications_enabled,"+
|
||||
" icinga2_active_service_checks_enabled, icinga2_active_host_checks_enabled,"+
|
||||
" icinga2_event_handlers_enabled, icinga2_flap_detection_enabled,"+
|
||||
" icinga2_performance_data_enabled) VALUES (?, ?, ?, ?, 'y', ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
h.uid[:],
|
||||
h.super.EnvId,
|
||||
env.Icinga2.EndpointId,
|
||||
h.lastHeartbeat,
|
||||
env.Icinga2.Version,
|
||||
|
|
@ -83,7 +85,6 @@ func (h *HA) updateOwnInstance(env *Environment) error {
|
|||
utils.Bool[env.Icinga2.EventHandlersEnabled],
|
||||
utils.Bool[env.Icinga2.FlapDetectionEnabled],
|
||||
utils.Bool[env.Icinga2.PerformanceDataEnabled],
|
||||
h.uid[:],
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue