2016-04-27 06:02:28 -05:00
|
|
|
package dtos
|
|
|
|
|
2016-07-20 09:13:36 -05:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
2016-07-22 06:14:09 -05:00
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
2016-07-20 09:13:36 -05:00
|
|
|
)
|
2016-06-20 04:31:20 -05:00
|
|
|
|
2016-07-22 09:45:17 -05:00
|
|
|
type AlertRule struct {
|
2016-08-16 02:52:45 -05:00
|
|
|
Id int64 `json:"id"`
|
|
|
|
DashboardId int64 `json:"dashboardId"`
|
|
|
|
PanelId int64 `json:"panelId"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
State m.AlertStateType `json:"state"`
|
|
|
|
Severity m.AlertSeverityType `json:"severity"`
|
|
|
|
NewStateDate time.Time `json:"newStateDate"`
|
|
|
|
EvalDate time.Time `json:"evalDate"`
|
|
|
|
ExecutionError string `json:"executionError"`
|
|
|
|
DashbboardUri string `json:"dashboardUri"`
|
2016-04-27 06:02:28 -05:00
|
|
|
}
|
2016-06-20 04:31:20 -05:00
|
|
|
|
2016-07-22 09:45:17 -05:00
|
|
|
type AlertNotification struct {
|
2016-06-20 04:31:20 -05:00
|
|
|
Id int64 `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
Created time.Time `json:"created"`
|
|
|
|
Updated time.Time `json:"updated"`
|
|
|
|
}
|
2016-07-20 09:13:36 -05:00
|
|
|
|
2016-07-21 03:29:11 -05:00
|
|
|
type AlertTestCommand struct {
|
|
|
|
Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
|
|
|
|
PanelId int64 `json:"panelId" binding:"Required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type AlertTestResult struct {
|
2016-08-18 04:22:24 -05:00
|
|
|
Firing bool `json:"firing"`
|
|
|
|
TimeMs string `json:"timeMs"`
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
EvalMatches []*EvalMatch `json:"matches,omitempty"`
|
|
|
|
Logs []*AlertTestResultLog `json:"logs,omitempty"`
|
2016-07-21 06:09:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type AlertTestResultLog struct {
|
|
|
|
Message string `json:"message"`
|
|
|
|
Data interface{} `json:"data"`
|
2016-07-20 09:13:36 -05:00
|
|
|
}
|
2016-07-21 14:54:12 -05:00
|
|
|
|
2016-08-18 04:22:24 -05:00
|
|
|
type EvalMatch struct {
|
|
|
|
Tags map[string]string `json:"tags,omitempty"`
|
|
|
|
Metric string `json:"metric"`
|
|
|
|
Value float64 `json:"value"`
|
2016-07-21 14:54:12 -05:00
|
|
|
}
|