watchdog

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDefaults

func BuildDefaults(channelDefaults Channels, margin int) ([]string, error)

BuildDefaults builds a list of channels and their respective timeouts from a Channels map. The margin argument indicates how many updates can be missed before an alert is fired.

If a channel name is invalid (i.e., not specified in channelNames), an error is returned.

func MustBuildDefaults

func MustBuildDefaults(channels Channels, margin int) []string

MustBuildDefaults builds a list of channels and their respective timeouts from a Channels map. The margin argument indicates how many updates can be missed before an alert is fired. MustBuildDefaults panics if an error occurs.

Types

type Channels

type Channels map[string]time.Duration

Channels define the channels to watch for updates, and their respective timeouts

func ParseChannels

func ParseChannels(input []string) (Channels, error)

ParseChannels parses a list of channels and their respective timeouts.

type Watchdog

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

Watchdog watches for updates on channels and fires alerts if no update is received for a while.

The channels are specified as a list of comma-separated strings, where the first part is the channel name and the second part is the timeout for the channel. If the timeout is not specified, the default is 1 minute.

The channels are:

tado: The Tado collector channel.
solaredge: The Solaredge collector channel.
homewizard: The HomeWizard 2 collector channel.

func New

func New(
	channels Channels,
	alertManagerURL string,
	checkInterval time.Duration,
	httpClient *http.Client,
	redisClient pubsub.RedisClient,
	r prometheus.Registerer,
	logger *slog.Logger,
) *Watchdog

New creates a new Watchdog.

func (*Watchdog) Run

func (w *Watchdog) Run(ctx context.Context) error

Run starts the Watchdog.

Jump to

Keyboard shortcuts

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