Пример #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
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
}