alerting.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package dtos
  2. import (
  3. "time"
  4. "github.com/grafana/grafana/pkg/components/simplejson"
  5. m "github.com/grafana/grafana/pkg/models"
  6. )
  7. type AlertRule struct {
  8. Id int64 `json:"id"`
  9. DashboardId int64 `json:"dashboardId"`
  10. PanelId int64 `json:"panelId"`
  11. Name string `json:"name"`
  12. Message string `json:"message"`
  13. State m.AlertStateType `json:"state"`
  14. Severity m.AlertSeverityType `json:"severity"`
  15. NewStateDate time.Time `json:"newStateDate"`
  16. EvalDate time.Time `json:"evalDate"`
  17. ExecutionError string `json:"executionError"`
  18. DashbboardUri string `json:"dashboardUri"`
  19. }
  20. type AlertNotification struct {
  21. Id int64 `json:"id"`
  22. Name string `json:"name"`
  23. Type string `json:"type"`
  24. Created time.Time `json:"created"`
  25. Updated time.Time `json:"updated"`
  26. }
  27. type AlertTestCommand struct {
  28. Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
  29. PanelId int64 `json:"panelId" binding:"Required"`
  30. }
  31. type AlertTestResult struct {
  32. Firing bool `json:"firing"`
  33. TimeMs string `json:"timeMs"`
  34. Error string `json:"error,omitempty"`
  35. Logs []*AlertTestResultLog `json:"logs,omitempty"`
  36. }
  37. type AlertTestResultLog struct {
  38. Message string `json:"message"`
  39. Data interface{} `json:"data"`
  40. }
  41. type AlertEvent struct {
  42. Metric string `json:"metric"`
  43. Value float64 `json:"value"`
  44. }