[FIX] fix the bug

This commit is contained in:
goodrain 2017-11-23 17:05:44 +08:00
parent 4a56a092d4
commit 6b0fb1bda3
2 changed files with 10 additions and 12 deletions

View File

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

View File

@ -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
// }