diagnostics

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SummarizeHealth

func SummarizeHealth(checks []HealthCheck) (allPass bool, failed int)

SummarizeHealth returns overall pass/fail from checks.

Types

type ClusterInfo

type ClusterInfo struct {
	AgentID      string            `json:"agent_id,omitempty"`
	AgentName    string            `json:"agent_name,omitempty"`
	Phase        state.Phase       `json:"phase"`
	Versions     map[string]string `json:"versions,omitempty"`
	ClusterCIDR  string            `json:"cluster_cidr,omitempty"`
	ServiceCIDR  string            `json:"service_cidr,omitempty"`
	Kubeconfig   string            `json:"kubeconfig,omitempty"`
	StatePath    string            `json:"state_path,omitempty"`
	RegisteredAt time.Time         `json:"registered_at,omitempty"`
}

ClusterInfo holds metadata for `nr cluster info`.

type ClusterStatus

type ClusterStatus struct {
	Phase          state.Phase `json:"phase"`
	AgentID        string      `json:"agent_id,omitempty"`
	AgentName      string      `json:"agent_name,omitempty"`
	APIReachable   bool        `json:"api_reachable"`
	K3sInstalled   bool        `json:"k3s_installed"`
	CalicoOK       bool        `json:"calico_ok"`
	LiqoOK         bool        `json:"liqo_ok"`
	PeeringSummary string      `json:"peering_summary,omitempty"`
	LastError      string      `json:"last_error,omitempty"`
}

ClusterStatus is a summary used by `nr cluster status`.

type Collector

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

Collector collects diagnostic information about the local cluster.

func NewCollector

func NewCollector(configDir, agentKey string) *Collector

NewCollector creates a diagnostic collector for a cluster identity (name or id).

func (*Collector) CollectHealth

func (c *Collector) CollectHealth(ctx context.Context) ([]HealthCheck, error)

CollectHealth runs component health checks.

func (*Collector) CollectInfo

func (c *Collector) CollectInfo(clusterCIDR, serviceCIDR string) (*ClusterInfo, error)

CollectInfo builds cluster info from state and config hints.

func (*Collector) CollectLogs

func (c *Collector) CollectLogs(ctx context.Context, lines int) (string, error)

CollectLogs gathers bounded recent logs from journalctl/k3s when available.

func (*Collector) CollectStatus

func (c *Collector) CollectStatus(ctx context.Context) (*ClusterStatus, error)

CollectStatus builds cluster status from local state + live probes.

func (*Collector) CollectSystemInfo

func (c *Collector) CollectSystemInfo() (*SystemInfo, error)

CollectSystemInfo gathers OS/arch details.

func (*Collector) WriteDebugBundle

func (c *Collector) WriteDebugBundle(ctx context.Context, clusterCIDR, serviceCIDR string) (string, error)

WriteDebugBundle writes a debug report under ~/.nr/debug-<timestamp>/.

type HealthCheck

type HealthCheck struct {
	Component string `json:"component"`
	Status    string `json:"status"` // pass|fail|warn
	Message   string `json:"message"`
}

HealthCheck is one component health result.

type SystemInfo

type SystemInfo struct {
	OS     string `json:"os"`
	Kernel string `json:"kernel"`
	Arch   string `json:"arch"`
	CPUs   int    `json:"cpus"`
	GoOS   string `json:"go_os"`
}

SystemInfo represents host system information.

Jump to

Keyboard shortcuts

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