maintenance

package
v5.33.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled  *bool         `yaml:"enabled"`            // Whether the maintenance period is enabled. Enabled by default if nil.
	Start    string        `yaml:"start,omitempty"`    // Time at which the maintenance period starts (e.g. 23:00)
	Duration time.Duration `yaml:"duration,omitempty"` // Duration of the maintenance period (e.g. 4h)
	Timezone string        `yaml:"timezone,omitempty"` // Timezone in string format which the maintenance period is configured (e.g. America/Sao_Paulo)

	// Every is a list of days of the week during which maintenance period applies.
	// See longDayNames for list of valid values.
	// Every day if empty.
	Every []string `yaml:"every,omitempty"`
	// contains filtered or unexported fields
}

Config allows for the configuration of a maintenance period. During this maintenance period, no alerts will be sent.

Uses UTC by default.

func GetDefaultConfig

func GetDefaultConfig() *Config

func (*Config) IsEnabled

func (c *Config) IsEnabled() bool

IsEnabled returns whether maintenance is enabled or not

func (*Config) IsUnderMaintenance

func (c *Config) IsUnderMaintenance() bool

IsUnderMaintenance checks whether the endpoints that Gatus monitors are within the configured maintenance window

func (*Config) ValidateAndSetDefaults

func (c *Config) ValidateAndSetDefaults() error

ValidateAndSetDefaults validates the maintenance configuration and sets the default values if necessary.

Must be called once in the application's lifecycle before IsUnderMaintenance is called, since it also sets durationToStartFromMidnight.