[FIX] fix bug

This commit is contained in:
zhoujunhao 2018-07-31 11:03:22 +08:00
parent 650d996857
commit 4f3cd226f7

View File

@ -74,7 +74,7 @@ func NewManager(config *option.Config) *Manager {
ScrapeInterval: model.Duration(time.Second * 5), ScrapeInterval: model.Duration(time.Second * 5),
EvaluationInterval: model.Duration(time.Second * 30), EvaluationInterval: model.Duration(time.Second * 30),
}, },
RuleFiles:[]string{"/etc/prometheus/rules.yml"}, RuleFiles:[]string{"/etc/prometheus/rules.yml", "/etc/prometheus/default_rules.yml"},
}, },
Registry: reg, Registry: reg,
httpClient: client, httpClient: client,
@ -103,13 +103,17 @@ func NewManager(config *option.Config) *Manager {
} }
m.SaveAlertingRulesConfig() m.SaveAlertingRulesConfig()
m.LoadConfig() m.LoadConfig()
m.LoadAlertingRulesConfig()
return m return m
} }
func (p *Manager) StartDaemon(errchan chan error) { func (p *Manager) StartDaemon(errchan chan error) {
p.LoadAlertingRulesConfig()
logrus.Info("Starting prometheus.") logrus.Info("Starting prometheus.")
for _,v := range p.AlertingRulesConfig.Groups{
fmt.Println(v.Name)
fmt.Println(v.Rules)
}
// start prometheus // start prometheus
procAttr := &os.ProcAttr{ procAttr := &os.ProcAttr{