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 }
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)) }) }
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 }
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 }