host

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package host is the host probe package

Index

Constants

View Source
const (
	DefaultCPUThreshold  = 0.8
	DefaultMemThreshold  = 0.8
	DefaultDiskThreshold = 0.95
)

Default threshold

Variables

View Source
var BastionMap ssh.BastionMapType

BastionMap is a map of bastion

Functions

This section is empty.

Types

type CPU

type CPU struct {
	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"`
}

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) Parse

func (c *CPU) Parse(s string) error

Parse a string to a CPU struct

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 Info

type Info struct {
	HostName string  `yaml:"hostname"`
	OS       string  `yaml:"os"`
	Core     int64   `yaml:"core"`
	CPU      CPU     `yaml:"cpu"`
	Memory   Usage   `yaml:"memory"`
	Disks    []Usage `yaml:"disks"`
}

Info is the host probe information

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

func (s *Server) CheckThreshold(info Info) (bool, string)

CheckThreshold check the threshold

func (*Server) Config

func (s *Server) Config(gConf global.ProbeSettings) error

Config is the host probe configuration

func (*Server) DoProbe

func (s *Server) DoProbe() (bool, string)

DoProbe return the checking result

func (*Server) ExportCPUMetrics added in v1.5.0

func (s *Server) ExportCPUMetrics(info *Info)

ExportCPUMetrics export the cpu metrics

func (*Server) ExportDiskMetrics added in v1.5.0

func (s *Server) ExportDiskMetrics(info *Info)

ExportDiskMetrics export the disk metrics

func (*Server) ExportMemoryMetrics added in v1.5.0

func (s *Server) ExportMemoryMetrics(info *Info)

ExportMemoryMetrics export the memory metrics

func (*Server) ExportMetrics added in v1.5.0

func (s *Server) ExportMetrics(info *Info)

ExportMetrics export the metrics

func (*Server) ParseHostInfo

func (s *Server) ParseHostInfo(str string) (Info, error)

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)"`
}

Threshold is the threshold of a probe

func (*Threshold) String

func (t *Threshold) String() string

type Usage

type Usage struct {
	Used  int     `yaml:"used"`
	Total int     `yaml:"total"`
	Usage float64 `yaml:"usage"`
	Tag   string  `yaml:"tag"`
}

Usage is the resource usage for memory and disk

Jump to

Keyboard shortcuts

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