alerting.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. DashbboardUri string `json:"dashboardUri"`
  16. }
  17. type AlertNotification struct {
  18. Id int64 `json:"id"`
  19. Name string `json:"name"`
  20. Type string `json:"type"`
  21. Created time.Time `json:"created"`
  22. Updated time.Time `json:"updated"`
  23. }
  24. type AlertTestCommand struct {
  25. Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
  26. PanelId int64 `json:"panelId" binding:"Required"`
  27. }
  28. type AlertTestResult struct {
  29. Firing bool `json:"firing"`
  30. TimeMs string `json:"timeMs"`
  31. Error string `json:"error,omitempty"`
  32. Logs []*AlertTestResultLog `json:"logs,omitempty"`
  33. }
  34. type AlertTestResultLog struct {
  35. Message string `json:"message"`
  36. Data interface{} `json:"data"`
  37. }
  38. type AlertEvent struct {
  39. Metric string `json:"metric"`
  40. Value float64 `json:"value"`
  41. }