mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Run gofmt
This commit is contained in:
parent
77e3333cd3
commit
730833c1b4
72 changed files with 1020 additions and 1029 deletions
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
type Logging struct {
|
||||
Level string `ini:"level"`
|
||||
Level string `ini:"level"`
|
||||
}
|
||||
|
||||
var logging = &Logging{
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import (
|
|||
)
|
||||
|
||||
type ObjectInformation struct {
|
||||
ObjectType string
|
||||
RedisKey string
|
||||
PrimaryMySqlField string
|
||||
HasChecksum bool
|
||||
NotificationListenerType string
|
||||
Factory connection.RowFactory
|
||||
BulkInsertStmt *connection.BulkInsertStmt
|
||||
BulkDeleteStmt *connection.BulkDeleteStmt
|
||||
BulkUpdateStmt *connection.BulkUpdateStmt
|
||||
}
|
||||
ObjectType string
|
||||
RedisKey string
|
||||
PrimaryMySqlField string
|
||||
HasChecksum bool
|
||||
NotificationListenerType string
|
||||
Factory connection.RowFactory
|
||||
BulkInsertStmt *connection.BulkInsertStmt
|
||||
BulkDeleteStmt *connection.BulkDeleteStmt
|
||||
BulkUpdateStmt *connection.BulkUpdateStmt
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ import (
|
|||
)
|
||||
|
||||
type Checksums struct {
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
GroupsChecksum string `json:"groups_checksum"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
GroupsChecksum string `json:"groups_checksum"`
|
||||
}
|
||||
|
||||
// Operator is the main worker for each config type. It takes a reference to a supervisor super, holding all required
|
||||
|
|
@ -34,28 +34,28 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co
|
|||
var (
|
||||
// If this IcingaDB-Instance looses responsibility, this channel will be
|
||||
// closed, resulting in a shutdown of all underlying workers
|
||||
done chan struct{}
|
||||
done chan struct{}
|
||||
// Used by this Operator to provide the InsertPrepWorker with IDs to insert
|
||||
// Operator -> InsertPrepWorker
|
||||
chInsert chan []string
|
||||
chInsert chan []string
|
||||
// Used by the JsonDecodePool to provide the InsertExecWorker with decoded rows, ready to be inserted
|
||||
// JsonDecodePool -> InsertExecWorker
|
||||
chInsertBack chan []connection.Row
|
||||
chInsertBack chan []connection.Row
|
||||
// Used by this Operator to provide the DeleteExecWorker with IDs to delete
|
||||
// Operator -> DeleteExecWorker
|
||||
chDelete chan []string
|
||||
chDelete chan []string
|
||||
// Used by this Operator to provide the UpdateCompWorker with IDs to compare
|
||||
// Operator -> UpdateCompWorker
|
||||
chUpdateComp chan []string
|
||||
chUpdateComp chan []string
|
||||
// Used by the UpdateCompWorker to provide the UpdatePrepWorker with IDs that have to be updated
|
||||
// UpdateCompWorker -> UpdatePrepWorker
|
||||
chUpdate chan []string
|
||||
chUpdate chan []string
|
||||
// Used by the JsonDecodePool to provide the UpdateExecWorker with decoded rows, ready to be updated
|
||||
// JsonDecodePool -> UpdateExecWorker
|
||||
chUpdateBack chan []connection.Row
|
||||
wgInsert *sync.WaitGroup
|
||||
wgDelete *sync.WaitGroup
|
||||
wgUpdate *sync.WaitGroup
|
||||
chUpdateBack chan []connection.Row
|
||||
wgInsert *sync.WaitGroup
|
||||
wgDelete *sync.WaitGroup
|
||||
wgUpdate *sync.WaitGroup
|
||||
)
|
||||
log.Debugf("%s: Ready", objectInformation.ObjectType)
|
||||
for msg := range chHA {
|
||||
|
|
@ -80,16 +80,16 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co
|
|||
//log.Infof("%s - Delta: (Insert: %d, Maybe Update: %d, Delete: %d)", objectInformation.ObjectType, len(insert), len(update), len(delete))
|
||||
|
||||
// Clean up all channels and wait groups for a fresh config dump
|
||||
done = make(chan struct{})
|
||||
chInsert = make(chan []string)
|
||||
chInsertBack = make(chan []connection.Row)
|
||||
chDelete = make(chan []string)
|
||||
chUpdateComp = make(chan []string)
|
||||
chUpdate = make(chan []string)
|
||||
chUpdateBack = make(chan []connection.Row)
|
||||
wgInsert = &sync.WaitGroup{}
|
||||
wgDelete = &sync.WaitGroup{}
|
||||
wgUpdate = &sync.WaitGroup{}
|
||||
done = make(chan struct{})
|
||||
chInsert = make(chan []string)
|
||||
chInsertBack = make(chan []connection.Row)
|
||||
chDelete = make(chan []string)
|
||||
chUpdateComp = make(chan []string)
|
||||
chUpdate = make(chan []string)
|
||||
chUpdateBack = make(chan []connection.Row)
|
||||
wgInsert = &sync.WaitGroup{}
|
||||
wgDelete = &sync.WaitGroup{}
|
||||
wgUpdate = &sync.WaitGroup{}
|
||||
|
||||
updateCounter := new(uint32)
|
||||
|
||||
|
|
@ -131,10 +131,10 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co
|
|||
benchmarc.Stop()
|
||||
if !kill && len(insert) > 0 {
|
||||
log.WithFields(log.Fields{
|
||||
"type": objectInformation.ObjectType,
|
||||
"count": len(insert),
|
||||
"benchmark": benchmarc.String(),
|
||||
"action": "insert",
|
||||
"type": objectInformation.ObjectType,
|
||||
"count": len(insert),
|
||||
"benchmark": benchmarc.String(),
|
||||
"action": "insert",
|
||||
}).Infof("Inserted %v %ss in %v", len(insert), objectInformation.ObjectType, benchmarc.String())
|
||||
}
|
||||
}()
|
||||
|
|
@ -159,7 +159,7 @@ func Operator(super *supervisor.Supervisor, chHA chan int, objectInformation *co
|
|||
}
|
||||
}()
|
||||
|
||||
if (objectInformation.HasChecksum) {
|
||||
if objectInformation.HasChecksum {
|
||||
go func() {
|
||||
benchmarc := utils.NewBenchmark()
|
||||
wgUpdate.Add(len(update))
|
||||
|
|
@ -195,7 +195,7 @@ func GetDelta(super *supervisor.Supervisor, objectInformation *configobject.Obje
|
|||
var (
|
||||
redisIds []string
|
||||
mysqlIds []string
|
||||
wg = sync.WaitGroup{}
|
||||
wg = sync.WaitGroup{}
|
||||
)
|
||||
|
||||
//get ids from redis
|
||||
|
|
@ -243,10 +243,10 @@ func InsertPrepWorker(super *supervisor.Supervisor, objectInformation *configobj
|
|||
}
|
||||
|
||||
pkg := jsondecoder.JsonDecodePackage{
|
||||
Id: key,
|
||||
ConfigRaw: chunk.Configs[i].(string),
|
||||
Factory: objectInformation.Factory,
|
||||
ObjectType: objectInformation.ObjectType,
|
||||
Id: key,
|
||||
ConfigRaw: chunk.Configs[i].(string),
|
||||
Factory: objectInformation.Factory,
|
||||
ObjectType: objectInformation.ObjectType,
|
||||
}
|
||||
|
||||
if chunk.Checksums[i] != nil {
|
||||
|
|
@ -377,11 +377,11 @@ func UpdatePrepWorker(super *supervisor.Supervisor, objectInformation *configobj
|
|||
continue
|
||||
}
|
||||
pkg := jsondecoder.JsonDecodePackage{
|
||||
Id: key,
|
||||
ChecksumsRaw: chunk.Checksums[i].(string),
|
||||
ConfigRaw: chunk.Configs[i].(string),
|
||||
Factory: objectInformation.Factory,
|
||||
ObjectType: objectInformation.ObjectType,
|
||||
Id: key,
|
||||
ChecksumsRaw: chunk.Checksums[i].(string),
|
||||
ConfigRaw: chunk.Configs[i].(string),
|
||||
Factory: objectInformation.Factory,
|
||||
ObjectType: objectInformation.ObjectType,
|
||||
}
|
||||
pkgs.Packages = append(pkgs.Packages, pkg)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ func SetupConfigSync(t *testing.T, objectTypes []*configobject.ObjectInformation
|
|||
Rdbw: rdbw,
|
||||
Dbw: dbw,
|
||||
EnvLock: &sync.Mutex{},
|
||||
EnvId: utils.EncodeChecksum("e057d4ea363fbab414a874371da253dba3d713bc"),
|
||||
EnvId: utils.EncodeChecksum("e057d4ea363fbab414a874371da253dba3d713bc"),
|
||||
}
|
||||
|
||||
go jsondecoder.DecodePool(super.ChDecode, super.ChErr, 16)
|
||||
|
|
@ -87,7 +87,7 @@ func TestOperator_InsertHost(t *testing.T) {
|
|||
_, err := super.Dbw.Db.Exec("TRUNCATE TABLE host")
|
||||
require.NoError(t, err)
|
||||
|
||||
redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\"" + utils.DecodeChecksum(super.EnvId) + "\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}")
|
||||
redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\""+utils.DecodeChecksum(super.EnvId)+"\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}")
|
||||
redisClient.HSet("icinga:checksum:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"checksum\":\"b6e87de3d4f31b3d4d35466171f4088693b46071\"}")
|
||||
|
||||
for _, ch := range chs {
|
||||
|
|
@ -106,7 +106,7 @@ func TestOperator_InsertHost(t *testing.T) {
|
|||
} else {
|
||||
return false
|
||||
}
|
||||
}, 3 * time.Second, 1 * time.Second, "Exactly 1 host should be synced")
|
||||
}, 3*time.Second, 1*time.Second, "Exactly 1 host should be synced")
|
||||
}
|
||||
|
||||
func TestOperator_DeleteHost(t *testing.T) {
|
||||
|
|
@ -178,7 +178,7 @@ func TestOperator_DeleteHost(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
return len(objects) == 0
|
||||
}, 3 * time.Second, 1 * time.Second, "Exactly 1 host should be deleted")
|
||||
}, 3*time.Second, 1*time.Second, "Exactly 1 host should be deleted")
|
||||
}
|
||||
|
||||
func TestOperator_UpdateHost(t *testing.T) {
|
||||
|
|
@ -193,10 +193,9 @@ func TestOperator_UpdateHost(t *testing.T) {
|
|||
_, err := super.Dbw.Db.Exec("TRUNCATE TABLE host")
|
||||
require.NoError(t, err)
|
||||
|
||||
redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\"" + utils.DecodeChecksum(super.EnvId) + "\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}")
|
||||
redisClient.HSet("icinga:config:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"active_checks_enabled\":false,\"address\":\"localhost\",\"address6\":\"\",\"check_interval\":10.0,\"check_retry_interval\":60.0,\"check_timeout\":null,\"checkcommand\":\"dummy\",\"checkcommand_id\":\"adc77319f261b771b35ce671aaf956d3c7534808\",\"display_name\":\"TestHost - 603\",\"environment_id\":\""+utils.DecodeChecksum(super.EnvId)+"\",\"event_handler_enabled\":true,\"flapping_enabled\":false,\"flapping_threshold_high\":30.0,\"flapping_threshold_low\":25.0,\"icon_image_alt\":\"\",\"is_volatile\":false,\"max_check_attempts\":3.0,\"name\":\"TestHost - 603\",\"name_checksum\":\"8ae04eb17df433de95fb6b855464e393f3d6ef72\",\"notes\":\"\",\"notifications_enabled\":true,\"passive_checks_enabled\":true,\"perfdata_enabled\":true}")
|
||||
redisClient.HSet("icinga:checksum:host", "a9ef44eb69fda8fbc32bee33322b6518057f559f", "{\"checksum\":\"b6e87de3d4f31b3d4d35466171f4088693b46071\"}")
|
||||
|
||||
|
||||
someChecksum := utils.EncodeChecksum(utils.Checksum("some_checksum"))
|
||||
|
||||
_, err = super.Dbw.Db.Exec(
|
||||
|
|
@ -262,5 +261,5 @@ func TestOperator_UpdateHost(t *testing.T) {
|
|||
} else {
|
||||
return false
|
||||
}
|
||||
}, 3 * time.Second, 1 * time.Second, "Exactly 1 host should be synced")
|
||||
}
|
||||
}, 3*time.Second, 1*time.Second, "Exactly 1 host should be synced")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,9 +186,9 @@ func downtimeHistoryWorker(super *supervisor.Supervisor) {
|
|||
}
|
||||
|
||||
dataFunctions := []func(values map[string]interface{}) []interface{}{
|
||||
func(values map[string]interface{}) []interface{}{
|
||||
func(values map[string]interface{}) []interface{} {
|
||||
var triggeredById []byte
|
||||
if values["triggered_by_id"] != nil{
|
||||
if values["triggered_by_id"] != nil {
|
||||
triggeredById = utils.EncodeChecksum(values["triggered_by_id"].(string))
|
||||
}
|
||||
|
||||
|
|
@ -386,8 +386,8 @@ func flappingHistoryWorker(super *supervisor.Supervisor) {
|
|||
|
||||
func historyWorker(super *supervisor.Supervisor, historyType string, preparedStatements []string, dataFunctions []func(map[string]interface{}) []interface{}, observer prometheus.Observer) {
|
||||
if super.EnvId == nil {
|
||||
log.Debug( historyType + "History: Waiting for EnvId to be set")
|
||||
<- time.NewTimer(time.Second).C
|
||||
log.Debug(historyType + "History: Waiting for EnvId to be set")
|
||||
<-time.NewTimer(time.Second).C
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +425,7 @@ func historyWorker(super *supervisor.Supervisor, historyType string, preparedSta
|
|||
if errExec != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"context": historyType + "History",
|
||||
"values": state.Values,
|
||||
"values": state.Values,
|
||||
}).Error(errExec)
|
||||
|
||||
entries = removeEntryFromEntriesSlice(entries, i)
|
||||
|
|
@ -450,9 +450,9 @@ func historyWorker(super *supervisor.Supervisor, historyType string, preparedSta
|
|||
}
|
||||
|
||||
//Delete synced entries from redis stream
|
||||
super.Rdbw.XDel("icinga:history:stream:" + historyType, storedEntryIds...)
|
||||
super.Rdbw.XDel("icinga:history:stream:"+historyType, storedEntryIds...)
|
||||
|
||||
log.Debugf("%d %s history entries synced", len(storedEntryIds) - brokenEntries, historyType)
|
||||
log.Debugf("%d %s history entries synced", len(storedEntryIds)-brokenEntries, historyType)
|
||||
log.Debugf("%d %s history entries broken", brokenEntries, historyType)
|
||||
}
|
||||
|
||||
|
|
@ -461,4 +461,3 @@ func removeEntryFromEntriesSlice(s []redis.XMessage, i int) []redis.XMessage {
|
|||
s[len(s)-1], s[i] = s[i], s[len(s)-1]
|
||||
return s[:len(s)-1]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"action_url",
|
||||
|
|
@ -16,9 +16,9 @@ var (
|
|||
)
|
||||
|
||||
type ActionUrl struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
ActionUrl string `json:"action_url"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
ActionUrl string `json:"action_url"`
|
||||
}
|
||||
|
||||
func NewActionUrl() connection.Row {
|
||||
|
|
@ -60,13 +60,13 @@ func (a *ActionUrl) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "action_url"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewActionUrl,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
Factory: NewActionUrl,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -22,15 +22,15 @@ var (
|
|||
)
|
||||
|
||||
type CheckCommand struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Command string `json:"command"`
|
||||
Timeout float32 `json:"timeout"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Command string `json:"command"`
|
||||
Timeout float32 `json:"timeout"`
|
||||
}
|
||||
|
||||
func NewCheckCommand() connection.Row {
|
||||
|
|
@ -79,14 +79,14 @@ func (c *CheckCommand) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "checkcommand"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommand,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommand,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "checkcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"argument_key",
|
||||
|
|
@ -26,19 +26,19 @@ var (
|
|||
)
|
||||
|
||||
type CheckCommandArgument struct {
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
ArgumentKey string `json:"argument_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ArgumentValue string `json:"value"`
|
||||
ArgumentOrder float32 `json:"order"`
|
||||
Description string `json:"description"`
|
||||
ArgumentKeyOverride string `json:"key"`
|
||||
RepeatKey bool `json:"repeat_key"`
|
||||
Required bool `json:"required"`
|
||||
SetIf string `json:"set_if"`
|
||||
SkipKey bool `json:"skip_key"`
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
ArgumentKey string `json:"argument_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ArgumentValue string `json:"value"`
|
||||
ArgumentOrder float32 `json:"order"`
|
||||
Description string `json:"description"`
|
||||
ArgumentKeyOverride string `json:"key"`
|
||||
RepeatKey bool `json:"repeat_key"`
|
||||
Required bool `json:"required"`
|
||||
SetIf string `json:"set_if"`
|
||||
SkipKey bool `json:"skip_key"`
|
||||
}
|
||||
|
||||
func NewCheckCommandArgument() connection.Row {
|
||||
|
|
@ -89,14 +89,14 @@ func (c *CheckCommandArgument) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "checkcommand_argument"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "checkcommand:argument",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommandArgument,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "checkcommand:argument",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommandArgument,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "checkcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type CheckCommandCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
CheckCommandId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
CheckCommandId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewCheckCommandCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *CheckCommandCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "checkcommand_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "checkcommand:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommandCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "checkcommand:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommandCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "checkcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"envvar_key",
|
||||
|
|
@ -19,12 +19,12 @@ var (
|
|||
)
|
||||
|
||||
type CheckCommandEnvvar struct {
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
EnvvarKey string `json:"envvar_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
EnvvarValue string `json:"value"`
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
EnvvarKey string `json:"envvar_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
EnvvarValue string `json:"value"`
|
||||
}
|
||||
|
||||
func NewCheckCommandEnvvar() connection.Row {
|
||||
|
|
@ -68,14 +68,14 @@ func (c *CheckCommandEnvvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "checkcommand_envvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "checkcommand:envvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommandEnvvar,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "checkcommand:envvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCheckCommandEnvvar,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "checkcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"object_type",
|
||||
|
|
@ -29,21 +29,21 @@ var (
|
|||
)
|
||||
|
||||
type Comment struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
ObjectType string `json:"object_type"`
|
||||
HostId string `json:"host_id"`
|
||||
ServiceId string `json:"service_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
Author string `json:"author"`
|
||||
Text string `json:"text"`
|
||||
EntryType float64 `json:"entry_type"`
|
||||
EntryTime float64 `json:"entry_time"`
|
||||
IsPersistent bool `json:"is_persistent"`
|
||||
ExpireTime float64 `json:"expire_time"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
ObjectType string `json:"object_type"`
|
||||
HostId string `json:"host_id"`
|
||||
ServiceId string `json:"service_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
Author string `json:"author"`
|
||||
Text string `json:"text"`
|
||||
EntryType float64 `json:"entry_type"`
|
||||
EntryTime float64 `json:"entry_time"`
|
||||
IsPersistent bool `json:"is_persistent"`
|
||||
ExpireTime float64 `json:"expire_time"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewComment() connection.Row {
|
||||
|
|
@ -97,14 +97,14 @@ func (c *Comment) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "comment"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "comment",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewComment,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "comment",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewComment,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "comment",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -18,11 +18,11 @@ var (
|
|||
)
|
||||
|
||||
type Customvar struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
func NewCustomvar() connection.Row {
|
||||
|
|
@ -66,13 +66,13 @@ func (c *Customvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
Factory: NewCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"customvar_id",
|
||||
|
|
@ -22,11 +22,11 @@ var (
|
|||
)
|
||||
|
||||
type CustomvarFlat struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
func NewCustomvarFlat() connection.Row {
|
||||
|
|
@ -93,7 +93,7 @@ func CollectScalarVars(c *CustomvarFlat, value interface{}, name string, path []
|
|||
flatValue := fmt.Sprintf("%v", v)
|
||||
return []connection.Row{
|
||||
&CustomvarFlatFinal{
|
||||
Id: utils.Checksum(c.EnvId + flatName + flatValue),
|
||||
Id: utils.Checksum(c.EnvId + flatName + flatValue),
|
||||
EnvId: c.EnvId,
|
||||
CustomvarId: c.Id,
|
||||
FlatNameChecksum: utils.Checksum(flatName),
|
||||
|
|
@ -105,12 +105,12 @@ func CollectScalarVars(c *CustomvarFlat, value interface{}, name string, path []
|
|||
}
|
||||
|
||||
type CustomvarFlatFinal struct {
|
||||
Id string
|
||||
EnvId string
|
||||
CustomvarId string
|
||||
FlatNameChecksum string
|
||||
FlatName string
|
||||
FlatValue string
|
||||
Id string
|
||||
EnvId string
|
||||
CustomvarId string
|
||||
FlatNameChecksum string
|
||||
FlatName string
|
||||
FlatValue string
|
||||
}
|
||||
|
||||
func (c *CustomvarFlatFinal) InsertValues() []interface{} {
|
||||
|
|
@ -149,13 +149,13 @@ func (c *CustomvarFlatFinal) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "customvar_flat"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "customvar",
|
||||
ObjectType: name,
|
||||
RedisKey: "customvar",
|
||||
PrimaryMySqlField: "customvar_id",
|
||||
Factory: NewCustomvarFlat,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "customvar_id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
Factory: NewCustomvarFlat,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "customvar_id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"object_type",
|
||||
|
|
@ -32,25 +32,25 @@ var (
|
|||
)
|
||||
|
||||
type Downtime struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
ObjectType string `json:"object_type"`
|
||||
HostId string `json:"host_id"`
|
||||
ServiceId string `json:"service_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
Author string `json:"author"`
|
||||
Comment string `json:"comment"`
|
||||
EntryTime float64 `json:"entry_time"`
|
||||
ScheduledStartTime float64 `json:"scheduled_start_time"`
|
||||
ScheduledEndTime float64 `json:"scheduled_end_time"`
|
||||
FlexibleDuration float64 `json:"flexible_duration"`
|
||||
IsFlexible bool `json:"is_flexible"`
|
||||
IsInEffect bool `json:"is_in_effect"`
|
||||
ActualStartTime float64 `json:"actual_start_time"`
|
||||
ActualEndTime float64 `json:"actual_end_time"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
ObjectType string `json:"object_type"`
|
||||
HostId string `json:"host_id"`
|
||||
ServiceId string `json:"service_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
Author string `json:"author"`
|
||||
Comment string `json:"comment"`
|
||||
EntryTime float64 `json:"entry_time"`
|
||||
ScheduledStartTime float64 `json:"scheduled_start_time"`
|
||||
ScheduledEndTime float64 `json:"scheduled_end_time"`
|
||||
FlexibleDuration float64 `json:"flexible_duration"`
|
||||
IsFlexible bool `json:"is_flexible"`
|
||||
IsInEffect bool `json:"is_in_effect"`
|
||||
ActualStartTime float64 `json:"actual_start_time"`
|
||||
ActualEndTime float64 `json:"actual_end_time"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewDowntime() connection.Row {
|
||||
|
|
@ -108,14 +108,14 @@ func (d *Downtime) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "downtime"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "downtime",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewDowntime,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "downtime",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewDowntime,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "downtime",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -20,13 +20,13 @@ var (
|
|||
)
|
||||
|
||||
type Endpoint struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewEndpoint() connection.Row {
|
||||
|
|
@ -73,14 +73,14 @@ func (e *Endpoint) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "endpoint"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEndpoint,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEndpoint,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "endpoint",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -22,15 +22,15 @@ var (
|
|||
)
|
||||
|
||||
type EventCommand struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Command string `json:"command"`
|
||||
Timeout float32 `json:"timeout"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Command string `json:"command"`
|
||||
Timeout float32 `json:"timeout"`
|
||||
}
|
||||
|
||||
func NewEventCommand() connection.Row {
|
||||
|
|
@ -79,14 +79,14 @@ func (c *EventCommand) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "eventcommand"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommand,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommand,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "eventcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"argument_key",
|
||||
|
|
@ -26,19 +26,19 @@ var (
|
|||
)
|
||||
|
||||
type EventCommandArgument struct {
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
ArgumentKey string `json:"argument_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ArgumentValue string `json:"value"`
|
||||
ArgumentOrder float32 `json:"order"`
|
||||
Description string `json:"description"`
|
||||
ArgumentKeyOverride string `json:"key"`
|
||||
RepeatKey bool `json:"repeat_key"`
|
||||
Required bool `json:"required"`
|
||||
SetIf string `json:"set_if"`
|
||||
SkipKey bool `json:"skip_key"`
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
ArgumentKey string `json:"argument_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ArgumentValue string `json:"value"`
|
||||
ArgumentOrder float32 `json:"order"`
|
||||
Description string `json:"description"`
|
||||
ArgumentKeyOverride string `json:"key"`
|
||||
RepeatKey bool `json:"repeat_key"`
|
||||
Required bool `json:"required"`
|
||||
SetIf string `json:"set_if"`
|
||||
SkipKey bool `json:"skip_key"`
|
||||
}
|
||||
|
||||
func NewEventCommandArgument() connection.Row {
|
||||
|
|
@ -89,14 +89,14 @@ func (c *EventCommandArgument) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "eventcommand_argument"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "eventcommand:argument",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommandArgument,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "eventcommand:argument",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommandArgument,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "eventcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type EventCommandCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
EventCommandId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
EventCommandId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewEventCommandCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *EventCommandCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "eventcommand_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "eventcommand:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommandCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "eventcommand:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommandCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "eventcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"envvar_key",
|
||||
|
|
@ -19,12 +19,12 @@ var (
|
|||
)
|
||||
|
||||
type EventCommandEnvvar struct {
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
EnvvarKey string `json:"envvar_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
EnvvarValue string `json:"value"`
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
EnvvarKey string `json:"envvar_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
EnvvarValue string `json:"value"`
|
||||
}
|
||||
|
||||
func NewEventCommandEnvvar() connection.Row {
|
||||
|
|
@ -68,14 +68,14 @@ func (c *EventCommandEnvvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "eventcommand_envvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "eventcommand:envvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommandEnvvar,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "eventcommand:envvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewEventCommandEnvvar,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "eventcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -175,14 +175,14 @@ func (h *Host) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "host"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHost,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHost,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "host",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"host_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type HostCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
HostId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
HostId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewHostCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (h *HostCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "host_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "host:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "host:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "host",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"host_id",
|
||||
"environment_id",
|
||||
"state_type",
|
||||
|
|
@ -42,35 +42,35 @@ var (
|
|||
)
|
||||
|
||||
type HostState struct {
|
||||
HostId string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
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 float32 `json:"previous_hard_state"`
|
||||
Attempt float32 `json:"check_attempt"`
|
||||
Severity float32 `json:"severity"`
|
||||
Output string `json:"output"`
|
||||
LongOutput string `json:"long_output"`
|
||||
PerformanceData string `json:"performance_data"`
|
||||
CheckCommandline string `json:"commandline"`
|
||||
IsProblem bool `json:"is_problem"`
|
||||
IsHandled bool `json:"is_handled"`
|
||||
IsReachable bool `json:"is_reachable"`
|
||||
IsFlapping bool `json:"is_flapping"`
|
||||
IsAcknowledged bool `json:"is_acknowledged"`
|
||||
AcknowledgementCommentId string `json:"acknowledgement_comment_id"`
|
||||
InDowntime bool `json:"in_downtime"`
|
||||
ExecutionTime float32 `json:"execution_time"`
|
||||
Latency float32 `json:"latency"`
|
||||
Timeout float32 `json:"check_timeout"`
|
||||
CheckSource string `json:"check_source"`
|
||||
LastUpdate float32 `json:"last_update"`
|
||||
LastStateChange float32 `json:"last_state_change"`
|
||||
LastSoftState float32 `json:"last_soft_state"`
|
||||
LastHardState float32 `json:"last_hard_state"`
|
||||
NextCheck float32 `json:"next_check"`
|
||||
NextUpdate float32 `json:"next_update"`
|
||||
HostId string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
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 float32 `json:"previous_hard_state"`
|
||||
Attempt float32 `json:"check_attempt"`
|
||||
Severity float32 `json:"severity"`
|
||||
Output string `json:"output"`
|
||||
LongOutput string `json:"long_output"`
|
||||
PerformanceData string `json:"performance_data"`
|
||||
CheckCommandline string `json:"commandline"`
|
||||
IsProblem bool `json:"is_problem"`
|
||||
IsHandled bool `json:"is_handled"`
|
||||
IsReachable bool `json:"is_reachable"`
|
||||
IsFlapping bool `json:"is_flapping"`
|
||||
IsAcknowledged bool `json:"is_acknowledged"`
|
||||
AcknowledgementCommentId string `json:"acknowledgement_comment_id"`
|
||||
InDowntime bool `json:"in_downtime"`
|
||||
ExecutionTime float32 `json:"execution_time"`
|
||||
Latency float32 `json:"latency"`
|
||||
Timeout float32 `json:"check_timeout"`
|
||||
CheckSource string `json:"check_source"`
|
||||
LastUpdate float32 `json:"last_update"`
|
||||
LastStateChange float32 `json:"last_state_change"`
|
||||
LastSoftState float32 `json:"last_soft_state"`
|
||||
LastHardState float32 `json:"last_hard_state"`
|
||||
NextCheck float32 `json:"next_check"`
|
||||
NextUpdate float32 `json:"next_update"`
|
||||
}
|
||||
|
||||
func NewHostState() connection.Row {
|
||||
|
|
@ -138,14 +138,14 @@ func (h *HostState) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "host_state"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "state:host",
|
||||
PrimaryMySqlField: "host_id",
|
||||
Factory: NewHostState,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "host_id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "state:host",
|
||||
PrimaryMySqlField: "host_id",
|
||||
Factory: NewHostState,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "host_id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "host",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -22,15 +22,15 @@ var (
|
|||
)
|
||||
|
||||
type Hostgroup struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewHostgroup() connection.Row {
|
||||
|
|
@ -79,14 +79,14 @@ func (h *Hostgroup) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "hostgroup"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostgroup,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostgroup,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "hostgroup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"hostgroup_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type HostgroupCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
HostgroupId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
HostgroupId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewHostgroupCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (h *HostgroupCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "hostgroup_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "hostgroup:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostgroupCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "hostgroup:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostgroupCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "hostgroup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"hostgroup_id",
|
||||
"host_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type HostgroupMember struct {
|
||||
Id string `json:"id"`
|
||||
HostgroupId string `json:"group_id"`
|
||||
HostId string `json:"object_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
HostgroupId string `json:"group_id"`
|
||||
HostId string `json:"object_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewHostgroupMember() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (h *HostgroupMember) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "hostgroup_member"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "host:groupmember",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostgroupMember,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "host:groupmember",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewHostgroupMember,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "host",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"icon_image",
|
||||
|
|
@ -16,9 +16,9 @@ var (
|
|||
)
|
||||
|
||||
type IconImage struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
IconImage string `json:"icon_image"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
IconImage string `json:"icon_image"`
|
||||
}
|
||||
|
||||
func NewIconImage() connection.Row {
|
||||
|
|
@ -60,13 +60,13 @@ func (a *IconImage) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "icon_image"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewIconImage,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
Factory: NewIconImage,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"notes_url",
|
||||
|
|
@ -16,9 +16,9 @@ var (
|
|||
)
|
||||
|
||||
type NotesUrl struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NotesUrl string `json:"notes_url"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NotesUrl string `json:"notes_url"`
|
||||
}
|
||||
|
||||
func NewNotesUrl() connection.Row {
|
||||
|
|
@ -60,13 +60,13 @@ func (a *NotesUrl) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notes_url"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotesUrl,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
Factory: NewNotesUrl,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -32,25 +32,25 @@ var (
|
|||
)
|
||||
|
||||
type Notification struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
UsersChecksum string `json:"users_checksum"`
|
||||
UsergroupsChecksum string `json:"usergroups_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
HostId string `json:"host_id"`
|
||||
ServiceId string `json:"service_id"`
|
||||
CommandId string `json:"command_id"`
|
||||
TimesBegin float32 `json:"times_begin"`
|
||||
TimesEnd float32 `json:"times_end"`
|
||||
NotificationInterval float32 `json:"notification_interval"`
|
||||
PeriodId string `json:"timeperiod_id"`
|
||||
States []string `json:"states"`
|
||||
Types []string `json:"types"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
UsersChecksum string `json:"users_checksum"`
|
||||
UsergroupsChecksum string `json:"usergroups_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
HostId string `json:"host_id"`
|
||||
ServiceId string `json:"service_id"`
|
||||
CommandId string `json:"command_id"`
|
||||
TimesBegin float32 `json:"times_begin"`
|
||||
TimesEnd float32 `json:"times_end"`
|
||||
NotificationInterval float32 `json:"notification_interval"`
|
||||
PeriodId string `json:"timeperiod_id"`
|
||||
States []string `json:"states"`
|
||||
Types []string `json:"types"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewNotification() connection.Row {
|
||||
|
|
@ -109,14 +109,14 @@ func (n *Notification) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notification"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotification,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotification,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notification",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"notification_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type NotificationCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
NotificationId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
NotificationId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewNotificationCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *NotificationCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notification_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "notification:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "notification:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notification",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"notification_id",
|
||||
"user_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type NotificationUser struct {
|
||||
Id string `json:"id"`
|
||||
NotificationId string `json:"notification_id"`
|
||||
UserId string `json:"user_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
NotificationId string `json:"notification_id"`
|
||||
UserId string `json:"user_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewNotificationUser() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (n *NotificationUser) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notification_user"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "notification:user",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationUser,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "notification:user",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationUser,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notification",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"notification_id",
|
||||
"usergroup_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type NotificationUsergroup struct {
|
||||
Id string `json:"id"`
|
||||
NotificationId string `json:"notification_id"`
|
||||
UsergroupId string `json:"usergroup_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
NotificationId string `json:"notification_id"`
|
||||
UsergroupId string `json:"usergroup_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewNotificationUsergroup() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (n *NotificationUsergroup) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notification_usergroup"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "notification:usergroup",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationUsergroup,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "notification:usergroup",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationUsergroup,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notification",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -22,15 +22,15 @@ var (
|
|||
)
|
||||
|
||||
type NotificationCommand struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Command string `json:"command"`
|
||||
Timeout float32 `json:"timeout"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Command string `json:"command"`
|
||||
Timeout float32 `json:"timeout"`
|
||||
}
|
||||
|
||||
func NewNotificationCommand() connection.Row {
|
||||
|
|
@ -79,14 +79,14 @@ func (c *NotificationCommand) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notificationcommand"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommand,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommand,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notificationcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"argument_key",
|
||||
|
|
@ -26,19 +26,19 @@ var (
|
|||
)
|
||||
|
||||
type NotificationCommandArgument struct {
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
ArgumentKey string `json:"argument_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ArgumentValue string `json:"value"`
|
||||
ArgumentOrder float32 `json:"order"`
|
||||
Description string `json:"description"`
|
||||
ArgumentKeyOverride string `json:"key"`
|
||||
RepeatKey bool `json:"repeat_key"`
|
||||
Required bool `json:"required"`
|
||||
SetIf string `json:"set_if"`
|
||||
SkipKey bool `json:"skip_key"`
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
ArgumentKey string `json:"argument_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ArgumentValue string `json:"value"`
|
||||
ArgumentOrder float32 `json:"order"`
|
||||
Description string `json:"description"`
|
||||
ArgumentKeyOverride string `json:"key"`
|
||||
RepeatKey bool `json:"repeat_key"`
|
||||
Required bool `json:"required"`
|
||||
SetIf string `json:"set_if"`
|
||||
SkipKey bool `json:"skip_key"`
|
||||
}
|
||||
|
||||
func NewNotificationCommandArgument() connection.Row {
|
||||
|
|
@ -89,14 +89,14 @@ func (c *NotificationCommandArgument) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notificationcommand_argument"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "notificationcommand:argument",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommandArgument,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "notificationcommand:argument",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommandArgument,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notificationcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type NotificationCommandCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
NotificationCommandId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
NotificationCommandId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewNotificationCommandCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *NotificationCommandCustomvar) GetFinalRows() ([]connection.Row, error)
|
|||
func init() {
|
||||
name := "notificationcommand_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "notificationcommand:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommandCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "notificationcommand:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommandCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notificationcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"command_id",
|
||||
"envvar_key",
|
||||
|
|
@ -19,12 +19,12 @@ var (
|
|||
)
|
||||
|
||||
type NotificationCommandEnvvar struct {
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
EnvvarKey string `json:"envvar_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
EnvvarValue string `json:"value"`
|
||||
Id string `json:"id"`
|
||||
CommandId string `json:"command_id"`
|
||||
EnvvarKey string `json:"envvar_key"`
|
||||
EnvId string `json:"environment_id"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
EnvvarValue string `json:"value"`
|
||||
}
|
||||
|
||||
func NewNotificationCommandEnvvar() connection.Row {
|
||||
|
|
@ -68,14 +68,14 @@ func (c *NotificationCommandEnvvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "notificationcommand_envvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "notificationcommand:envvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommandEnvvar,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "notificationcommand:envvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewNotificationCommandEnvvar,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "notificationcommand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -166,14 +166,14 @@ func (s *Service) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "service"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewService,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewService,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "service",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"service_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type ServiceCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
ServiceId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
ServiceId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewServiceCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *ServiceCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "service_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "service:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServiceCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "service:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServiceCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "service",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"service_id",
|
||||
"environment_id",
|
||||
"state_type",
|
||||
|
|
@ -42,35 +42,35 @@ var (
|
|||
)
|
||||
|
||||
type ServiceState struct {
|
||||
ServiceId string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
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 float32 `json:"previous_hard_state"`
|
||||
Attempt float32 `json:"check_attempt"`
|
||||
Severity float32 `json:"severity"`
|
||||
Output string `json:"output"`
|
||||
LongOutput string `json:"long_output"`
|
||||
PerformanceData string `json:"performance_data"`
|
||||
CheckCommandline string `json:"commandline"`
|
||||
IsProblem bool `json:"is_problem"`
|
||||
IsHandled bool `json:"is_handled"`
|
||||
IsReachable bool `json:"is_reachable"`
|
||||
IsFlapping bool `json:"is_flapping"`
|
||||
IsAcknowledged bool `json:"is_acknowledged"`
|
||||
AcknowledgementCommentId string `json:"acknowledgement_comment_id"`
|
||||
InDowntime bool `json:"in_downtime"`
|
||||
ExecutionTime float32 `json:"execution_time"`
|
||||
Latency float32 `json:"latency"`
|
||||
Timeout float32 `json:"check_timeout"`
|
||||
CheckSource string `json:"check_source"`
|
||||
LastUpdate float32 `json:"last_update"`
|
||||
LastStateChange float32 `json:"last_state_change"`
|
||||
LastSoftState float32 `json:"last_soft_state"`
|
||||
LastHardState float32 `json:"last_hard_state"`
|
||||
NextCheck float32 `json:"next_check"`
|
||||
NextUpdate float32 `json:"next_update"`
|
||||
ServiceId string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
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 float32 `json:"previous_hard_state"`
|
||||
Attempt float32 `json:"check_attempt"`
|
||||
Severity float32 `json:"severity"`
|
||||
Output string `json:"output"`
|
||||
LongOutput string `json:"long_output"`
|
||||
PerformanceData string `json:"performance_data"`
|
||||
CheckCommandline string `json:"commandline"`
|
||||
IsProblem bool `json:"is_problem"`
|
||||
IsHandled bool `json:"is_handled"`
|
||||
IsReachable bool `json:"is_reachable"`
|
||||
IsFlapping bool `json:"is_flapping"`
|
||||
IsAcknowledged bool `json:"is_acknowledged"`
|
||||
AcknowledgementCommentId string `json:"acknowledgement_comment_id"`
|
||||
InDowntime bool `json:"in_downtime"`
|
||||
ExecutionTime float32 `json:"execution_time"`
|
||||
Latency float32 `json:"latency"`
|
||||
Timeout float32 `json:"check_timeout"`
|
||||
CheckSource string `json:"check_source"`
|
||||
LastUpdate float32 `json:"last_update"`
|
||||
LastStateChange float32 `json:"last_state_change"`
|
||||
LastSoftState float32 `json:"last_soft_state"`
|
||||
LastHardState float32 `json:"last_hard_state"`
|
||||
NextCheck float32 `json:"next_check"`
|
||||
NextUpdate float32 `json:"next_update"`
|
||||
}
|
||||
|
||||
func NewServiceState() connection.Row {
|
||||
|
|
@ -138,14 +138,14 @@ func (s *ServiceState) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "service_state"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "state:service",
|
||||
PrimaryMySqlField: "service_id",
|
||||
Factory: NewServiceState,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "service_id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "state:service",
|
||||
PrimaryMySqlField: "service_id",
|
||||
Factory: NewServiceState,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "service_id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "service",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -22,15 +22,15 @@ var (
|
|||
)
|
||||
|
||||
type Servicegroup struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewServicegroup() connection.Row {
|
||||
|
|
@ -79,14 +79,14 @@ func (s *Servicegroup) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "servicegroup"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServicegroup,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServicegroup,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "servicegroup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"servicegroup_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type ServicegroupCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
ServicegroupId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
ServicegroupId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewServicegroupCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *ServicegroupCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "servicegroup_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "servicegroup:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServicegroupCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "servicegroup:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServicegroupCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "servicegroup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"servicegroup_id",
|
||||
"service_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type ServicegroupMember struct {
|
||||
Id string `json:"id"`
|
||||
ServicegroupId string `json:"group_id"`
|
||||
ServiceId string `json:"object_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
ServicegroupId string `json:"group_id"`
|
||||
ServiceId string `json:"object_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewServicegroupMember() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (s *ServicegroupMember) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "servicegroup_member"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "service:groupmember",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServicegroupMember,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "service:groupmember",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewServicegroupMember,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "service",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -22,15 +22,15 @@ var (
|
|||
)
|
||||
|
||||
type Timeperiod struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
PreferIncludes bool `json:"prefer_includes"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
PreferIncludes bool `json:"prefer_includes"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewTimeperiod() connection.Row {
|
||||
|
|
@ -79,14 +79,14 @@ func (t *Timeperiod) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "timeperiod"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiod,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiod,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "timeperiod",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"timeperiod_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type TimeperiodCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewTimeperiodCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *TimeperiodCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "timeperiod_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "timeperiod",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"timeperiod_id",
|
||||
"override_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type TimeperiodOverrideExclude struct {
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"timeperiod_id"`
|
||||
OverrideId string `json:"exclude_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"timeperiod_id"`
|
||||
OverrideId string `json:"exclude_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewTimeperiodOverrideExclude() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (t *TimeperiodOverrideExclude) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "timeperiod_override_exclude"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:override:exclude",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodOverrideExclude,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:override:exclude",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodOverrideExclude,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "timeperiod",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"timeperiod_id",
|
||||
"override_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type TimeperiodOverrideInclude struct {
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"timeperiod_id"`
|
||||
OverrideId string `json:"include_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"timeperiod_id"`
|
||||
OverrideId string `json:"include_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewTimeperiodOverrideInclude() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (t *TimeperiodOverrideInclude) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "timeperiod_override_include"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:override:include",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodOverrideInclude,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:override:include",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodOverrideInclude,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "timeperiod",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"timeperiod_id",
|
||||
"range_key",
|
||||
|
|
@ -18,11 +18,11 @@ var (
|
|||
)
|
||||
|
||||
type TimeperiodRange struct {
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"timeperiod_id"`
|
||||
RangeKey string `json:"range_key"`
|
||||
RangeValue string `json:"range_value"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
TimeperiodId string `json:"timeperiod_id"`
|
||||
RangeKey string `json:"range_key"`
|
||||
RangeValue string `json:"range_value"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewTimeperiodRange() connection.Row {
|
||||
|
|
@ -65,14 +65,14 @@ func (t *TimeperiodRange) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "timeperiod_range"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:range",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodRange,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "timeperiod:range",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewTimeperiodRange,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "timeperiod",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -29,22 +29,22 @@ var (
|
|||
)
|
||||
|
||||
type User struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
GroupsChecksum string `json:"groups_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
EMail string `json:"email"`
|
||||
Pager string `json:"pager"`
|
||||
NotificationsEnabled bool `json:"notifications_enabled"`
|
||||
PeriodId string `json:"timeperiod_id"`
|
||||
States []string `json:"states"`
|
||||
Types []string `json:"types"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
GroupsChecksum string `json:"groups_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
EMail string `json:"email"`
|
||||
Pager string `json:"pager"`
|
||||
NotificationsEnabled bool `json:"notifications_enabled"`
|
||||
PeriodId string `json:"timeperiod_id"`
|
||||
States []string `json:"states"`
|
||||
Types []string `json:"types"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewUser() connection.Row {
|
||||
|
|
@ -100,14 +100,14 @@ func (u *User) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "user"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUser,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUser,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "user",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"user_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type UserCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
UserId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
UserId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewUserCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *UserCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "user_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "user:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUserCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "user:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUserCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "user",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -22,15 +22,15 @@ var (
|
|||
)
|
||||
|
||||
type Usergroup struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
CustomvarsChecksum string `json:"customvars_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
DisplayName string `json:"display_name"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
}
|
||||
|
||||
func NewUsergroup() connection.Row {
|
||||
|
|
@ -79,14 +79,14 @@ func (u *Usergroup) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "usergroup"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUsergroup,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUsergroup,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "usergroup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"usergroup_id",
|
||||
"customvar_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type UsergroupCustomvar struct {
|
||||
Id string `json:"id"`
|
||||
UsergroupId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
UsergroupId string `json:"object_id"`
|
||||
CustomvarId string `json:"customvar_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewUsergroupCustomvar() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (c *UsergroupCustomvar) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "usergroup_customvar"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "usergroup:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUsergroupCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "usergroup:customvar",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUsergroupCustomvar,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "usergroup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"usergroup_id",
|
||||
"user_id",
|
||||
|
|
@ -17,10 +17,10 @@ var (
|
|||
)
|
||||
|
||||
type UsergroupMember struct {
|
||||
Id string `json:"id"`
|
||||
UsergroupId string `json:"group_id"`
|
||||
UserId string `json:"user_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
Id string `json:"id"`
|
||||
UsergroupId string `json:"group_id"`
|
||||
UserId string `json:"user_id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
}
|
||||
|
||||
func NewUsergroupMember() connection.Row {
|
||||
|
|
@ -62,14 +62,14 @@ func (u *UsergroupMember) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "usergroup_member"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: "user:groupmember",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUsergroupMember,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: "user:groupmember",
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewUsergroupMember,
|
||||
HasChecksum: false,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "user",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
var (
|
||||
ObjectInformation configobject.ObjectInformation
|
||||
Fields = []string{
|
||||
Fields = []string{
|
||||
"id",
|
||||
"environment_id",
|
||||
"name_checksum",
|
||||
|
|
@ -23,16 +23,16 @@ var (
|
|||
)
|
||||
|
||||
type Zone struct {
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ParentsChecksum string `json:"parents_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
IsGlobal bool `json:"is_global"`
|
||||
ParentId string `json:"parent_id"`
|
||||
Depth float64 `json:"depth"`
|
||||
Id string `json:"id"`
|
||||
EnvId string `json:"environment_id"`
|
||||
NameChecksum string `json:"name_checksum"`
|
||||
PropertiesChecksum string `json:"checksum"`
|
||||
ParentsChecksum string `json:"parents_checksum"`
|
||||
Name string `json:"name"`
|
||||
NameCi *string `json:"name_ci"`
|
||||
IsGlobal bool `json:"is_global"`
|
||||
ParentId string `json:"parent_id"`
|
||||
Depth float64 `json:"depth"`
|
||||
}
|
||||
|
||||
func NewZone() connection.Row {
|
||||
|
|
@ -82,14 +82,14 @@ func (z *Zone) GetFinalRows() ([]connection.Row, error) {
|
|||
func init() {
|
||||
name := "zone"
|
||||
ObjectInformation = configobject.ObjectInformation{
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewZone,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
ObjectType: name,
|
||||
RedisKey: name,
|
||||
PrimaryMySqlField: "id",
|
||||
Factory: NewZone,
|
||||
HasChecksum: true,
|
||||
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
|
||||
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
|
||||
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
|
||||
NotificationListenerType: "zone",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ var mysqlObservers = func() (mysqlObservers map[string]prometheus.Observer) {
|
|||
func StartStateSync(super *supervisor.Supervisor) {
|
||||
go func() {
|
||||
for {
|
||||
syncStates(super,"host")
|
||||
syncStates(super, "host")
|
||||
}
|
||||
}()
|
||||
|
||||
go func() {
|
||||
for {
|
||||
syncStates(super,"service")
|
||||
syncStates(super, "service")
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ func logSyncCounters() {
|
|||
func syncStates(super *supervisor.Supervisor, objectType string) {
|
||||
if super.EnvId == nil {
|
||||
log.Debug("StateSync: Waiting for EnvId to be set")
|
||||
<- time.NewTimer(time.Second).C
|
||||
<-time.NewTimer(time.Second).C
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -138,9 +138,9 @@ func syncStates(super *supervisor.Supervisor, objectType string) {
|
|||
|
||||
if errExec != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"context": "StateSync",
|
||||
"context": "StateSync",
|
||||
"objectType": objectType,
|
||||
"state": values,
|
||||
"state": values,
|
||||
}).Error(errExec)
|
||||
|
||||
states = removeStateFromStatesSlice(states, i)
|
||||
|
|
@ -166,7 +166,7 @@ func syncStates(super *supervisor.Supervisor, objectType string) {
|
|||
//Delete synced states from redis stream
|
||||
super.Rdbw.XDel("icinga:state:stream:"+objectType, storedStateIds...)
|
||||
|
||||
log.Debugf("%d %s state synced", len(storedStateIds) - brokenStates, objectType)
|
||||
log.Debugf("%d %s state synced", len(storedStateIds)-brokenStates, objectType)
|
||||
log.Debugf("%d %s state broken", brokenStates, objectType)
|
||||
syncCounterLock.Lock()
|
||||
syncCounter[objectType] += len(storedStateIds)
|
||||
|
|
|
|||
|
|
@ -81,10 +81,10 @@ func NewDBWrapper(dbDsn string, maxOpenConns int) (*DBWrapper, error) {
|
|||
|
||||
// Database wrapper including helper functions
|
||||
type DBWrapper struct {
|
||||
Db DbClient
|
||||
ConnectedAtomic *uint32 //uint32 to be able to use atomic operations
|
||||
ConnectionUpCondition *sync.Cond
|
||||
ConnectionLostCounterAtomic *uint32 //uint32 to be able to use atomic operations
|
||||
Db DbClient
|
||||
ConnectedAtomic *uint32 //uint32 to be able to use atomic operations
|
||||
ConnectionUpCondition *sync.Cond
|
||||
ConnectionLostCounterAtomic *uint32 //uint32 to be able to use atomic operations
|
||||
}
|
||||
|
||||
func (dbw *DBWrapper) IsConnected() bool {
|
||||
|
|
@ -369,7 +369,6 @@ func (dbw *DBWrapper) sqlExecInternal(db DbClientOrTransaction, opObserver prome
|
|||
}).Debug("Finished Exec")
|
||||
}
|
||||
|
||||
|
||||
if err != nil {
|
||||
if !dbw.checkConnection(false) {
|
||||
continue
|
||||
|
|
@ -571,7 +570,6 @@ func (dbw *DBWrapper) SqlFetchIds(envId []byte, table string, field string) ([]s
|
|||
[]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
)
|
||||
|
||||
|
||||
if err != nil {
|
||||
if !dbw.checkConnection(false) {
|
||||
continue
|
||||
|
|
@ -747,4 +745,4 @@ func (dbw *DBWrapper) SqlBulkUpdate(rows []Row, stmt *BulkUpdateStmt) error {
|
|||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ func TestDBWrapper_SqlCommit(t *testing.T) {
|
|||
mockTx := new(TransactionMock)
|
||||
|
||||
mockTx.On("Commit").Return(errors.New("whoops")).Once()
|
||||
mockTx.On("Commit").Return( nil).Once()
|
||||
mockTx.On("Commit").Return(nil).Once()
|
||||
mockDb.On("Ping").Return(errors.New("whoops")).Once()
|
||||
|
||||
var err error
|
||||
|
|
@ -128,7 +128,7 @@ func TestDBWrapper_SqlCommit(t *testing.T) {
|
|||
dbw.CompareAndSetConnected(true)
|
||||
dbw.ConnectionUpCondition.Broadcast()
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
mockTx.AssertExpectations(t)
|
||||
|
|
@ -157,7 +157,7 @@ func TestDBWrapper_SqlBegin(t *testing.T) {
|
|||
dbw.CompareAndSetConnected(true)
|
||||
dbw.ConnectionUpCondition.Broadcast()
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
mockDb.AssertExpectations(t)
|
||||
|
|
@ -243,7 +243,7 @@ func TestDBWrapper_SqlQuery(t *testing.T) {
|
|||
dbw.CompareAndSetConnected(true)
|
||||
dbw.ConnectionUpCondition.Broadcast()
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
mockDb.AssertExpectations(t)
|
||||
|
|
@ -273,7 +273,7 @@ func TestDBWrapper_SqlExec(t *testing.T) {
|
|||
dbw.CompareAndSetConnected(true)
|
||||
dbw.ConnectionUpCondition.Broadcast()
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
mockDb.AssertExpectations(t)
|
||||
|
|
@ -349,10 +349,10 @@ func TestDBWrapper_SqlFetchAll(t *testing.T) {
|
|||
|
||||
dbw.checkConnection(true)
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, [][]interface {}([][]interface {}{{int64(1), "horst"}, {int64(2), "test"}}), res)
|
||||
assert.Equal(t, [][]interface{}([][]interface{}{{int64(1), "horst"}, {int64(2), "test"}}), res)
|
||||
|
||||
_, err = dbw.Db.Exec("DROP TABLE testing0815")
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -443,4 +443,3 @@ func TestDBWrapper_SqlFetchChecksums(t *testing.T) {
|
|||
_, err = dbw.Db.Exec("DROP TABLE testing0815")
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,4 +429,4 @@ type Row interface {
|
|||
GetFinalRows() ([]Row, error)
|
||||
}
|
||||
|
||||
type RowFactory func() Row
|
||||
type RowFactory func() Row
|
||||
|
|
|
|||
|
|
@ -101,4 +101,4 @@ func TestMysqlConnectionError_Error(t *testing.T) {
|
|||
|
||||
func TestFormatLogQuery(t *testing.T) {
|
||||
assert.Equal(t, "This is my string", formatLogQuery("\tThis is\nmy string\n"))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,5 +67,3 @@ var DbBulkDeletes = promauto.NewCounter(prometheus.CounterOpts{
|
|||
Name: "db_bulk_deletes",
|
||||
Help: "Database bulk deletes since startup",
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -114,13 +114,13 @@ func NewRDBWrapper(address string, poolSize int) *RDBWrapper {
|
|||
}
|
||||
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Network: net,
|
||||
Addr: address,
|
||||
DialTimeout: time.Minute / 2,
|
||||
ReadTimeout: time.Minute,
|
||||
WriteTimeout: time.Minute,
|
||||
PoolTimeout: time.Minute,
|
||||
PoolSize: poolSize,
|
||||
Network: net,
|
||||
Addr: address,
|
||||
DialTimeout: time.Minute / 2,
|
||||
ReadTimeout: time.Minute,
|
||||
WriteTimeout: time.Minute,
|
||||
PoolTimeout: time.Minute,
|
||||
PoolSize: poolSize,
|
||||
})
|
||||
|
||||
rdbw := RDBWrapper{
|
||||
|
|
@ -285,7 +285,7 @@ func (rdbw *RDBWrapper) HKeys(key string) *redis.StringSliceCmd {
|
|||
}
|
||||
}
|
||||
|
||||
func (rdbw * RDBWrapper) HMGet(key string, fields ...string) *redis.SliceCmd {
|
||||
func (rdbw *RDBWrapper) HMGet(key string, fields ...string) *redis.SliceCmd {
|
||||
for {
|
||||
if !rdbw.IsConnected() {
|
||||
rdbw.WaitForConnection()
|
||||
|
|
@ -487,4 +487,3 @@ func (rdbw *RDBWrapper) PipeChecksumChunks(done <-chan struct{}, keys []string,
|
|||
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package connection
|
|||
import "github.com/go-redis/redis"
|
||||
|
||||
type PipelinerWrapper struct {
|
||||
pipeliner redis.Pipeliner
|
||||
rdbw *RDBWrapper
|
||||
pipeliner redis.Pipeliner
|
||||
rdbw *RDBWrapper
|
||||
}
|
||||
|
||||
func (plw *PipelinerWrapper) Exec() ([]redis.Cmder, error) {
|
||||
|
|
@ -44,4 +44,4 @@ func (plw *PipelinerWrapper) HMGet(key string, fields ...string) *redis.SliceCmd
|
|||
|
||||
return cmd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import (
|
|||
)
|
||||
|
||||
type PubSubWrapper struct {
|
||||
ps *redis.PubSub
|
||||
rdbw *RDBWrapper
|
||||
ps *redis.PubSub
|
||||
rdbw *RDBWrapper
|
||||
}
|
||||
|
||||
func (psw *PubSubWrapper) Subscribe(channels ...string) error {
|
||||
|
|
@ -68,4 +68,4 @@ func (psw *PubSubWrapper) Close() error {
|
|||
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ func TestPubSubWrapper(t *testing.T) {
|
|||
rdbw.CompareAndSetConnected(false)
|
||||
|
||||
var errSubscribe error
|
||||
done1:= make(chan bool)
|
||||
go func () {
|
||||
done1 := make(chan bool)
|
||||
go func() {
|
||||
errSubscribe = ps.Subscribe("testchannel")
|
||||
done1 <- true
|
||||
}()
|
||||
|
|
@ -39,7 +39,7 @@ func TestPubSubWrapper(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
rdbw.CheckConnection(true)
|
||||
|
||||
<- done1
|
||||
<-done1
|
||||
|
||||
rdbw.CompareAndSetConnected(false)
|
||||
|
||||
|
|
@ -56,13 +56,13 @@ func TestPubSubWrapper(t *testing.T) {
|
|||
|
||||
rdbw.Publish("testchannel", "Hello there")
|
||||
|
||||
<- done2
|
||||
<-done2
|
||||
|
||||
rdbw.CompareAndSetConnected(false)
|
||||
|
||||
var errClose error
|
||||
done3:= make(chan bool)
|
||||
go func () {
|
||||
done3 := make(chan bool)
|
||||
go func() {
|
||||
errClose = ps.Close()
|
||||
done3 <- true
|
||||
}()
|
||||
|
|
@ -70,10 +70,10 @@ func TestPubSubWrapper(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
rdbw.CheckConnection(true)
|
||||
|
||||
<- done3
|
||||
<-done3
|
||||
|
||||
assert.NoError(t, errSubscribe)
|
||||
assert.NoError(t, errReceive)
|
||||
assert.NoError(t, errClose)
|
||||
assert.Equal(t, "Hello there", msg.Payload)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ func TestRDBWrapper_HGetAll(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
rdbw.CheckConnection(true)
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, data, "one")
|
||||
|
|
@ -228,7 +228,7 @@ func TestRDBWrapper_XRead(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
rdbw.CheckConnection(true)
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
streams, err := data.Result()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -269,7 +269,7 @@ func TestRDBWrapper_XDel(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
rdbw.CheckConnection(true)
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
data := rdbw.XRead(&redis.XReadArgs{Streams: []string{"teststream", "0"}, Block: -1})
|
||||
streams, err := data.Result()
|
||||
|
|
@ -304,14 +304,14 @@ func TestRDBWrapper_Publish(t *testing.T) {
|
|||
|
||||
rdbw.CompareAndSetConnected(false)
|
||||
|
||||
go func () {
|
||||
go func() {
|
||||
rdbw.Publish("testchannel", "Hello there")
|
||||
}()
|
||||
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
rdbw.CheckConnection(true)
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "Hello there", msg.Payload)
|
||||
|
|
@ -357,7 +357,7 @@ func TestRDBWrapper_TxPipelined(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
rdbw.CheckConnection(true)
|
||||
|
||||
<- done
|
||||
<-done
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, firstMap.Val(), "foo")
|
||||
|
|
@ -388,7 +388,7 @@ func TestRDBWrapper_PipeConfigChunks(t *testing.T) {
|
|||
rdb.HSet("icinga:checksum:testkey", "123534534fsdf12sdas12312adg23423f", "this-should-be-the-checksum")
|
||||
|
||||
chChunk := rdbw.PipeConfigChunks(make(chan struct{}), []string{"123534534fsdf12sdas12312adg23423f"}, "testkey")
|
||||
chunk := <- chChunk
|
||||
chunk := <-chChunk
|
||||
assert.Equal(t, "this-should-be-the-config", chunk.Configs[0])
|
||||
assert.Equal(t, "this-should-be-the-checksum", chunk.Checksums[0])
|
||||
}
|
||||
|
|
@ -415,6 +415,6 @@ func TestRDBWrapper_PipeChecksumChunks(t *testing.T) {
|
|||
rdb.HSet("icinga:checksum:testkey", "123534534fsdf12sdas12312adg23423f", "this-should-be-the-checksum")
|
||||
|
||||
chChunk := rdbw.PipeChecksumChunks(make(chan struct{}), []string{"123534534fsdf12sdas12312adg23423f"}, "testkey")
|
||||
chunk := <- chChunk
|
||||
chunk := <-chChunk
|
||||
assert.Equal(t, "this-should-be-the-checksum", chunk.Checksums[0])
|
||||
}
|
||||
|
|
|
|||
30
ha/ha.go
30
ha/ha.go
|
|
@ -20,24 +20,24 @@ const (
|
|||
)
|
||||
|
||||
type HA struct {
|
||||
isActive bool
|
||||
lastHeartbeat int64
|
||||
uid uuid.UUID
|
||||
super *supervisor.Supervisor
|
||||
notificationListeners map[string][]chan int
|
||||
notificationListenersMutex sync.Mutex
|
||||
lastEventId string
|
||||
logger *log.Entry
|
||||
heartbeatTimer *time.Timer
|
||||
isActive bool
|
||||
lastHeartbeat int64
|
||||
uid uuid.UUID
|
||||
super *supervisor.Supervisor
|
||||
notificationListeners map[string][]chan int
|
||||
notificationListenersMutex sync.Mutex
|
||||
lastEventId string
|
||||
logger *log.Entry
|
||||
heartbeatTimer *time.Timer
|
||||
}
|
||||
|
||||
func NewHA(super *supervisor.Supervisor) (*HA, error) {
|
||||
var err error
|
||||
ho := HA{
|
||||
super: super,
|
||||
notificationListeners: make(map[string][]chan int),
|
||||
super: super,
|
||||
notificationListeners: make(map[string][]chan int),
|
||||
notificationListenersMutex: sync.Mutex{},
|
||||
lastEventId: "0-0",
|
||||
lastEventId: "0-0",
|
||||
}
|
||||
|
||||
if ho.uid, err = uuid.NewRandom(); err != nil {
|
||||
|
|
@ -68,14 +68,14 @@ func (h *HA) updateOwnInstance() error {
|
|||
func (h *HA) takeOverInstance() error {
|
||||
_, err := h.super.Dbw.SqlExec(mysqlObservers.updateIcingadbInstanceByEnvironmentId,
|
||||
"UPDATE icingadb_instance SET id = ?, heartbeat = ? WHERE environment_id = ?",
|
||||
h.uid[:], h.lastHeartbeat, h.super.EnvId)
|
||||
h.uid[:], h.lastHeartbeat, h.super.EnvId)
|
||||
return err
|
||||
}
|
||||
|
||||
func (h *HA) insertInstance() error {
|
||||
_, err := h.super.Dbw.SqlExec(mysqlObservers.insertIntoIcingadbInstance,
|
||||
"INSERT INTO icingadb_instance(id, environment_id, heartbeat, responsible) VALUES (?, ?, ?, 'y')",
|
||||
h.uid[:], h.super.EnvId, h.lastHeartbeat)
|
||||
h.uid[:], h.super.EnvId, h.lastHeartbeat)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ func (h *HA) RegisterNotificationListener(listenerType string) chan int {
|
|||
}
|
||||
|
||||
func (h *HA) notifyNotificationListener(listenerType string, msg int) {
|
||||
for t, chs := range h.notificationListeners {
|
||||
for t, chs := range h.notificationListeners {
|
||||
if t == listenerType || listenerType == "*" {
|
||||
for _, c := range chs {
|
||||
c <- msg
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ func createTestingHA(t *testing.T, redisAddr, mysqlHost string) *HA {
|
|||
}
|
||||
|
||||
super := supervisor.Supervisor{
|
||||
ChErr: make(chan error),
|
||||
Rdbw: redisConn,
|
||||
Dbw: mysqlConn,
|
||||
ChErr: make(chan error),
|
||||
Rdbw: redisConn,
|
||||
Dbw: mysqlConn,
|
||||
}
|
||||
|
||||
ha, _ := NewHA(&super)
|
||||
|
|
@ -42,8 +42,8 @@ func createTestingHA(t *testing.T, redisAddr, mysqlHost string) *HA {
|
|||
require.NoError(t, err, "This test needs a working MySQL connection!")
|
||||
|
||||
ha.logger = log.WithFields(log.Fields{
|
||||
"context": "HA-Testing",
|
||||
"UUID": ha.uid,
|
||||
"context": "HA-Testing",
|
||||
"UUID": ha.uid,
|
||||
})
|
||||
|
||||
return ha
|
||||
|
|
@ -256,23 +256,23 @@ func TestHA_runHA(t *testing.T) {
|
|||
hash2 := sha1.New()
|
||||
hash2.Write([]byte("perp"))
|
||||
|
||||
go func () {
|
||||
go func() {
|
||||
chEnv <- &Environment{ID: hash2.Sum(nil)}
|
||||
}()
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
|
||||
go func () {
|
||||
go func() {
|
||||
timer := time.NewTimer(time.Second)
|
||||
select {
|
||||
case err := <-ha.super.ChErr:
|
||||
assert.Error(t, err, "runHA() should return an error on environment change")
|
||||
case <-timer.C:
|
||||
assert.Fail(t,"runHA() should return an error on environment change")
|
||||
assert.Fail(t, "runHA() should return an error on environment change")
|
||||
}
|
||||
|
||||
wg.Done();
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
ha.runHA(chEnv)
|
||||
|
|
@ -313,8 +313,8 @@ func TestHA_NotificationListeners(t *testing.T) {
|
|||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
|
||||
go func () {
|
||||
assert.Equal(t, Notify_StartSync, <- chHost)
|
||||
go func() {
|
||||
assert.Equal(t, Notify_StartSync, <-chHost)
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
|
|
@ -324,8 +324,8 @@ func TestHA_NotificationListeners(t *testing.T) {
|
|||
chService := ha.RegisterNotificationListener("service")
|
||||
wg.Add(1)
|
||||
|
||||
go func () {
|
||||
assert.Equal(t, Notify_StartSync, <- chService)
|
||||
go func() {
|
||||
assert.Equal(t, Notify_StartSync, <-chService)
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
|
|
@ -334,9 +334,9 @@ func TestHA_NotificationListeners(t *testing.T) {
|
|||
|
||||
wg.Add(1)
|
||||
|
||||
go func () {
|
||||
assert.Equal(t, Notify_StartSync, <- chService)
|
||||
assert.Equal(t, Notify_StartSync, <- chHost)
|
||||
go func() {
|
||||
assert.Equal(t, Notify_StartSync, <-chService)
|
||||
assert.Equal(t, Notify_StartSync, <-chHost)
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
|
|
@ -383,17 +383,17 @@ func TestHA_EventListener(t *testing.T) {
|
|||
wg.Add(2)
|
||||
|
||||
go func() {
|
||||
assert.Equal(t, Notify_StartSync, <- chHost)
|
||||
assert.Equal(t, Notify_StopSync, <- chHost)
|
||||
assert.Equal(t, Notify_StartSync, <- chHost)
|
||||
assert.Equal(t, Notify_StopSync, <- chHost)
|
||||
assert.Equal(t, Notify_StartSync, <-chHost)
|
||||
assert.Equal(t, Notify_StopSync, <-chHost)
|
||||
assert.Equal(t, Notify_StartSync, <-chHost)
|
||||
assert.Equal(t, Notify_StopSync, <-chHost)
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
go func() {
|
||||
assert.Equal(t, Notify_StartSync, <- chService)
|
||||
assert.Equal(t, Notify_StopSync, <- chService)
|
||||
assert.Equal(t, Notify_StartSync, <- chService)
|
||||
assert.Equal(t, Notify_StartSync, <-chService)
|
||||
assert.Equal(t, Notify_StopSync, <-chService)
|
||||
assert.Equal(t, Notify_StartSync, <-chService)
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
|
|
@ -404,4 +404,4 @@ func TestHA_EventListener(t *testing.T) {
|
|||
client.XAdd(&redis.XAddArgs{Stream: "icinga:dump", Values: map[string]interface{}{"type": "service", "state": "done"}})
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,10 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
||||
type Environment struct {
|
||||
ID []byte
|
||||
Name string
|
||||
NodeName string
|
||||
ID []byte
|
||||
Name string
|
||||
NodeName string
|
||||
}
|
||||
|
||||
// Compute SHA1
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ type JsonDecodePackage struct {
|
|||
|
||||
type JsonDecodePackages struct {
|
||||
Packages []JsonDecodePackage
|
||||
ChBack chan<- []connection.Row
|
||||
ChBack chan<- []connection.Row
|
||||
}
|
||||
|
||||
// decodeString unmarshals the string toDecode using the json package. The decoded json will be written to row.
|
||||
|
|
@ -58,7 +58,7 @@ func decodePackage(chInput <-chan *JsonDecodePackages) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if pkg.ConfigRaw != ""{
|
||||
if pkg.ConfigRaw != "" {
|
||||
if err = decodeString(pkg.ConfigRaw, row); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -71,4 +71,4 @@ func decodePackage(chInput <-chan *JsonDecodePackages) error {
|
|||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import (
|
|||
)
|
||||
|
||||
type Supervisor struct {
|
||||
ChErr chan error
|
||||
ChDecode chan *jsondecoder.JsonDecodePackages
|
||||
Rdbw *connection.RDBWrapper
|
||||
Dbw *connection.DBWrapper
|
||||
EnvId []byte
|
||||
EnvLock *sync.Mutex
|
||||
}
|
||||
ChErr chan error
|
||||
ChDecode chan *jsondecoder.JsonDecodePackages
|
||||
Rdbw *connection.RDBWrapper
|
||||
Dbw *connection.DBWrapper
|
||||
EnvId []byte
|
||||
EnvLock *sync.Mutex
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,4 +31,4 @@ func TestBenchmark(t *testing.T) {
|
|||
|
||||
by, _ := benchmarc.MarshalText()
|
||||
assert.Equal(t, []uint8([]byte{0x31, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x73}), by)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,23 +12,23 @@ var (
|
|||
false: "n",
|
||||
}
|
||||
NotificationStates = map[string]int{
|
||||
"OK": 1,
|
||||
"Warning": 2,
|
||||
"OK": 1,
|
||||
"Warning": 2,
|
||||
"Critical": 4,
|
||||
"Unknown": 8,
|
||||
"Up": 16,
|
||||
"Down": 32,
|
||||
"Unknown": 8,
|
||||
"Up": 16,
|
||||
"Down": 32,
|
||||
}
|
||||
NotificationTypes = map[string]int{
|
||||
"DowntimeStart": 1,
|
||||
"DowntimeEnd": 2,
|
||||
"DowntimeRemoved": 4,
|
||||
"Custom": 8,
|
||||
"Acknowledgement": 16,
|
||||
"Problem": 32,
|
||||
"Recovery": 64,
|
||||
"FlappingStart": 128,
|
||||
"FlappingEnd": 256,
|
||||
"DowntimeStart": 1,
|
||||
"DowntimeEnd": 2,
|
||||
"DowntimeRemoved": 4,
|
||||
"Custom": 8,
|
||||
"Acknowledgement": 16,
|
||||
"Problem": 32,
|
||||
"Recovery": 64,
|
||||
"FlappingStart": 128,
|
||||
"FlappingEnd": 256,
|
||||
}
|
||||
CommentEntryTypes = map[string]string{
|
||||
"1": "comment",
|
||||
|
|
@ -110,4 +110,4 @@ func RedisIntToDBBoolean(value interface{}) string {
|
|||
} else { //Should catch empty strings and nil
|
||||
return "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,16 +27,16 @@ func TestChecksum(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNotificationTypesToBitMask(t *testing.T) {
|
||||
assert.Equal(t,81, NotificationTypesToBitMask([]string{"DowntimeStart", "Acknowledgement", "Recovery"}))
|
||||
assert.Equal(t,0, NotificationTypesToBitMask([]string{}))
|
||||
assert.Equal(t, 81, NotificationTypesToBitMask([]string{"DowntimeStart", "Acknowledgement", "Recovery"}))
|
||||
assert.Equal(t, 0, NotificationTypesToBitMask([]string{}))
|
||||
}
|
||||
|
||||
func TestNotificationStatesToBitMask(t *testing.T) {
|
||||
assert.Equal(t,53, NotificationStatesToBitMask([]string{"OK", "Up", "Down", "Critical"}))
|
||||
assert.Equal(t,49, NotificationStatesToBitMask([]string{"OK", "Up", "Down"}))
|
||||
assert.Equal(t, 53, NotificationStatesToBitMask([]string{"OK", "Up", "Down", "Critical"}))
|
||||
assert.Equal(t, 49, NotificationStatesToBitMask([]string{"OK", "Up", "Down"}))
|
||||
}
|
||||
|
||||
func TestIcingaStateTypeToString(t *testing.T) {
|
||||
assert.Equal(t, "hard", IcingaStateTypeToString(0.0))
|
||||
assert.Equal(t, "soft", IcingaStateTypeToString(1.0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,4 @@ func Delta(a []string, b []string) ([]string, []string, []string) {
|
|||
}
|
||||
|
||||
return introduced, maintained, dismissed
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue