checks

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Overview

Package checks contains the Check handlers and helper functions for calling processes and returning results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunChecks

func RunChecks(
	ctx context.Context,
	cfg config.Conf,
	_ *zap.Logger,
	checkList []*Info,
	respChan chan *api.EventMessage,
) func() error

RunChecks is a routine that will cycle through the checks on a schedule and execute any pending checks.

Types

type Checks

type Checks []*Info

Checks slice of checks with NextRun method for kicking clients to update.

func GetChecksFromViper

func GetChecksFromViper(cfg config.Conf, vcfg *viper.Viper, logger *zap.Logger, hostName string) Checks

GetChecksFromViper gets all the checks from the viper.Viper config.

func (Checks) NextRun

func (c Checks) NextRun(t time.Time)

NextRun sets the next run property of all checks to specified timestamp.

type Info

type Info struct {
	Name     string
	Type     api.CheckType
	Hostname string
	Period   time.Duration
	NextRun  time.Time
	Command  string
	Timeout  time.Duration
	Workdir  string
}

Info is the details of a check.

func GetCheckFromViper

func GetCheckFromViper(cfg config.Conf, logger *zap.Logger, name, hostName string) *Info

GetCheckFromViper returns a check with the specified name from the config file.

func (*Info) Run

func (i *Info) Run(ctx context.Context, t time.Time) *api.EventMessage

Run executes a check and returns an api.EventMessage with the details.

Jump to

Keyboard shortcuts

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