Example #1
0
func syncAlarmRedisInfo(errRedis chan string, conf *config.Config) {
	select {
	case err := <-errRedis:
		server.SendInfo(conf.Collector.AlarmUrl, conf.Collector.AcceptType, conf.Collector.ConnTimeout, err)
	case <-time.After(1 * time.Second):
	}
}
Example #2
0
//syncNodeInfo 同步机器节点信息
func syncNodeInfo(conf *config.Config) {
	// sync node base mem cpu and net etc infos
	go func(conf *config.Config) {
		sysStat, err := sys.GetSysStat(conf.Server)
		var curSysStat *sys.SysStat
		if err == nil {
			curSysStat = sys.CopyOne(sysStat)
		}
		returnServer["info"] = curSysStat
		returnServer["type"] = "nodeinfo"
		ssj, err := json.Marshal(returnServer)
		server.SendInfo(conf.Collector.CollectUrl, conf.Collector.AcceptType, conf.Collector.ConnTimeout, string(ssj))
	}(conf)
}
Example #3
0
//syncRedisBaseInfo 同步redis性能信息
func syncRedisBaseInfo(res *sys.Redises, conf *config.Config) {
	// sync redis info
	go func(conf *config.Config) {
		rs := res.GetReidsInfo(conf)
		returnServer["info"] = rs
		returnServer["type"] = "redisinfo"
		info, err := json.Marshal(returnServer)
		if err != nil {
			log.Println("syncRedisBaseInfo 获取redis信息执行错误", err)
		} else {
			server.SendInfo(conf.Collector.CollectUrl, conf.Collector.AcceptType, conf.Collector.ConnTimeout, string(info))
		}
	}(conf)
}