config

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedUnits = []string{"B", "kB", "MB", "GB", "TB", "PB", "KiB", "MiB", "GiB", "TiB", "PiB"}
View Source
var ConfigDefaultFile embed.FS
View Source
var ConfigDir string
View Source
var ConfigFile string
View Source
var DebugMode bool
View Source
var PluginDir string
View Source
var Settings = new(settings)
View Source
var Version string

Functions

func Contains

func Contains(s []string, val string) bool

func FileExists

func FileExists(file string) bool

func GetConfigDirFilePath added in v1.1.0

func GetConfigDirFilePath(path string) string

func GetConfigFilePath added in v1.1.0

func GetConfigFilePath(name string) string

func GetPluginDirFilePath added in v1.1.0

func GetPluginDirFilePath(name string) string

func InitConfig added in v1.1.0

func InitConfig(file string, defaultFile embed.FS) error

func LogDebug added in v1.1.0

func LogDebug(v ...interface{})

func LogDebugf added in v1.1.0

func LogDebugf(format string, a ...interface{})

func ParseConfig added in v1.1.0

func ParseConfig() error

func ParseConfigDir added in v1.1.0

func ParseConfigDir()

Run through all YAML config files in the config directory if it exists and import any configurations for checks and senders. Does not return actual error but logs issues.

func ParseFile

func ParseFile(defaultFile embed.FS) error

func ParseSecretsFile added in v1.1.0

func ParseSecretsFile() (map[string]string, error)

func ParseVersion added in v1.0.1

func ParseVersion(versionFile embed.FS)

Set the version to the version in the VERSION file if it doesn't already exist during build time (this is mostly for DEV)

func UsingManager added in v1.1.0

func UsingManager() bool

Types

type CheckCfg

type CheckCfg struct {
	Hostname    string `yaml:"hostname"`
	Address     string `yaml:"address"`
	Servicename string `yaml:"servicename"`
	Interval    string `yaml:"interval"`
	Endpoint    string `yaml:"endpoint"`
	Options     Values `yaml:"options"`
	Disabled    bool
	NextRun     time.Time
}

func (*CheckCfg) Name added in v1.1.0

func (c *CheckCfg) Name() string

type Data added in v1.1.0

type Data struct {
	Checks    []CheckCfg
	Senders   []SenderCfg
	Secrets   map[string]string
	HostAddrs map[string]string
	sync.RWMutex
}
var CfgData Data

Actual config data (checks, senders, secrets) after parse

type ManagerCfg added in v1.1.0

type ManagerCfg struct {
	Url        string `yaml:"url"`
	APIKey     string `yaml:"apikey"`
	IgnoreCert bool   `yaml:"ignoreCert"`
}

type SenderCfg

type SenderCfg struct {
	Name  string `yaml:"name"`
	Url   string `yaml:"url"`
	Token string `yaml:"token"`
	Type  string `yaml:"type"`
}

type Values

type Values struct {
	Check    bool
	Pretty   bool
	Plugin   string
	Name     string
	Path     string
	Args     []string
	Against  string
	Expected string
	Warning  string
	Critical string
	Delta    int
	Units    string
}

func ParseValues

func ParseValues(r *http.Request) Values

func (*Values) GetUnits added in v1.1.0

func (v *Values) GetUnits() string

Jump to

Keyboard shortcuts

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