Documentation ¶
Overview ¶
Package host is the host probe package
Index ¶
- Constants
- Variables
- type Basic
- func (b *Basic) CheckThreshold() (bool, string)
- func (b *Basic) Command() string
- func (b *Basic) Config(s *Server)
- func (b *Basic) CreateMetrics(subsystem, name string)
- func (b *Basic) ExportMetrics(name string)
- func (b *Basic) Name() string
- func (b *Basic) OutputLines() int
- func (b *Basic) Parse(s []string) error
- func (b *Basic) SetThreshold(t *Threshold)
- func (b *Basic) UsageInfo() string
- type CPU
- func (c *CPU) CheckThreshold() (bool, string)
- func (c *CPU) Command() string
- func (c *CPU) Config(s *Server)
- func (c *CPU) CreateMetrics(subsystem, name string)
- func (c *CPU) ExportMetrics(name string)
- func (c *CPU) Name() string
- func (c *CPU) OutputLines() int
- func (c *CPU) Parse(s []string) error
- func (c *CPU) SetThreshold(t *Threshold)
- func (c *CPU) UsageInfo() string
- type Disks
- func (d *Disks) CheckThreshold() (bool, string)
- func (d *Disks) Command() string
- func (d *Disks) Config(s *Server)
- func (d *Disks) CreateMetrics(subsystem, name string)
- func (d *Disks) ExportMetrics(name string)
- func (d *Disks) Name() string
- func (d *Disks) OutputLines() int
- func (d *Disks) Parse(s []string) error
- func (d *Disks) SetThreshold(t *Threshold)
- func (d *Disks) UsageInfo() string
- type Host
- type IMetrics
- type Info
- type Load
- func (l *Load) CheckThreshold() (bool, string)
- func (l *Load) Command() string
- func (l *Load) Config(s *Server)
- func (l *Load) CreateMetrics(subsystem, name string)
- func (l *Load) ExportMetrics(name string)
- func (l *Load) Name() string
- func (l *Load) OutputLines() int
- func (l *Load) Parse(s []string) error
- func (l *Load) SetThreshold(t *Threshold)
- func (l *Load) UsageInfo() string
- type Mem
- func (m *Mem) CheckThreshold() (bool, string)
- func (m *Mem) Command() string
- func (m *Mem) Config(s *Server)
- func (m *Mem) CreateMetrics(subsystem, name string)
- func (m *Mem) ExportMetrics(name string)
- func (m *Mem) Name() string
- func (m *Mem) OutputLines() int
- func (m *Mem) Parse(s []string) error
- func (m *Mem) SetThreshold(t *Threshold)
- func (m *Mem) UsageInfo() string
- type ResourceUsage
- type Server
- type Threshold
Constants ¶
const ( DefaultCPUThreshold = 0.8 DefaultMemThreshold = 0.8 DefaultDiskThreshold = 0.95 DefaultLoadThreshold = 0.8 )
Default threshold
Variables ¶
var BastionMap ssh.BastionMapType
BastionMap is a map of bastion
Functions ¶
This section is empty.
Types ¶
type Basic ¶
type Basic struct { base.DefaultProbe `yaml:",inline"` HostName string `yaml:"hostname"` OS string `yaml:"os"` Core int64 `yaml:"core"` // contains filtered or unexported fields }
Basic is the basic information of the host
func (*Basic) CheckThreshold ¶
CheckThreshold check the cpu usage
func (*Basic) CreateMetrics ¶
CreateMetrics create the cpu metrics
func (*Basic) ExportMetrics ¶
ExportMetrics export the cpu metrics
func (*Basic) OutputLines ¶
OutputLines returns the lines of command output
func (*Basic) SetThreshold ¶
SetThreshold set the basic threshold
type CPU ¶
type CPU struct { base.DefaultProbe `yaml:",inline"` User float64 `yaml:"user"` Sys float64 `yaml:"sys"` Nice float64 `yaml:"nice"` Idle float64 `yaml:"idle"` Wait float64 `yaml:"wait"` Hard float64 `yaml:"hard"` Soft float64 `yaml:"soft"` Steal float64 `yaml:"steal"` Threshold float64 `yaml:"threshold"` // contains filtered or unexported fields }
CPU is the cpu usage "1.6 us, 1.6 sy, 3.2 ni, 91.9 id, 1.6 wa, 0.0 hi, 0.0 si, 0.0 st"
func (*CPU) CheckThreshold ¶
CheckThreshold check the cpu usage
func (*CPU) CreateMetrics ¶
CreateMetrics create the cpu metrics
func (*CPU) ExportMetrics ¶
ExportMetrics export the cpu metrics
func (*CPU) OutputLines ¶
OutputLines returns the lines of command output
func (*CPU) SetThreshold ¶
SetThreshold set the cpu threshold
type Disks ¶
type Disks struct { base.DefaultProbe Mount []string Usage []ResourceUsage Threshold float64 // contains filtered or unexported fields }
Disks is the disk usage
func (*Disks) CheckThreshold ¶
CheckThreshold check the cpu usage
func (*Disks) CreateMetrics ¶
CreateMetrics create the disk metrics
func (*Disks) ExportMetrics ¶
ExportMetrics export the disk metrics
func (*Disks) OutputLines ¶
OutputLines returns the lines of command output
func (*Disks) SetThreshold ¶
SetThreshold set the threshold of the disk
type Host ¶
type Host struct { Bastion *ssh.BastionMapType `` /* 129-byte string literal not displayed */ Servers []Server `yaml:"servers" json:"servers" jsonschema:"required,title=Host Servers,description=the host servers to be monitored"` }
Host is the host probe configuration
type IMetrics ¶
type IMetrics interface { Name() string // Name is the name of the metrics Command() string // Command returns the command to get the metrics OutputLines() int // OutputLines returns the lines of command output Config(s *Server) // Config returns the config of the metrics SetThreshold(t *Threshold) // SetThreshold sets the threshold of the metrics Parse(s []string) error // Parse a string to a metrics struct UsageInfo() string // UsageInfo returns the usage info of the metrics CheckThreshold() (bool, string) // CheckThreshold check the metrics usage CreateMetrics(kind, tag string) // CreateMetrics creates the metrics ExportMetrics(name string) // ExportMetrics export the metrics }
IMetrics is the interface of metrics
type Info ¶
type Info struct { Basic `yaml:",inline"` CPU CPU `yaml:"cpu"` Memory Mem `yaml:"memory"` Disks Disks `yaml:"disks"` Load Load `yaml:"load"` }
Info is the host probe information
type Load ¶
type Load struct { base.DefaultProbe `yaml:",inline"` Core int64 `json:"core"` Metrics map[string]float64 `json:"metrics"` Threshold map[string]float64 // contains filtered or unexported fields }
Load is the load average of the host
func (*Load) CheckThreshold ¶
CheckThreshold check the load average threshold
func (*Load) CreateMetrics ¶
CreateMetrics create the load average metrics
func (*Load) ExportMetrics ¶
ExportMetrics export the load average metrics
func (*Load) OutputLines ¶
OutputLines returns the lines of command output
func (*Load) SetThreshold ¶
SetThreshold set the threshold of the load average
type Mem ¶
type Mem struct { base.DefaultProbe `yaml:",inline"` ResourceUsage `yaml:",inline"` Threshold float64 `yaml:"threshold"` // contains filtered or unexported fields }
Mem is the resource usage for memory and disk
func (*Mem) CheckThreshold ¶
CheckThreshold check the memory usage
func (*Mem) CreateMetrics ¶
CreateMetrics create the memory metrics
func (*Mem) ExportMetrics ¶
ExportMetrics export the memory metrics
func (*Mem) OutputLines ¶
OutputLines returns the lines of command output
func (*Mem) SetThreshold ¶
SetThreshold set the threshold of the memory
type ResourceUsage ¶
type ResourceUsage struct { Used int `yaml:"used"` Total int `yaml:"total"` Usage float64 `yaml:"usage"` Tag string `yaml:"tag"` }
ResourceUsage is the resource usage for cpu and memory
type Server ¶
type Server struct { ssh.Server `yaml:",inline"` Threshold Threshold `` /* 141-byte string literal not displayed */ Disks []string `` /* 135-byte string literal not displayed */ // contains filtered or unexported fields }
Server is the server of a host probe
func (*Server) CheckThreshold ¶
CheckThreshold check the threshold
func (*Server) Config ¶
func (s *Server) Config(gConf global.ProbeSettings) error
Config is the host probe configuration
func (*Server) ParseHostInfo ¶
ParseHostInfo parse the host info
type Threshold ¶
type Threshold struct { CPU float64 `yaml:"cpu,omitempty" json:"cpu,omitempty" jsonschema:"title=CPU threshold,description=CPU threshold (default: 0.8)"` Mem float64 `yaml:"mem,omitempty" json:"mem,omitempty" jsonschema:"title=Memory threshold,description=Memory threshold (default: 0.8)"` Disk float64 `yaml:"disk,omitempty" json:"disk,omitempty" jsonschema:"title=Disk threshold,description=Disk threshold (default: 0.95)"` Load map[string]float64 `` /* 145-byte string literal not displayed */ }
Threshold is the threshold of a probe