Start enterprise service on boot / placeholders
Adds the enterprise service to the agent's boot process. A few placeholders have been added because it's not quite clear how we should generate ProductIDs and ClusterIDs for Telegraf
This commit is contained in:
parent
7394375a2e
commit
c3c9e80f0a
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue