k8s.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 measurements
  15. import "yunion.io/x/onecloud/pkg/apis/monitor"
  16. var k8sPod = SMeasurement{
  17. Context: []SMonitorContext{
  18. {
  19. Name: "k8s_pod",
  20. DisplayName: "k8s pod",
  21. ResourceType: monitor.METRIC_RES_TYPE_K8S,
  22. Database: monitor.METRIC_DATABASE_TELE,
  23. },
  24. },
  25. Metrics: []SMetric{
  26. {
  27. Name: "cpu_used_percent",
  28. DisplayName: "CPU active state utilization rate",
  29. Unit: monitor.METRIC_UNIT_PERCENT,
  30. },
  31. {
  32. Name: "mem_used_percent",
  33. DisplayName: "Used memory rate",
  34. Unit: monitor.METRIC_UNIT_PERCENT,
  35. },
  36. {
  37. Name: "restart_total",
  38. DisplayName: "pod restart count",
  39. Unit: monitor.METRIC_UNIT_COUNT,
  40. },
  41. },
  42. }
  43. var k8sDeploy = SMeasurement{
  44. Context: []SMonitorContext{
  45. {
  46. Name: "k8s_deploy",
  47. DisplayName: "k8s deploy",
  48. ResourceType: monitor.METRIC_RES_TYPE_K8S,
  49. Database: monitor.METRIC_DATABASE_TELE,
  50. },
  51. },
  52. Metrics: []SMetric{
  53. {
  54. Name: "pod_oom_total",
  55. DisplayName: "oom pod count",
  56. Unit: monitor.METRIC_UNIT_COUNT,
  57. },
  58. {
  59. Name: "pod_restarting_total",
  60. DisplayName: "restarting pod count",
  61. Unit: monitor.METRIC_UNIT_COUNT,
  62. },
  63. },
  64. }
  65. var k8sNode = SMeasurement{
  66. Context: []SMonitorContext{
  67. {
  68. Name: "k8s_node",
  69. DisplayName: "k8s node",
  70. ResourceType: monitor.METRIC_RES_TYPE_K8S,
  71. Database: monitor.METRIC_DATABASE_TELE,
  72. },
  73. },
  74. Metrics: []SMetric{
  75. {
  76. "cpu_used_percent", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT,
  77. },
  78. {
  79. "mem_used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT,
  80. },
  81. {
  82. "disk_used_percent", "Percentage of used disks", monitor.METRIC_UNIT_PERCENT,
  83. },
  84. {
  85. "bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS,
  86. },
  87. {
  88. "bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS,
  89. },
  90. {
  91. "pod_restart_total", "pod restart count in node", monitor.METRIC_UNIT_COUNT,
  92. },
  93. },
  94. }