n9e源码阅读
whz-emm
这个作者很懒,什么都没留下…
展开
-
n9e源码阅读-agent-3-添加自定义系统指标采集
1. monStart采集监控指标,从该函数开始func main() { ... if config.Config.Enable.Mon { monStart() } ...}func monStart() { ... //采集系统指标 funcs.BuildMappers() funcs.Collect() ...}2. 添加自定义指标type FuncsAndInterval struct { Fs []fun原创 2021-03-24 16:16:39 · 432 阅读 · 0 评论 -
n9e源码阅读-agent-3-添加agent上报信息
1. reportStart()函数上报本机信息给ams,从该函数开始func main() { ... if config.Config.Enable.Report { reportStart() } ...2. 定时循环上报func reportStart() { go report.LoopReport()}func LoopReport() { duration := time.Duration(config.Config.Report.Inter..原创 2021-03-24 10:15:17 · 1545 阅读 · 0 评论 -
n9e源码阅读-agent-2-log&toolkits/pkg/logger使用
package mainimport ( "fmt" "github.com/toolkits/pkg/logger" "os")type Config struct { Dir string `yaml:"dir"` Level string `yaml:"level"` KeepHours uint `yaml:"keepHours"`}//详情请看https://github.com/toolkits/pkg/tree/master/logger.原创 2021-01-29 16:28:37 · 317 阅读 · 0 评论 -
n9e源码阅读-agent-1-配置文件解析&viper使用
package mainimport ( "bytes" "fmt" "github.com/spf13/viper" "io/ioutil" "time")type ConfigT struct { Stra straSection `yaml:"stra"` Worker workerSection `yaml:"worker"` Enable enableSection `yaml:"enable"` Job jobSection `y.原创 2021-01-28 15:56:54 · 991 阅读 · 0 评论