site_check

package
v0.0.0-...-07ef6c8 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Artistic-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	//TcpSites []*TcpSite `yaml:"tcp_sites"`
	//UdpSites []*UdpSite `yaml:"udp_sites"`
	//
	//PingSites []*PingSite `yaml:"ping_sites"`
	HttpSites []*HttpSite `yaml:"http_sites"`
}

type HttpSite

type HttpSite struct {
	Name                 string `yaml:"name"`
	SiteAddress          string `yaml:"site_address"`
	ApiName              string `yaml:"api_name"`
	MonitorResult        *models.MonitorResult
	Method               string   `yaml:"method"`
	Headers              []string `yaml:"headers"`
	IsMtls               bool     `yaml:"is_mtls"`
	CertPath             string   `yaml:"cert_path"`
	KeyPath              string   `yaml:"key_path"`
	IsUseRegexp          bool     `yaml:"is_use_regexp"`
	ContainRegexpContent string   `yaml:"contain_regexp_content"`
	ExcludeRegexpContent string   `yaml:"exclude_regexp_content"`
}

func (*HttpSite) CheckResult

func (hs *HttpSite) CheckResult() error

func (*HttpSite) DingdingContent

func (hs *HttpSite) DingdingContent() string

func (*HttpSite) DisplayResult

func (hs *HttpSite) DisplayResult()

func (*HttpSite) LinuxContent

func (hs *HttpSite) LinuxContent() string

func (*HttpSite) MonitorOnce

func (hs *HttpSite) MonitorOnce()

func (*HttpSite) SayName

func (hs *HttpSite) SayName()

type Site

type Site interface {
	MonitorOnce()
	DisplayResult()
	SayName()
	CheckResult() error
	DingdingContent() string
	LinuxContent() string
}

type SiteCheck

type SiteCheck interface {
	//增加站点
	AddSite(name string, site Site)
	//批量监控
	MonitorAll()
	//单独监控某个
	MonitorOne(name string)
	//
	ReadConfig(yamlFile string) error
	//
	Summary(displayType string) (string, error)
	//
	CheckAll() error
	//
	CheckOne(name string) error
	//
	CheckOneDuration(name string, totalSecond int, intervalSecond int) bool
}
var (
	GlobalLogger      *zap.Logger
	GlobalSiteChecker SiteCheck
)

func NewSiteChecker

func NewSiteChecker() SiteCheck

type SiteChecker

type SiteChecker struct {
	sync.Mutex
	//
	SiteMap map[string]Site
}

func (*SiteChecker) AddSite

func (sc *SiteChecker) AddSite(name string, site Site)

func (*SiteChecker) CheckAll

func (sc *SiteChecker) CheckAll() error

func (*SiteChecker) CheckOne

func (sc *SiteChecker) CheckOne(name string) error

func (*SiteChecker) CheckOneDuration

func (sc *SiteChecker) CheckOneDuration(name string, totalSecond int, intervalSecond int) bool

func (*SiteChecker) MonitorAll

func (sc *SiteChecker) MonitorAll()

func (*SiteChecker) MonitorOne

func (sc *SiteChecker) MonitorOne(name string)

func (*SiteChecker) ReadConfig

func (sc *SiteChecker) ReadConfig(yamlFile string) error

func (*SiteChecker) Summary

func (sc *SiteChecker) Summary(displayType string) (string, error)

Jump to

Keyboard shortcuts

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