From 6b0fb1bda36a3fef38437f5368ce2fd4eb7c87f0 Mon Sep 17 00:00:00 2001 From: goodrain Date: Thu, 23 Nov 2017 17:05:44 +0800 Subject: [PATCH] [FIX] fix the bug --- cmd/node/node.go | 12 ------------ cmd/node/option/conf.go | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cmd/node/node.go b/cmd/node/node.go index 1a1ac56c6..ebbaede5e 100644 --- a/cmd/node/node.go +++ b/cmd/node/node.go @@ -22,23 +22,11 @@ import ( "fmt" "os" - "github.com/Sirupsen/logrus" "github.com/goodrain/rainbond/cmd/node/option" "github.com/goodrain/rainbond/cmd/node/server" - "github.com/prometheus/node_exporter/collector" ) func main() { - // This instance is only used to check collector creation and logging. - nc, err := collector.NewNodeCollector() - if err != nil { - logrus.Fatalf("Couldn't create collector: %s", err) - } - logrus.Infof("Enabled collectors:") - for n := range nc.Collectors { - logrus.Infof(" - %s", n) - } - option.Init() if err := server.Run(option.Config); err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) diff --git a/cmd/node/option/conf.go b/cmd/node/option/conf.go index 6aa902052..66236941d 100644 --- a/cmd/node/option/conf.go +++ b/cmd/node/option/conf.go @@ -27,6 +27,7 @@ import ( kingpin "gopkg.in/alecthomas/kingpin.v2" "github.com/goodrain/rainbond/pkg/node/utils" + "github.com/prometheus/node_exporter/collector" "github.com/Sirupsen/logrus" client "github.com/coreos/etcd/clientv3" @@ -58,6 +59,15 @@ func Init() error { return err } kingpin.Parse() + // This instance is only used to check collector creation and logging. + nc, err := collector.NewNodeCollector() + if err != nil { + logrus.Fatalf("Couldn't create collector: %s", err) + } + logrus.Infof("Enabled collectors:") + for n := range nc.Collectors { + logrus.Infof(" - %s", n) + } // if err := Config.watch(); err != nil { // return err // }