registry

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	Name   string
	LEDUrl string
	// contains filtered or unexported fields
}

Host holds the state of a registered host

func (*Host) IsAlive

func (h *Host) IsAlive() bool

IsAlive reports if the host is up or down. If the host has been unavailable 5 times in a row, it's considered "down". One successful request marks it as "up" again

func (*Host) LEDState added in v0.13.4

func (h *Host) LEDState() bool

func (*Host) SetLEDState added in v0.13.4

func (h *Host) SetLEDState(on bool)

func (*Host) SetStatus added in v0.13.4

func (h *Host) SetStatus(reachable bool)

SetStatus updates the status of the host

type Registry

type Registry struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func (*Registry) Cleanup

func (r *Registry) Cleanup()

func (*Registry) Collect

func (r *Registry) Collect(ch chan<- prometheus.Metric)

func (*Registry) Describe

func (r *Registry) Describe(ch chan<- *prometheus.Desc)

func (*Registry) HostState

func (r *Registry) HostState(name string) (bool, bool)

func (*Registry) Hosts

func (r *Registry) Hosts() []*Host

func (*Registry) IsLeading

func (r *Registry) IsLeading() bool

func (*Registry) Leading

func (r *Registry) Leading(leading bool)

func (*Registry) Register

func (r *Registry) Register(name string)

func (*Registry) UpdateHostState

func (r *Registry) UpdateHostState(name string, state bool, reachable bool)

Jump to

Keyboard shortcuts

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