global

package
v0.0.0-...-982fff5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: AFL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Agent        = "Agent"
	ReportServer = "ReportServer"
	Etcd         = "Etcd"
)

不变的三个配置项

View Source
const (
	MetricsNum = 4 //总指标数,只是用于初始化空间
	CpuRate    = "cpu_rate"
	MemUsed    = "memory_used"
	DiskUsed   = "disk_used"
	CpuMem     = "cpu_mem"
)

Variables

View Source
var (
	Split           = "/" //用于监控etcd连接 AgentGroup、AgentName、配置项的字符串
	SendErrorLimit  int   //连续发送失败次数尝试
	CheckAlive      int   //本Agent可能最长多长时间不上报
	AggregationTime int64 //上报几次进行聚合

	ConfigServer string //本Agent需连接的etcd上的修改配置的服务
	AgentGroup   string //本Agent所属etcd上的群组
	AgentName    string ////本Agent在etcd上的名称

	EtcdOnline          bool                 //etcd配置正常工作
	EtcdChange          = make(chan bool, 1) //etcd有变,开始监听etcd
	HandleChangeSuccess bool                 //etcd变化处理成功标识

	Logger = log.New(os.Stdout, "<Agent>", log.Lshortfile|log.Ldate|log.Ltime)
)
View Source
var (
	Metrics     = make(map[string]interface{}, MetricsNum) //K:指标名称 V:采样器(Sampler)
	MetricsName []string
)

Functions

func GetIP

func GetIP() string

func GetPause

func GetPause() bool

GetPause 读取Agent暂停状态,可能会有多个goroutine同时访问,加锁

func GetRegisterSuccess

func GetRegisterSuccess() bool

GetRegisterSuccess 读取Agent连接注册状态

func GetUId

func GetUId() string

func InitVar

func InitVar()

func SetPause

func SetPause(statPause bool)

SetPause 设置Agent暂停状态,可能会有多个goroutine同时访问,加锁

func SetRegisterSuccess

func SetRegisterSuccess(success bool)

GetRegisterSuccess 设置Agent连接注册状态

func SetUId

func SetUId(id string)

只在Register中使用

Types

This section is empty.

Jump to

Keyboard shortcuts

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