Commit 8ac635b6 by bergquist

style(alerting): change const names

parent 957cb407
......@@ -15,18 +15,18 @@ type AlertState struct {
var (
VALID_STATES = []string{
ALERT_STATE_OK,
ALERT_STATE_WARN,
ALERT_STATE_CRITICAL,
ALERT_STATE_ACKNOWLEDGED,
ALERT_STATE_MAINTENANCE,
AlertStateOk,
AlertStateWarn,
AlertStateCritical,
AlertStateAcknowledged,
AlertStateMaintenance,
}
ALERT_STATE_OK = "OK"
ALERT_STATE_WARN = "WARN"
ALERT_STATE_CRITICAL = "CRITICAL"
ALERT_STATE_ACKNOWLEDGED = "ACKNOWLEDGED"
ALERT_STATE_MAINTENANCE = "MAINTENANCE"
AlertStateOk = "OK"
AlertStateWarn = "WARN"
AlertStateCritical = "CRITICAL"
AlertStateAcknowledged = "ACKNOWLEDGED"
AlertStateMaintenance = "MAINTENANCE"
)
func (this *UpdateAlertStateCommand) IsValidState() bool {
......
......@@ -44,23 +44,23 @@ func (this *GraphiteExecutor) executeRules(series []Series, rule m.AlertRule) *A
avg = sum / float64(len(v.Datapoints))
if float64(rule.CritLevel) < avg {
return &AlertResult{State: m.ALERT_STATE_CRITICAL, Id: rule.Id, ActualValue: avg}
return &AlertResult{State: m.AlertStateCritical, Id: rule.Id, ActualValue: avg}
}
if float64(rule.WarnLevel) < avg {
return &AlertResult{State: m.ALERT_STATE_WARN, Id: rule.Id, ActualValue: avg}
return &AlertResult{State: m.AlertStateWarn, Id: rule.Id, ActualValue: avg}
}
if float64(rule.CritLevel) < sum {
return &AlertResult{State: m.ALERT_STATE_CRITICAL, Id: rule.Id, ActualValue: sum}
return &AlertResult{State: m.AlertStateCritical, Id: rule.Id, ActualValue: sum}
}
if float64(rule.WarnLevel) < sum {
return &AlertResult{State: m.ALERT_STATE_WARN, Id: rule.Id, ActualValue: sum}
return &AlertResult{State: m.AlertStateWarn, Id: rule.Id, ActualValue: sum}
}
}
return &AlertResult{State: m.ALERT_STATE_OK, Id: rule.Id}
return &AlertResult{State: m.AlertStateOk, Id: rule.Id}
}
func (this *GraphiteExecutor) getSeries(rule m.AlertRule) (Response, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment