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

@ -12,10 +12,11 @@ type Alert struct {
QueryRefId string QueryRefId string
WarnLevel int64 WarnLevel int64
ErrorLevel int64 ErrorLevel int64
CheckInterval string Interval string
Title string Title string
Description string Description string
QueryRange string QueryRange string
Aggregator string
} }
func (cmd *SaveDashboardCommand) GetAlertModels() *[]Alert { func (cmd *SaveDashboardCommand) GetAlertModels() *[]Alert {
@ -27,14 +28,15 @@ func (cmd *SaveDashboardCommand) GetAlertModels() *[]Alert {
DashboardId: dash.Id, DashboardId: dash.Id,
Id: 1, Id: 1,
PanelId: 1, PanelId: 1,
Query: "", Query: "query",
QueryRefId: "", QueryRefId: "query_ref",
WarnLevel: 0, WarnLevel: 0,
ErrorLevel: 0, ErrorLevel: 0,
CheckInterval: "5s", Interval: "5s",
Title: dash.Title + " Alert", Title: dash.Title + " Alert",
Description: dash.Title + " Description", Description: dash.Title + " Description",
QueryRange: "10m", QueryRange: "10m",
Aggregator: "avg",
}) })
return &alerts return &alerts

View File

@ -15,10 +15,11 @@ func addAlertMigrations(mg *Migrator) {
{Name: "query_ref_id", Type: DB_NVarchar, Length: 255, Nullable: false}, {Name: "query_ref_id", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "warn_level", 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: "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: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "description", 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: "query_range", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "aggregator", Type: DB_NVarchar, Length: 255, Nullable: false},
}, },
} }