2016-05-23 18:15:36 +08:00
|
|
|
package alerting
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/grafana/grafana/pkg/log"
|
|
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Executor interface {
|
2016-05-23 23:04:57 +08:00
|
|
|
Execute(rule m.AlertRule, responseQueue chan *AlertResult)
|
2016-05-23 18:15:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DummieExecutor struct{}
|
|
|
|
|
|
2016-05-23 23:04:57 +08:00
|
|
|
func (this DummieExecutor) Execute(rule m.AlertRule, responseQueue chan *AlertResult) {
|
|
|
|
|
//if rule.Id == 6 {
|
|
|
|
|
// time.Sleep(time.Second * 60)
|
|
|
|
|
//}
|
2016-05-23 18:15:36 +08:00
|
|
|
time.Sleep(time.Second)
|
|
|
|
|
log.Info("Finnished executing: %d", rule.Id)
|
2016-05-23 23:04:57 +08:00
|
|
|
responseQueue <- &AlertResult{state: "OK", id: rule.Id}
|
|
|
|
|
//return nil,
|
2016-05-23 18:15:36 +08:00
|
|
|
}
|