chronograf/kapacitor/triggers.go

19 lines
469 B
Go
Raw Normal View History

2016-11-03 00:59:25 +00:00
package kapacitor
import "github.com/influxdata/chronograf"
import "fmt"
// Trigger returns the trigger mechanism for a tickscript
func Trigger(rule chronograf.AlertRule) (string, error) {
switch rule.Trigger {
case "deadman":
return DeadmanTrigger, nil
case "relative":
return execTemplate(RelativeTrigger, rule)
case "threshold":
return execTemplate(ThresholdTrigger, rule)
default:
return "", fmt.Errorf("Unknown trigger type: %s", rule.Trigger)
2016-11-03 00:59:25 +00:00
}
}