monitor_resource.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package monitor
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/onecloud/pkg/apis"
  18. "yunion.io/x/onecloud/pkg/apis/compute"
  19. )
  20. const (
  21. MONITOR_RESOURCE_ALERT_STATUS_INIT = "init"
  22. MONITOR_RESOURCE_ALERT_STATUS_ATTACH = "attach"
  23. MONITOR_RESOURCE_ALERT_STATUS_ALERTING = "alerting"
  24. )
  25. type MonitorResourceCreateInput struct {
  26. apis.VirtualResourceCreateInput
  27. apis.EnabledBaseResourceCreateInput
  28. ResId string `json:"res_id"`
  29. ResType string `json:"res_type"`
  30. AlertStatus string `json:"alert_status"`
  31. }
  32. type MonitorResourceListInput struct {
  33. apis.VirtualResourceListInput
  34. apis.EnabledResourceBaseListInput
  35. compute.ManagedResourceListInput
  36. ResId []string `json:"res_id"`
  37. ResType string `json:"res_type"`
  38. OnlyResId bool `json:"only_res_id"`
  39. AlertStates []string `json:"alert_states"`
  40. ResName string `json:"res_name"`
  41. // Top 查询参数(用于统计报警数量最多的资源)
  42. TopQueryInput
  43. }
  44. type MonitorResourceDetails struct {
  45. apis.VirtualResourceDetails
  46. compute.CloudregionResourceInfo
  47. compute.CloudaccountResourceInfo
  48. Ips string `json:"ips"`
  49. AccessIp string `json:"access_ip"`
  50. AttachAlertCount int64 `json:"attach_alert_count"`
  51. Hypervisor string `json:"hypervisor"`
  52. }
  53. type MonitorResourceDoActionInput struct {
  54. Action string `json:"action"`
  55. Data jsonutils.JSONObject `json:"data"`
  56. }