checks

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLLighthouse = "lighthouse"
	CLPrysm      = "prysm"
	CLLodestar   = "lodestar"
	CLNimbus     = "nimbus"
	CLTeku       = "teku"
	CLGrandine   = "grandine"
	ELNethermind = "nethermind"
	ELNimbusel   = "nimbusel"
	ELBesu       = "besu"
	ELGeth       = "geth"
	ELReth       = "reth"
	ELErigon     = "erigon"
	ELEthereumJS = "ethereumjs"
)

Define a list of known clients.

Variables

Buckets of known clients.

Functions

func IsCLClient

func IsCLClient(client string) bool

IsCLClient returns true if the client is a consensus client.

func IsELClient

func IsELClient(client string) bool

IsELClient returns true if the client is an execution client.

Types

type CLFinalizedEpochCheck

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

CLFinalizedEpochCheck is a check that verifies if the CL finalized epoch is advancing.

func NewCLFinalizedEpochCheck

func NewCLFinalizedEpochCheck(grafanaClient grafana.GrafanaClient) *CLFinalizedEpochCheck

NewCLFinalizedEpochCheck creates a new CLFinalizedEpochCheck.

func (*CLFinalizedEpochCheck) Category

func (c *CLFinalizedEpochCheck) Category() Category

Category returns the category of the check.

func (*CLFinalizedEpochCheck) ClientType

func (c *CLFinalizedEpochCheck) ClientType() ClientType

ClientType returns the client type of the check.

func (*CLFinalizedEpochCheck) Name

func (c *CLFinalizedEpochCheck) Name() string

Name returns the name of the check.

func (*CLFinalizedEpochCheck) Run

func (c *CLFinalizedEpochCheck) Run(ctx context.Context, cfg Config) (*Result, error)

Run executes the check.

type CLPeerCountCheck

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

CLPeerCountCheck is a check that verifies if the CL peer count is sufficient.

func NewCLPeerCountCheck

func NewCLPeerCountCheck(grafanaClient grafana.GrafanaClient) *CLPeerCountCheck

NewCLPeerCountCheck creates a new CLPeerCountCheck.

func (*CLPeerCountCheck) Category

func (c *CLPeerCountCheck) Category() Category

Category returns the category of the check.

func (*CLPeerCountCheck) ClientType

func (c *CLPeerCountCheck) ClientType() ClientType

ClientType returns the client type of the check.

func (*CLPeerCountCheck) Name

func (c *CLPeerCountCheck) Name() string

Name returns the name of the check.

func (*CLPeerCountCheck) Run

func (c *CLPeerCountCheck) Run(ctx context.Context, cfg Config) (*Result, error)

Run executes the check.

type CLSyncCheck

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

CLSyncCheck is a check that verifies if the CL nodes are syncing.

func NewCLSyncCheck

func NewCLSyncCheck(grafanaClient grafana.GrafanaClient) *CLSyncCheck

NewCLSyncCheck creates a new CLSyncCheck.

func (*CLSyncCheck) Category

func (c *CLSyncCheck) Category() Category

Category returns the category of the check.

func (*CLSyncCheck) ClientType

func (c *CLSyncCheck) ClientType() ClientType

ClientType returns the client type of the check.

func (*CLSyncCheck) Name

func (c *CLSyncCheck) Name() string

Name returns the name of the check.

func (*CLSyncCheck) Run

func (c *CLSyncCheck) Run(ctx context.Context, cfg Config) (*Result, error)

Run executes the check.

type Category

type Category string

Category represents the type of check.

const (
	CategoryGeneral Category = "general"
	CategorySync    Category = "sync"
)

Define the categories.

func (Category) String

func (c Category) String() string

String returns the string representation of a category.

type Check

type Check interface {
	// Name returns the name of the check.
	Name() string
	// Category returns the category of the check.
	Category() Category
	// ClientType returns the client type of the check.
	ClientType() ClientType
	// Run executes the check and returns the result.
	Run(ctx context.Context, cfg Config) (*Result, error)
}

Check represents a single health check.

type ClientType

type ClientType string

ClientType represents the type of client.

const (
	ClientTypeAll ClientType = ".*"
	ClientTypeCL  ClientType = "consensus"
	ClientTypeEL  ClientType = "execution"
)

Define the client types.

func (ClientType) String

func (c ClientType) String() string

String returns the string representation of a client type.

type Config

type Config struct {
	Network       string
	ConsensusNode string
	ExecutionNode string
	GrafanaToken  string
}

Config contains configuration for checks.

type ELBlockHeightCheck

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

ELBlockHeightCheck is a check that verifies if the EL nodes are advancing.

func NewELBlockHeightCheck

func NewELBlockHeightCheck(grafanaClient grafana.GrafanaClient) *ELBlockHeightCheck

NewELBlockHeightCheck creates a new ELBlockHeightCheck.

func (*ELBlockHeightCheck) Category

func (c *ELBlockHeightCheck) Category() Category

Category returns the category of the check.

func (*ELBlockHeightCheck) ClientType

func (c *ELBlockHeightCheck) ClientType() ClientType

ClientType returns the client type of the check.

func (*ELBlockHeightCheck) Name

func (c *ELBlockHeightCheck) Name() string

Name returns the name of the check.

func (*ELBlockHeightCheck) Run

func (c *ELBlockHeightCheck) Run(ctx context.Context, cfg Config) (*Result, error)

Run executes the check.

type ELPeerCountCheck

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

ELPeerCountCheck is a check that verifies if the EL nodes have sufficient peers.

func NewELPeerCountCheck

func NewELPeerCountCheck(grafanaClient grafana.GrafanaClient) *ELPeerCountCheck

NewELPeerCountCheck creates a new ELPeerCountCheck.

func (*ELPeerCountCheck) Category

func (c *ELPeerCountCheck) Category() Category

Category returns the category of the check.

func (*ELPeerCountCheck) ClientType

func (c *ELPeerCountCheck) ClientType() ClientType

ClientType returns the client type of the check.

func (*ELPeerCountCheck) Name

func (c *ELPeerCountCheck) Name() string

Name returns the name of the check.

func (*ELPeerCountCheck) Run

func (c *ELPeerCountCheck) Run(ctx context.Context, cfg Config) (*Result, error)

Run executes the check.

type ELSyncCheck

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

ELSyncCheck is a check that verifies if the EL nodes are syncing.

func NewELSyncCheck

func NewELSyncCheck(grafanaClient grafana.GrafanaClient) *ELSyncCheck

NewELSyncCheck creates a new ELSyncCheck.

func (*ELSyncCheck) Category

func (c *ELSyncCheck) Category() Category

Category returns the category of the check.

func (*ELSyncCheck) ClientType

func (c *ELSyncCheck) ClientType() ClientType

ClientType returns the client type of the check.

func (*ELSyncCheck) Name

func (c *ELSyncCheck) Name() string

Name returns the name of the check.

func (*ELSyncCheck) Run

func (c *ELSyncCheck) Run(ctx context.Context, cfg Config) (*Result, error)

Run executes the check.

type HeadSlotCheck

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

HeadSlotCheck is a check that verifies if the CL head slot is advancing.

func NewHeadSlotCheck

func NewHeadSlotCheck(grafanaClient grafana.GrafanaClient) *HeadSlotCheck

NewHeadSlotCheck creates a new HeadSlotCheck.

func (*HeadSlotCheck) Category

func (c *HeadSlotCheck) Category() Category

Category returns the category of the check.

func (*HeadSlotCheck) ClientType

func (c *HeadSlotCheck) ClientType() ClientType

ClientType returns the client type of the check.

func (*HeadSlotCheck) Name

func (c *HeadSlotCheck) Name() string

Name returns the name of the check.

func (*HeadSlotCheck) Run

func (c *HeadSlotCheck) Run(ctx context.Context, cfg Config) (*Result, error)

Run executes the check.

type Result

type Result struct {
	Name          string
	Category      Category
	Status        Status
	Description   string
	Timestamp     time.Time
	Details       map[string]interface{}
	AffectedNodes []string
}

Result represents the outcome of a health check.

type Runner

type Runner interface {
	// RegisterCheck adds a check to the runner.
	RegisterCheck(check Check)
	// RunChecks executes all registered checks.
	RunChecks(ctx context.Context, cfg Config) ([]*Result, *analyzer.AnalysisResult, error)
}

Runner executes health checks.

func NewDefaultRunner

func NewDefaultRunner() Runner

NewDefaultRunner creates a new default check runner.

type Status

type Status string

Status represents the status of a check.

const (
	StatusOK   Status = "OK"
	StatusFail Status = "FAIL"
)

Define the statuses.

Jump to

Keyboard shortcuts

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