예제 #1
0
func (t *Agent) MinePlugins(args model.AgentHeartbeatRequest, reply *model.AgentPluginsResponse) error {
	if args.Hostname == "" {
		return nil
	}

	reply.Plugins = cache.GetPlugins(args.Hostname)
	reply.Timestamp = time.Now().Unix()

	return nil
}
예제 #2
0
func configProcRoutes() {
	http.HandleFunc("/expressions", func(w http.ResponseWriter, r *http.Request) {
		RenderDataJson(w, cache.ExpressionCache.Get())
	})

	http.HandleFunc("/plugins/", func(w http.ResponseWriter, r *http.Request) {
		hostname := r.URL.Path[len("/plugins/"):]
		RenderDataJson(w, cache.GetPlugins(hostname))
	})

}
예제 #3
0
func (t *Agent) MinePlugins(args model.AgentHeartbeatRequest, reply *model.AgentPluginsResponse) error {
	if args.Hostname == "" {
		return nil
	}

	reply.Plugins = cache.GetPlugins(args.Hostname)
	reply.Timestamp = time.Now().Unix()

	debug := g.Config().Debug
	if debug {
		log.Printf("[DEBUG] MinePlugins args is %v, reply is %v", args, reply)
	}

	return nil
}
예제 #4
0
파일: agent.go 프로젝트: peteryj/hbs
func (t *Agent) MinePlugins(args model.AgentHeartbeatRequest, reply *model.AgentPluginsResponse) error {
	if args.Hostname == "" {
		return nil
	}

	plugins := cache.GetPlugins(args.Hostname)
	checksum := ""
	if len(plugins) > 0 {
		checksum = utils.Md5(strings.Join(plugins, ""))
	}

	if args.Checksum == checksum {
		reply.Plugins = []string{}
	} else {
		reply.Plugins = plugins
	}

	reply.Checksum = checksum
	reply.Timestamp = time.Now().Unix()

	return nil
}