hostprobe

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package hostprobe collects lightweight host resource snapshots for operational dashboards and health inspection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPU

type CPU struct {
	LogicalCores int     `json:"logical_cores"`
	UsedPercent  float64 `json:"used_percent"`
}

type Config

type Config struct {
	CacheTTL    time.Duration `json:"-" mapstructure:"cache_ttl" yaml:"cache_ttl"`
	CPUInterval time.Duration `json:"-" mapstructure:"cpu_interval" yaml:"cpu_interval"`
	Disks       []DiskSpec    `json:"-" mapstructure:"disks" yaml:"disks"`
	Network     NetworkSpec   `json:"-" mapstructure:"network" yaml:"network"`
}

type Disk

type Disk struct {
	Name        string  `json:"name"`
	Path        string  `json:"path"`
	Filesystem  string  `json:"filesystem"`
	Total       uint64  `json:"total"`
	Used        uint64  `json:"used"`
	Free        uint64  `json:"free"`
	UsedPercent float64 `json:"used_percent"`
}

type DiskSpec

type DiskSpec struct {
	Name string `json:"name" mapstructure:"name" yaml:"name"`
	Path string `json:"path" mapstructure:"path" yaml:"path"`
}

type Host

type Host struct {
	Hostname        string `json:"hostname"`
	OS              string `json:"os"`
	Platform        string `json:"platform"`
	PlatformVersion string `json:"platform_version"`
	KernelVersion   string `json:"kernel_version"`
	Architecture    string `json:"architecture"`
	UptimeSeconds   uint64 `json:"uptime_seconds"`
	BootTime        uint64 `json:"boot_time"`
}

type Issue

type Issue struct {
	Component string `json:"component"`
	Path      string `json:"path,omitempty"`
	Message   string `json:"message"`
}

type Memory

type Memory struct {
	Total       uint64  `json:"total"`
	Used        uint64  `json:"used"`
	Available   uint64  `json:"available"`
	UsedPercent float64 `json:"used_percent"`
}

type Network

type Network struct {
	BytesSent          uint64  `json:"bytes_sent"`
	BytesReceived      uint64  `json:"bytes_received"`
	PacketsSent        uint64  `json:"packets_sent"`
	PacketsReceived    uint64  `json:"packets_received"`
	SendBytesPerSecond float64 `json:"send_bytes_per_second"`
	RecvBytesPerSecond float64 `json:"recv_bytes_per_second"`
	SampleWindow       float64 `json:"sample_window_seconds"`
	RateReady          bool    `json:"rate_ready"`
}

type NetworkSpec added in v0.1.17

type NetworkSpec struct {
	ProcRoot   string   `json:"-" mapstructure:"proc_root" yaml:"proc_root"`
	Interfaces []string `json:"-" mapstructure:"interfaces" yaml:"interfaces"`
}

type Probe

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

func New

func New(config Config) *Probe

func (*Probe) Snapshot

func (p *Probe) Snapshot(ctx context.Context) (Snapshot, error)

type Snapshot

type Snapshot struct {
	CollectedAt time.Time `json:"collected_at"`
	Host        Host      `json:"host"`
	CPU         CPU       `json:"cpu"`
	Memory      Memory    `json:"memory"`
	Disks       []Disk    `json:"disks"`
	Network     Network   `json:"network"`
	Issues      []Issue   `json:"issues"`
}

Jump to

Keyboard shortcuts

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