config

package
v0.0.0-...-d841f61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigKeyName        = "global_config"
	UserInterfaceKeyName = "user_interface"
)

Some default values related to configuration

View Source
const (
	AlarmBaggotTime                    = 60 * time.Second
	AlarmCancelAutosolveDelay          = 60 * 60 * time.Second
	AlarmDefaultNameScheme             = "{{ rand_string 2 }}-{{ rand_string 2 }}-{{ rand_string 2 }}"
	RemediationJobExecutorFetchTimeout = 30 * time.Second
	UserInterfaceMaxPbhEntities        = 10000
)

Default config values

Variables

This section is empty.

Functions

func CreateDisplayNameTpl

func CreateDisplayNameTpl(text string) (*template.Template, error)

Types

type Adapter

type Adapter interface {
	// GetConfig return the whole config document
	GetConfig() (CanopsisConf, error)
	// UpsertConfig upsert a config in mongo.
	UpsertConfig(conf CanopsisConf) error
}

Adapter to the concrete database

func NewAdapter

func NewAdapter(client mongo.DbClient) Adapter

type AlarmConfig

type AlarmConfig struct {
	FlappingFreqLimit    int
	FlappingInterval     time.Duration
	StealthyInterval     time.Duration
	BaggotTime           time.Duration
	EnableLastEventDate  bool
	CancelAutosolveDelay time.Duration
	DisplayNameScheme    *template.Template

	OutputLength int
	// DisableActionSnoozeDelayOnPbh ignores Pbh state to resolve snoozed with Action alarm while is True
	DisableActionSnoozeDelayOnPbh bool
	// contains filtered or unexported fields
}

type AlarmConfigProvider

type AlarmConfigProvider interface {
	Get() AlarmConfig
}

type BaseAlarmConfigProvider

type BaseAlarmConfigProvider struct {
	// contains filtered or unexported fields
}

func NewAlarmConfigProvider

func NewAlarmConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseAlarmConfigProvider

func (*BaseAlarmConfigProvider) Get

func (*BaseAlarmConfigProvider) Update

type BaseDataStorageConfigProvider

type BaseDataStorageConfigProvider struct {
	// contains filtered or unexported fields
}

func NewDataStorageConfigProvider

func NewDataStorageConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseDataStorageConfigProvider

func (*BaseDataStorageConfigProvider) Get

func (*BaseDataStorageConfigProvider) Update

type BaseRemediationConfigProvider

type BaseRemediationConfigProvider struct {
	// contains filtered or unexported fields
}

func NewRemediationConfigProvider

func NewRemediationConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseRemediationConfigProvider

func (*BaseRemediationConfigProvider) Get

func (*BaseRemediationConfigProvider) Update

type BaseTimezoneConfigProvider

type BaseTimezoneConfigProvider struct {
	// contains filtered or unexported fields
}

func NewTimezoneConfigProvider

func NewTimezoneConfigProvider(cfg CanopsisConf, logger zerolog.Logger) *BaseTimezoneConfigProvider

func (*BaseTimezoneConfigProvider) Get

func (*BaseTimezoneConfigProvider) Update

type BaseUserInterfaceConfigProvider

type BaseUserInterfaceConfigProvider struct {
	// contains filtered or unexported fields
}

func NewUserInterfaceConfigProvider

func NewUserInterfaceConfigProvider(cfg UserInterfaceConf, logger zerolog.Logger) *BaseUserInterfaceConfigProvider

func (*BaseUserInterfaceConfigProvider) Get

func (*BaseUserInterfaceConfigProvider) Update

type CanopsisConf

type CanopsisConf struct {
	ID          string             `bson:"_id,omitempty" toml:"omitempty"`
	Global      SectionGlobal      `bson:"global" toml:"global"`
	Alarm       SectionAlarm       `bson:"alarm" toml:"alarm"`
	Timezone    SectionTimezone    `bson:"timezone" toml:"timezone"`
	Remediation SectionRemediation `bson:"remediation" toml:"remediation"`
	ImportCtx   SectionImportCtx   `bson:"import_ctx" toml:"import_ctx"`
	File        SectionFile        `bson:"file" toml:"file"`
	DataStorage SectionDataStorage `bson:"data_storage" toml:"data_storage"`
}

CanopsisConf represents a generic configuration object.

type DataStorageConfig

type DataStorageConfig struct {
	TimeToExecute *ScheduledTime
}

type DataStorageConfigProvider

type DataStorageConfigProvider interface {
	Get() DataStorageConfig
}

type Exchange

type Exchange struct {
	Name       string                 `toml:"name"`
	Kind       string                 `toml:"kind"`
	Durable    bool                   `toml:"durable"`
	AutoDelete bool                   `toml:"autodelete"`
	Internal   bool                   `toml:"internal"`
	NoWait     bool                   `toml:"noWait"`
	Args       map[string]interface{} `toml:"args"`
}

