2016-04-27 19:02:28 +08:00
|
|
|
package dtos
|
|
|
|
|
|
2016-07-20 22:13:36 +08:00
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
2016-07-22 19:14:09 +08:00
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
2016-07-20 22:13:36 +08:00
|
|
|
)
|
2016-06-20 17:31:20 +08:00
|
|
|
|
2016-07-22 22:45:17 +08:00
|
|
|
type AlertRule struct {
|
2016-08-16 15:52:45 +08: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 19:02:28 +08:00
|
|
|
}
|
2016-06-20 17:31:20 +08:00
|
|
|
|
2016-07-22 22:45:17 +08:00
|
|
|
type AlertNotification struct {
|
2016-06-20 17:31:20 +08: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 22:13:36 +08:00
|
|
|
|
2016-07-21 16:29:11 +08:00
|
|
|
type AlertTestCommand struct {
|
|
|
|
|
Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
|
|
|
|
|
PanelId int64 `json:"panelId" binding:"Required"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type AlertTestResult struct {
|
2016-07-22 19:14:09 +08:00
|
|
|
Firing bool `json:"firing"`
|
2016-07-26 18:29:52 +08:00
|
|
|
TimeMs string `json:"timeMs"`
|
2016-07-22 19:14:09 +08:00
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
|
Logs []*AlertTestResultLog `json:"logs,omitempty"`
|
2016-07-21 19:09:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type AlertTestResultLog struct {
|
|
|
|
|
Message string `json:"message"`
|
|
|
|
|
Data interface{} `json:"data"`
|
2016-07-20 22:13:36 +08:00
|
|
|
}
|
2016-07-22 03:54:12 +08:00
|
|
|
|
|
|
|
|
type AlertEvent struct {
|
|
|
|
|
Metric string `json:"metric"`
|
|
|
|
|
Value float64 `json:"value"`
|
|
|
|
|
}
|