diff --git a/agent/agent.go b/agent/agent.go index bd52e7875..41a5552c5 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -14,6 +14,7 @@ import ( "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal/config" "github.com/influxdata/telegraf/internal/models" + "github.com/influxdata/telegraf/services/enterprise" ) // Agent runs telegraf and collects data based on the given config @@ -328,6 +329,9 @@ func (a *Agent) Run(shutdown chan struct{}) error { } ticker := time.NewTicker(a.Config.Agent.Interval.Duration) + ent := enterprise.NewEnterprise(a.Config.Agent.Enterprise, a.Config.Agent.Hostname, shutdown) + go ent.Open() + wg.Add(1) go func() { defer wg.Done() diff --git a/internal/config/config.go b/internal/config/config.go index ffd4f632a..522b91597 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -17,6 +17,7 @@ import ( "github.com/influxdata/telegraf/plugins/outputs" "github.com/influxdata/telegraf/plugins/parsers" "github.com/influxdata/telegraf/plugins/serializers" + "github.com/influxdata/telegraf/services/enterprise" "github.com/influxdata/config" "github.com/naoina/toml/ast" @@ -94,6 +95,8 @@ type AgentConfig struct { // Quiet is the option for running in quiet mode Quiet bool Hostname string + + Enterprise enterprise.Config } // Inputs returns a list of strings of the configured inputs. diff --git a/services/enterprise/enterprise.go b/services/enterprise/enterprise.go index c8f6d5240..999c9334e 100644 --- a/services/enterprise/enterprise.go +++ b/services/enterprise/enterprise.go @@ -56,8 +56,12 @@ func (s *Service) Open() { func (s *Service) registerProduct(cl *client.Client) (token string, secret string, err error) { p := client.Product{ - ProductID: "telegraf", + ProductID: "4815162342", Host: s.hostname, + ClusterID: "8675309", + Name: "telegraf", + Version: "0.10.1.dev", + AdminURL: "http://" + s.hostname + s.adminPort, } _, err = cl.Register(&p)