feat(alerting): add aggregator field

This commit is contained in:
bergquist 2016-04-18 11:10:52 +02:00
parent bcf10a6483
commit 769016783f
2 changed files with 26 additions and 23 deletions

View File

@ -5,17 +5,18 @@ import (
)
type Alert struct {
Id int64
DashboardId int64
PanelId int64
Query string
QueryRefId string
WarnLevel int64
ErrorLevel int64
CheckInterval string
Title string
Description string
QueryRange string
Id int64
DashboardId int64
PanelId int64
Query string
QueryRefId string
WarnLevel int64
ErrorLevel int64
Interval string
Title string
Description string
QueryRange string
Aggregator string
}
func (cmd *SaveDashboardCommand) GetAlertModels() *[]Alert {
@ -24,17 +25,18 @@ func (cmd *SaveDashboardCommand) GetAlertModels() *[]Alert {
alerts := make([]Alert, 0)
alerts = append(alerts, Alert{
DashboardId: dash.Id,
Id: 1,
PanelId: 1,
Query: "",
QueryRefId: "",
WarnLevel: 0,
ErrorLevel: 0,
CheckInterval: "5s",
Title: dash.Title + " Alert",
Description: dash.Title + " Description",
QueryRange: "10m",
DashboardId: dash.Id,
Id: 1,
PanelId: 1,
Query: "query",
QueryRefId: "query_ref",
WarnLevel: 0,
ErrorLevel: 0,
Interval: "5s",
Title: dash.Title + " Alert",
Description: dash.Title + " Description",
QueryRange: "10m",
Aggregator: "avg",
})
return &alerts

View File

@ -15,10 +15,11 @@ func addAlertMigrations(mg *Migrator) {
{Name: "query_ref_id", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "warn_level", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "error_level", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "check_interval", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "interval", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "description", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "query_range", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "aggregator", Type: DB_NVarchar, Length: 255, Nullable: false},
},
}