config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckConfig

type CheckConfig struct {
	Port       string   `yaml:"port"`
	Protocol   string   `yaml:"protocol"`
	Interval   string   `yaml:"interval"`
	RuleMode   RuleMode `yaml:"rule_mode,omitempty"`
	Tags       []string `yaml:"tags"`
	VerifyCert bool     `yaml:"verify_cert,omitempty"`
}

type Config

type Config struct {
	MonitorSite   string               `yaml:"monitor_site"`
	Sites         []SiteConfig         `yaml:"sites"`
	Rules         []rules.Rule         `yaml:"rules"`
	Notifications []NotificationConfig `yaml:"notifications"`
}

func LoadConfiguration

func LoadConfiguration(args []string) (*Config, error)

type GroupConfig

type GroupConfig struct {
	Name     string        `yaml:"name"`
	RuleMode RuleMode      `yaml:"rule_mode,omitempty"`
	Tags     []string      `yaml:"tags"`
	Hosts    []HostConfig  `yaml:"hosts"`
	Checks   []CheckConfig `yaml:"checks"`
}

func (*GroupConfig) Validate

func (g *GroupConfig) Validate() error

type HostConfig

type HostConfig struct {
	Host     string        `yaml:"host"`
	RuleMode RuleMode      `yaml:"rule_mode,omitempty"`
	Tags     []string      `yaml:"tags"`
	Checks   []CheckConfig `yaml:"checks"`
}

type NotificationConfig

type NotificationConfig struct {
	Type string `yaml:"type"`
}

type RuleMode

type RuleMode string
const (
	RuleModeAll RuleMode = "all" // Fire rules only if all hosts are down (default)
	RuleModeAny RuleMode = "any" // Fire rules if any host is down
)

type RuleModeResolver

type RuleModeResolver struct {
	Group GroupConfig
}

func NewRuleModeResolver

func NewRuleModeResolver(group GroupConfig) *RuleModeResolver

func (*RuleModeResolver) GetEffectiveRuleMode

func (r *RuleModeResolver) GetEffectiveRuleMode(check CheckConfig) RuleMode

func (*RuleModeResolver) ShouldTrigger

func (r *RuleModeResolver) ShouldTrigger(anyDown bool, allDown bool, check CheckConfig) bool

type SiteConfig

type SiteConfig struct {
	Name   string        `yaml:"name"`
	Tags   []string      `yaml:"tags"`
	Groups []GroupConfig `yaml:"groups"`
}

Jump to

Keyboard shortcuts

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