type Queue

type Queue struct {
	Name       string                 `toml:"name"`
	Durable    bool                   `toml:"durable"`
	AutoDelete bool                   `toml:"autoDelete"`
	Exclusive  bool                   `toml:"exclusive"`
	NoWait     bool                   `toml:"noWait"`
	Bind       *QueueBinding          `toml:"bind"`
	Args       map[string]interface{} `toml:"args"`
}

type QueueBinding

type QueueBinding struct {
	Key      string `toml:"key"`
	Exchange string `toml:"exchange"`
	NoWait   bool   `toml:"noWait"`
	Args     map[string]interface{}
}

type RabbitMQConf

type RabbitMQConf struct {
	Exchanges []Exchange `toml:"exchanges"`
	Queues    []Queue    `toml:"queues"`
}

type RemediationConfig

type RemediationConfig struct {
	JobExecutorFetchTimeout time.Duration
}

type RemediationConfigProvider

type RemediationConfigProvider interface {
	Get() RemediationConfig
}

type ScheduledTime

type ScheduledTime struct {
	Weekday time.Weekday
	Hour    int
}

func (ScheduledTime) String

func (t ScheduledTime) String() string

type SectionAlarm

type SectionAlarm struct {
	FlappingFreqLimit    int    `toml:"FlappingFreqLimit"`
	FlappingInterval     int    `toml:"FlappingInterval"`
	StealthyInterval     int    `toml:"StealthyInterval"`
	BaggotTime           string `toml:"BaggotTime"`
	EnableLastEventDate  bool   `toml:"EnableLastEventDate"`
	CancelAutosolveDelay string `toml:"CancelAutosolveDelay"`
	DisplayNameScheme    string `toml:"DisplayNameScheme"`
	OutputLength         int    `toml:"OutputLength"`
	// DisableActionSnoozeDelayOnPbh ignores Pbh state to resolve snoozed with Action alarm while is True
	DisableActionSnoozeDelayOnPbh bool `toml:"DisableActionSnoozeDelayOnPbh"`
}

SectionAlarm ...

type SectionDataStorage

type SectionDataStorage struct {
	TimeToExecute string `toml:"TimeToExecute"`
}

type SectionFile

type SectionFile struct {
	Remediation string `toml:"Remediation"`
	Junit       string `toml:"Junit"`
	JunitApi    string `toml:"JunitApi"`
}

type SectionGlobal

type SectionGlobal struct {
	PrefetchCount                int `toml:"PrefetchCount"`
	PrefetchSize                 int `toml:"PrefetchSize"`
	ReconnectTimeoutMilliseconds int `toml:"ReconnectTimeoutMilliseconds"`
	ReconnectRetries             int `toml:"ReconnectRetries"`
}

SectionGlobal ...

func (*SectionGlobal) GetReconnectTimeout

func (s *SectionGlobal) GetReconnectTimeout() time.Duration

type SectionImportCtx

type SectionImportCtx struct {
	ThdWarnMinPerImport string `toml:"ThdWarnMinPerImport"`
	ThdCritMinPerImport string `toml:"ThdCritMinPerImport"`
	FilePattern         string `toml:"FilePattern"`
}

type SectionRemediation

type SectionRemediation struct {
	JobExecutorFetchTimeoutSeconds int64 `toml:"JobExecutorFetchTimeoutSeconds"`
}

type SectionTimezone

type SectionTimezone struct {
	Timezone string `toml:"Timezone"`
}

type TimezoneConfig

type TimezoneConfig struct {
	Location *time.Location
}

type TimezoneConfigProvider

type TimezoneConfigProvider interface {
	Get() TimezoneConfig
}

type Updater

type Updater interface {
	Update(CanopsisConf) error
}

type UserInterfaceAdapter

type UserInterfaceAdapter interface {
	GetConfig() (UserInterfaceConf, error)
}

func NewUserInterfaceAdapter

func NewUserInterfaceAdapter(client mongo.DbClient) UserInterfaceAdapter

type UserInterfaceConf

type UserInterfaceConf struct {
	IsAllowChangeSeverityToInfo bool `bson:"allow_change_severity_to_info"`
	// MaxMatchedItems need to warn user when number of items that match patterns is above this value
	MaxMatchedItems          int `bson:"max_matched_items"`
	CheckCountRequestTimeout int `bson:"check_count_request_timeout"`
}

UserInterfaceConf represents a user interface configuration object.

type UserInterfaceConfigProvider

type UserInterfaceConfigProvider interface {
	Get() UserInterfaceConf
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL