vm_guest.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 vmCpu = SMeasurement{
  17. Context: []SMonitorContext{
  18. {
  19. "vm_cpu", "Guest CPU usage", monitor.METRIC_RES_TYPE_GUEST,
  20. monitor.METRIC_DATABASE_TELE,
  21. },
  22. },
  23. Metrics: []SMetric{
  24. {
  25. "usage_active", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT,
  26. },
  27. {
  28. "cpu_usage_pcore", "CPU utilization rate per core", monitor.METRIC_UNIT_PERCENT,
  29. },
  30. {
  31. "cpu_usage_idle_pcore", "CPU idle rate per core", monitor.METRIC_UNIT_PERCENT,
  32. },
  33. {
  34. "cpu_time_system", "CPU system state time", monitor.METRIC_UNIT_MS,
  35. },
  36. {
  37. "cpu_time_user", "CPU user state time", monitor.METRIC_UNIT_MS,
  38. },
  39. {
  40. "thread_count", "The number of threads used by the process", monitor.METRIC_UNIT_COUNT,
  41. },
  42. },
  43. }
  44. var vmMem = SMeasurement{
  45. Context: []SMonitorContext{
  46. {
  47. "vm_mem", "Guest memory", monitor.METRIC_RES_TYPE_GUEST,
  48. monitor.METRIC_DATABASE_TELE,
  49. },
  50. },
  51. Metrics: []SMetric{
  52. {
  53. "used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT,
  54. },
  55. {
  56. "vms", "Virtual memory consumption", monitor.METRIC_UNIT_BYTE,
  57. },
  58. {
  59. "rss", "Actual use of physical memory", monitor.METRIC_UNIT_BYTE,
  60. },
  61. },
  62. }
  63. var vmDiskio = SMeasurement{
  64. Context: []SMonitorContext{
  65. {
  66. "vm_diskio", "Guest disk traffic", monitor.METRIC_RES_TYPE_GUEST,
  67. monitor.METRIC_DATABASE_TELE,
  68. },
  69. },
  70. Metrics: []SMetric{
  71. {
  72. "read_bps", "Disk read rate", monitor.METRIC_UNIT_BYTEPS,
  73. },
  74. {
  75. "write_bps", "Disk write rate", monitor.METRIC_UNIT_BYTEPS,
  76. },
  77. {
  78. "read_iops", "Disk read operate rate", monitor.METRIC_UNIT_COUNT,
  79. },
  80. {
  81. "write_iops", "Disk write operate rate", monitor.METRIC_UNIT_COUNT,
  82. },
  83. {
  84. "read_bytes", "Bytes read", monitor.METRIC_UNIT_BYTE,
  85. },
  86. {
  87. "write_bytes", "Bytes write", monitor.METRIC_UNIT_BYTE,
  88. },
  89. },
  90. }
  91. var vmDisk = SMeasurement{
  92. Context: []SMonitorContext{
  93. {
  94. "vm_disk", "Guest disk", monitor.METRIC_RES_TYPE_GUEST,
  95. monitor.METRIC_DATABASE_TELE,
  96. },
  97. },
  98. Metrics: []SMetric{
  99. {
  100. "used_percent", "Used vm disk rate", monitor.METRIC_UNIT_PERCENT,
  101. },
  102. },
  103. }
  104. var vmNetio = SMeasurement{
  105. Context: []SMonitorContext{
  106. {
  107. Name: "vm_netio",
  108. DisplayName: "Guest network traffic",
  109. ResourceType: monitor.METRIC_RES_TYPE_GUEST,
  110. Database: monitor.METRIC_DATABASE_TELE,
  111. },
  112. {
  113. Name: "pod_netio",
  114. DisplayName: "Pod network traffic",
  115. ResourceType: monitor.METRIC_RES_TYPE_CONTAINER,
  116. Database: monitor.METRIC_DATABASE_TELE,
  117. },
  118. },
  119. Metrics: []SMetric{
  120. {
  121. Name: "bps_recv",
  122. DisplayName: "Received traffic per second",
  123. Unit: monitor.METRIC_UNIT_BPS,
  124. },
  125. {
  126. Name: "bps_sent",
  127. DisplayName: "Send traffic per second",
  128. Unit: monitor.METRIC_UNIT_BPS,
  129. },
  130. {
  131. Name: "pps_recv",
  132. DisplayName: "Received packets per second",
  133. Unit: monitor.METRIC_UNIT_PPS,
  134. },
  135. {
  136. Name: "pps_sent",
  137. DisplayName: "Send packets per second",
  138. Unit: monitor.METRIC_UNIT_PPS,
  139. },
  140. {
  141. Name: "bytes_sent",
  142. DisplayName: "The total number of bytes sent by the network interface",
  143. Unit: monitor.METRIC_UNIT_BYTE,
  144. },
  145. {
  146. Name: "bytes_recv",
  147. DisplayName: "The total number of bytes received by the network interface",
  148. Unit: monitor.METRIC_UNIT_BYTE,
  149. },
  150. {
  151. Name: "packets_sent",
  152. DisplayName: "The total number of packets sent by the network interface",
  153. Unit: monitor.METRIC_UNIT_COUNT,
  154. },
  155. {
  156. Name: "packets_recv",
  157. DisplayName: "The total number of packets received by the network interface",
  158. Unit: monitor.METRIC_UNIT_COUNT,
  159. },
  160. {
  161. Name: "out_bandwidth_usage",
  162. DisplayName: "Outbound bandwidth utilization",
  163. Unit: monitor.METRIC_UNIT_PERCENT,
  164. },
  165. },
  166. }