diff --git a/collector.go b/collector.go index 4b67c78..11bca8d 100644 --- a/collector.go +++ b/collector.go @@ -12,7 +12,9 @@ import ( "path/filepath" "strings" "time" - //crm "loafle.com/overflow/crawler_manager_go" + crm "loafle.com/overflow/crawler_manager_go" + "context" + g "loafle.com/overflow/crawler_go/grpc" ) const CONFIG_ROOT = "/config/container" @@ -48,24 +50,24 @@ func (c *Collector) collect(id string) { log.Printf("COLLECT %s - [ID: %s] [Crawler : %s]", time.Now(), conf.Id, conf.Crawler.Name) - //conn, err := crm.GetClient(conf.Crawler.Container) - //if err != nil { - // log.Println(err) - //} - //defer conn.Close() + conn, err := crm.GetInstance().GetClient(conf.Crawler.Container) + if err != nil { + log.Println(err) + } + defer conn.Close() - //dc := g.NewDataClient(conn); - //in := &g.Input{} - // - //in.Id = id - //in.Name = g.Crawlers_HEALTH_MONGODB - // - //out, err := dc.Get(context.Background(), in) - // - //if err != nil { - // log.Println(err) - //} - //log.Println(out) + dc := g.NewDataClient(conn); + in := &g.Input{} + + in.Id = id + in.Name = g.Crawlers(g.Crawlers_value[conf.Crawler.Name]) + + out, err := dc.Get(context.Background(), in) + + if err != nil { + log.Println(err) + } + log.Println(out) } func (c *Collector) AddSensor(path string) {