conf

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package conf is the configuration of the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONSchema added in v1.9.0

func JSONSchema() (string, error)

JSONSchema return the json schema of the configuration

Types

type Conf

type Conf struct {
	Version  string          `yaml:"version" json:"version,omitempty" jsonschema:"title=Version,description=Version of the EaseProbe configuration"`
	HTTP     []http.HTTP     `yaml:"http" json:"http,omitempty" jsonschema:"title=HTTP Probe,description=HTTP Probe Configuration"`
	TCP      []tcp.TCP       `yaml:"tcp" json:"tcp,omitempty" jsonschema:"title=TCP Probe,description=TCP Probe Configuration"`
	Shell    []shell.Shell   `yaml:"shell" json:"shell,omitempty" jsonschema:"title=Shell Probe,description=Shell Probe Configuration"`
	Client   []client.Client `yaml:"client" json:"client,omitempty" jsonschema:"title=Native Client Probe,description=Native Client Probe Configuration"`
	SSH      ssh.SSH         `yaml:"ssh" json:"ssh,omitempty" jsonschema:"title=SSH Probe,description=SSH Probe Configuration"`
	TLS      []tls.TLS       `yaml:"tls" json:"tls,omitempty" jsonschema:"title=TLS Probe,description=TLS Probe Configuration"`
	Host     host.Host       `yaml:"host" json:"host,omitempty" jsonschema:"title=Host Probe,description=Host Probe Configuration"`
	Notify   notify.Config   `yaml:"notify" json:"notify,omitempty" jsonschema:"title=Notification,description=Notification Configuration"`
	Settings Settings        `yaml:"settings" json:"settings,omitempty" jsonschema:"title=Global Settings,description=EaseProbe Global configuration"`
}

Conf is Probe configuration

func Get

func Get() *Conf

Get return the global configuration

func New

func New(conf *string) (*Conf, error)

New read the configuration from yaml

func (*Conf) AllNotifiers added in v1.2.0

func (conf *Conf) AllNotifiers() []notify.Notify

AllNotifiers return all notifiers

func (*Conf) AllProbers added in v1.2.0

func (conf *Conf) AllProbers() []probe.Prober

AllProbers return all probers

func (*Conf) InitAllLogs added in v1.5.0

func (conf *Conf) InitAllLogs()

InitAllLogs initialize all logs

type HTTPServer added in v1.4.0

type HTTPServer struct {
	IP              string        `` /* 138-byte string literal not displayed */
	Port            string        `yaml:"port" json:"port" jsonschema:"type=integer,title=Web Server Port,description=port of the http server,default=8181"`
	AutoRefreshTime time.Duration `` /* 148-byte string literal not displayed */
	AccessLog       Log           `yaml:"log" json:"log,omitempty" jsonschema:"title=Access Log,description=access log of the http server"`
}

HTTPServer is the settings of http server

type Log added in v1.5.0

type Log struct {
	Level      LogLevel    `` /* 162-byte string literal not displayed */
	File       string      `yaml:"file" json:"file,omitempty" jsonschema:"title=Log File,description=the file to save the log"`
	SelfRotate bool        `` /* 129-byte string literal not displayed */
	MaxSize    int         `` /* 170-byte string literal not displayed */
	MaxAge     int         `` /* 165-byte string literal not displayed */
	MaxBackups int         `` /* 193-byte string literal not displayed */
	Compress   bool        `yaml:"compress" json:"compress,omitempty" jsonschema:"title=Compress,description=whether to compress the rotated log file"`
	Writer     io.Writer   `yaml:"-" json:"-"`
	Logger     *log.Logger `yaml:"-" json:"-"`
	IsStdout   bool        `yaml:"-" json:"-"`
}

Log is the log settings

func NewLog added in v1.5.0

func NewLog() Log

NewLog create a new Log

func (*Log) CheckDefault added in v1.5.0

func (l *Log) CheckDefault()

CheckDefault initialize the Log configuration

func (*Log) Close added in v1.5.0

func (l *Log) Close()

Close close the log file

func (*Log) ConfigureLogger added in v1.5.0

func (l *Log) ConfigureLogger()

ConfigureLogger configure the logger

func (*Log) GetWriter added in v1.5.0

func (l *Log) GetWriter() io.Writer

GetWriter return the log writer

func (*Log) InitLog added in v1.5.0

func (l *Log) InitLog(logger *log.Logger)

InitLog initialize the log

func (*Log) LogInfo added in v1.5.0

func (l *Log) LogInfo(name string)

LogInfo log info

func (*Log) Open added in v1.5.0

func (l *Log) Open()

Open open the log file

func (*Log) Rotate added in v1.5.0

func (l *Log) Rotate()

Rotate rotate the log file

type LogLevel

type LogLevel log.Level

LogLevel is the log level

func (*LogLevel) GetLevel added in v1.5.0

func (l *LogLevel) GetLevel() log.Level

GetLevel return the log level

func (LogLevel) MarshalYAML added in v1.5.0

func (l LogLevel) MarshalYAML() (interface{}, error)

MarshalYAML is marshal the format

func (*LogLevel) UnmarshalYAML

func (l *LogLevel) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is unmarshal the debug level

type Notify

type Notify struct {
	Retry global.Retry `yaml:"retry" json:"retry,omitempty" jsonschema:"title=retry,description=the retry settings"`
	Dry   bool         `` /* 155-byte string literal not displayed */
}

Notify is the settings of notification

type Probe

type Probe struct {
	Interval                             time.Duration `` /* 148-byte string literal not displayed */
	Timeout                              time.Duration `` /* 145-byte string literal not displayed */
	global.StatusChangeThresholdSettings `yaml:",inline" json:",inline"`
}

Probe is the settings of prober

type SLAReport

type SLAReport struct {
	Schedule Schedule `` /* 182-byte string literal not displayed */
	Time     string   `` /* 144-byte string literal not displayed */
	//Debug    bool     `yaml:"debug" json:"debug,omitempty" jsonschema:"title=Debug,description=if true the SLA report will be printed to stdout,default=false"`
	DataFile string   `yaml:"data" json:"data,omitempty" jsonschema:"title=Data File,description=the data file of SLA report, absolute path"`
	Backups  int      `yaml:"backups" json:"backups,omitempty" jsonschema:"title=Backups,description=the number of backups of SLA report,default=5"`
	Channels []string `yaml:"channels" json:"channels,omitempty" jsonschema:"title=Channels,description=the channels of SLA report"`
}

SLAReport is the settings for SLA report

type Schedule

type Schedule int

Schedule is the schedule.

const (
	None Schedule = iota
	Minutely
	Hourly
	Daily
	Weekly
	Monthly
)

Schedule enum

func (Schedule) MarshalYAML added in v1.8.0

func (s Schedule) MarshalYAML() (interface{}, error)

MarshalYAML marshal the configuration to yaml

func (*Schedule) UnmarshalYAML

func (s *Schedule) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is unmarshal the debug level

type Settings

type Settings struct {
	Name       string     `` /* 132-byte string literal not displayed */
	IconURL    string     `yaml:"icon" json:"icon,omitempty" jsonschema:"title=Icon URL,description=The URL of the icon of the EaseProbe instance"`
	PIDFile    string     `` /* 134-byte string literal not displayed */
	Log        Log        `yaml:"log" json:"log,omitempty" jsonschema:"title=EaseProbe Log,description=The log settings of the EaseProbe instance"`
	TimeFormat string     `` /* 164-byte string literal not displayed */
	TimeZone   string     `` /* 178-byte string literal not displayed */
	Probe      Probe      `` /* 133-byte string literal not displayed */
	Notify     Notify     `` /* 137-byte string literal not displayed */
	SLAReport  SLAReport  `` /* 132-byte string literal not displayed */
	HTTPServer HTTPServer `` /* 136-byte string literal not displayed */
}

Settings is the EaseProbe configuration

Jump to

Keyboard shortcuts

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