checks

package
v0.0.0-...-e0ed648 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Clock is not synchronized to a time server (TIME_ERROR)
	NTP_TIME_ERROR = 5

	// timex.Status time resolution bit (STA_NANO),
	// If the STA_NANO is set, all values are in nanoseconds, otherwise in microseconds
	// resolution (0 = us, 1 = ns)
	// Source: https://github.com/torvalds/linux/blob/7e90b5c295ec1e47c8ad865429f046970c549a66/include/uapi/linux/timex.h#L187
	STA_NANO = 0x2000

	// Convertions
	NANOSECONDS_TO_SECONDS  = 1000000000
	MICROSECONDS_TO_SECONDS = 1000000
)
View Source
const DUPLEX_FULL = 2
View Source
const DUPLEX_HALF = 1
View Source
const DUPLEX_UNKNOWN = 0

Variables

This section is empty.

Functions

func WrapDiffInt32

func WrapDiffInt32(last, curr int32) int32

func WrapDiffInt64

func WrapDiffInt64(last, curr int64) int64

func WrapDiffUint32

func WrapDiffUint32(last, curr uint32) uint32

func WrapDiffUint64

func WrapDiffUint64(last, curr uint64) uint64

func Wrapdiff

func Wrapdiff(last, curr float64) (float64, error)

Wrapdiff calculate the difference between last and curr If last > curr, try to guess the boundary at which the value must have wrapped by trying the maximum values of 64, 32 and 16 bit signed and unsigned ints.

Types

type Check

type Check interface {
	// Name will be used in the response as check name
	Name() string

	// Run the actual check
	// if error != nil the check result will be nil
	// ctx can be canceled and runs the timeout
	// CheckResult will be serialized after the return and should not change until the next call to Run
	Run(ctx context.Context) (interface{}, error)

	// Configure the command or return false if the command was disabled
	Configure(config *config.Configuration) (bool, error)
}

Check should gather the required information

func ChecksForConfiguration

func ChecksForConfiguration(config *config.Configuration) ([]Check, error)

type CheckAgent

type CheckAgent struct {
	System        string // Windows e.g.: Windows Server 2016 Standard / Linux / macOS
	ReleaseId     string // Windows e.g.: 1607
	CurrentBuild  string // Windows e.g.: 14393
	Family        string // Windows e.g.: Server
	LastBootTime  time.Time
	MacVersion    string // macOS
	KernelVersion string // Linux
	CheckInterval int64  // Checkinterval of the Agent in Seconds
}

CheckAgent gathers information about the agent itself

func (*CheckAgent) Configure

func (c *CheckAgent) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckAgent) Init

func (c *CheckAgent) Init()

func (*CheckAgent) Name

func (c *CheckAgent) Name() string

Name will be used in the response as check name

func (*CheckAgent) Run

func (c *CheckAgent) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckCpu

type CheckCpu struct {
}

CheckCpu gathers information about system CPU load

func (*CheckCpu) Configure

func (c *CheckCpu) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckCpu) Name

func (c *CheckCpu) Name() string

Name will be used in the response as check name

func (*CheckCpu) Run

func (c *CheckCpu) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

func (*CheckCpu) SleepWithContext

func (c *CheckCpu) SleepWithContext(ctx context.Context, interval time.Duration) error

Like sleep but can be canceled by context

type CheckDisk

type CheckDisk struct {
}

CheckDisk gathers information about system disks

func (*CheckDisk) Configure

func (c *CheckDisk) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckDisk) Name

func (c *CheckDisk) Name() string

Name will be used in the response as check name

func (*CheckDisk) Run

func (c *CheckDisk) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckDiskIo

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

CheckDiskIo gathers information about system disks IO

func (*CheckDiskIo) Configure

func (c *CheckDiskIo) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckDiskIo) Name

func (c *CheckDiskIo) Name() string

Name will be used in the response as check name

func (*CheckDiskIo) Run

func (c *CheckDiskIo) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckDocker

type CheckDocker struct {
}

CheckDocker gathers information about Docker containers

func (*CheckDocker) Configure

func (c *CheckDocker) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckDocker) Name

func (c *CheckDocker) Name() string

Name will be used in the response as check name

func (*CheckDocker) Run

func (c *CheckDocker) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckLoad

type CheckLoad struct {
}

CheckLoad gathers information about system CPU load

func (*CheckLoad) Configure

func (c *CheckLoad) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckLoad) Name

func (c *CheckLoad) Name() string

Name will be used in the response as check name

func (*CheckLoad) Run

func (c *CheckLoad) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckMem

type CheckMem struct {
}

CheckMem gathers information about system memory

func (*CheckMem) Configure

func (c *CheckMem) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckMem) Name

func (c *CheckMem) Name() string

Name will be used in the response as check name

func (*CheckMem) Run

func (c *CheckMem) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckNet

type CheckNet struct {
}

CheckNet gathers information about system network interfaces (netstats or net_states in the Python version)

func (*CheckNet) Configure

func (c *CheckNet) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckNet) Name

func (c *CheckNet) Name() string

Name will be used in the response as check name

func (*CheckNet) Run

func (c *CheckNet) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckNetIo

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

CheckNetIo gathers information about system network interface IO (net_io in the Python version)

func (*CheckNetIo) Configure

func (c *CheckNetIo) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckNetIo) Name

func (c *CheckNetIo) Name() string

Name will be used in the response as check name

func (*CheckNetIo) Run

func (c *CheckNetIo) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckNtp

type CheckNtp struct {
}

CheckNtp gathers information about time offset between the system clock and the chosen time source (NTP)

func (*CheckNtp) Configure

func (c *CheckNtp) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckNtp) Name

func (c *CheckNtp) Name() string

Name will be used in the response as check name

func (*CheckNtp) Run

func (c *CheckNtp) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckProcess

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

CheckProcess gathers information about each process

func (*CheckProcess) Configure

func (c *CheckProcess) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckProcess) Name

func (c *CheckProcess) Name() string

Name will be used in the response as check name

func (*CheckProcess) Run

func (c *CheckProcess) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckSensor

type CheckSensor struct {
}

CheckSensor gathers information about system sensors

func (*CheckSensor) Configure

func (c *CheckSensor) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckSensor) Name

func (c *CheckSensor) Name() string

Name will be used in the response as check name

func (*CheckSensor) Run

func (c *CheckSensor) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckSwap

type CheckSwap struct {
}

CheckSwap gathers information about system swap

func (*CheckSwap) Configure

func (c *CheckSwap) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckSwap) Name

func (c *CheckSwap) Name() string

Name will be used in the response as check name

func (*CheckSwap) Run

func (c *CheckSwap) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckSystemd

type CheckSystemd struct {
}

CheckSystemd gathers information about Systemd services

func (*CheckSystemd) Configure

func (c *CheckSystemd) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckSystemd) Name

func (c *CheckSystemd) Name() string

Name will be used in the response as check name

func (*CheckSystemd) Run

func (c *CheckSystemd) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

type CheckUser

type CheckUser struct {
}

CheckUser gathers information about system users

func (*CheckUser) Configure

func (c *CheckUser) Configure(config *config.Configuration) (bool, error)

Configure the command or return false if the command was disabled

func (*CheckUser) Name

func (c *CheckUser) Name() string

Name will be used in the response as check name

func (*CheckUser) Run

func (c *CheckUser) Run(ctx context.Context) (interface{}, error)

Run the actual check if error != nil the check result will be nil ctx can be canceled and runs the timeout CheckResult will be serialized after the return and should not change until the next call to Run

Jump to

Keyboard shortcuts

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