Documentation
¶
Overview ¶
Package sysprobe provides host and executable dependency snapshots for operational dashboards and health inspection.
Index ¶
- Variables
- type CPU
- type Config
- type DependencyCode
- type DependencySpec
- type DependencyStatus
- type Disk
- type DiskSpec
- type Host
- type HostConfig
- type HostProbe
- type HostSampler
- type HostSnapshot
- type Issue
- type Memory
- type Network
- type NetworkCapacityConfig
- type NetworkSpec
- type Option
- type Runner
- type Service
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host HostConfig `mapstructure:"host" yaml:"host"`
NetworkCapacity NetworkCapacityConfig `mapstructure:"network_capacity" yaml:"network_capacity"`
DependencyTTL time.Duration `mapstructure:"dependency_ttl" yaml:"dependency_ttl"`
CheckTimeout time.Duration `mapstructure:"check_timeout" yaml:"check_timeout"`
Dependencies []DependencySpec `mapstructure:"dependencies" yaml:"dependencies"`
}
type DependencyCode ¶
type DependencyCode string
const ( DependencyReady DependencyCode = "ready" DependencyMissing DependencyCode = "missing" DependencyDirectoryError DependencyCode = "directory_error" DependencyCheckFailed DependencyCode = "check_failed" DependencyVersionUnknown DependencyCode = "version_unknown" DependencyVersionOutside DependencyCode = "version_outside_range" )
type DependencySpec ¶
type DependencySpec struct {
Key string `mapstructure:"key" yaml:"key"`
Name string `mapstructure:"name" yaml:"name"`
BinaryPath string `mapstructure:"binary_path" yaml:"binary_path"`
Args []string `mapstructure:"args" yaml:"args"`
Env []string `mapstructure:"env" yaml:"env"`
PrepareDir string `mapstructure:"prepare_dir" yaml:"prepare_dir"`
MinVersion string `mapstructure:"min_version" yaml:"min_version"`
MaxVersion string `mapstructure:"max_version" yaml:"max_version"`
Required bool `mapstructure:"required" yaml:"required"`
Description string `mapstructure:"description" yaml:"description"`
}
type DependencyStatus ¶
type DependencyStatus struct {
Key string `json:"key"`
Name string `json:"name"`
Required bool `json:"required"`
Installed bool `json:"installed"`
Compatible bool `json:"compatible"`
Version string `json:"version,omitempty"`
Path string `json:"path,omitempty"`
MinVersion string `json:"min_version,omitempty"`
MaxVersion string `json:"max_version,omitempty"`
Description string `json:"description"`
Code DependencyCode `json:"code"`
Message string `json:"message"`
}
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 HostConfig ¶
type HostConfig 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 HostProbe ¶
type HostProbe struct {
// contains filtered or unexported fields
}
func NewHost ¶
func NewHost(config HostConfig) *HostProbe
type HostSampler ¶
type HostSampler interface {
Snapshot(context.Context) (HostSnapshot, error)
}
HostSampler permits an explicitly supplied host collector.
type HostSnapshot ¶
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 NetworkCapacityConfig ¶
type NetworkSpec ¶
type Option ¶
type Option func(*Service)
func WithHostSampler ¶
func WithHostSampler(host HostSampler) Option
func WithRunner ¶
type Runner ¶
type Runner interface {
Run(context.Context, DependencySpec) ([]byte, error)
}
Runner must stop when its context is canceled.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
type Snapshot ¶
type Snapshot struct {
At time.Time `json:"at"`
Ready bool `json:"ready"`
Host HostSnapshot `json:"host"`
NetworkCapacity NetworkCapacityConfig `json:"network_capacity"`
Dependencies []DependencyStatus `json:"dependencies"`
DependencyChecked time.Time `json:"dependency_checked_at"`
}
Click to show internal directories.
Click to hide internal directories.