process.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 processes = SMeasurement{
  17. Context: []SMonitorContext{
  18. {
  19. Name: "processes",
  20. DisplayName: "Processes status",
  21. ResourceType: monitor.METRIC_RES_TYPE_HOST,
  22. Database: monitor.METRIC_DATABASE_TELE,
  23. },
  24. {
  25. Name: "agent_processes",
  26. DisplayName: "Processes status in guest",
  27. ResourceType: monitor.METRIC_RES_TYPE_AGENT,
  28. Database: monitor.METRIC_DATABASE_TELE,
  29. },
  30. },
  31. Metrics: []SMetric{
  32. {
  33. Name: "total",
  34. DisplayName: "Total processes count",
  35. Unit: monitor.METRIC_UNIT_COUNT,
  36. },
  37. {
  38. Name: "total_threads",
  39. DisplayName: "Total threads count",
  40. Unit: monitor.METRIC_UNIT_COUNT,
  41. },
  42. {
  43. Name: "zombies",
  44. DisplayName: "Z state, zombie processes count",
  45. Unit: monitor.METRIC_UNIT_COUNT,
  46. },
  47. {
  48. Name: "running",
  49. DisplayName: "R state, running processes count",
  50. Unit: monitor.METRIC_UNIT_COUNT,
  51. },
  52. {
  53. Name: "sleeping",
  54. DisplayName: "S state, sleeping processes count",
  55. Unit: monitor.METRIC_UNIT_COUNT,
  56. },
  57. {
  58. Name: "blocked",
  59. DisplayName: "D, waiting in uninterruptible sleep, or locked, aka disk sleep",
  60. Unit: monitor.METRIC_UNIT_COUNT,
  61. },
  62. {
  63. Name: "stopped",
  64. DisplayName: "T state, stopped process count",
  65. Unit: monitor.METRIC_UNIT_COUNT,
  66. },
  67. {
  68. Name: "dead",
  69. DisplayName: "X state, dead",
  70. Unit: monitor.METRIC_UNIT_COUNT,
  71. },
  72. {
  73. Name: "wait",
  74. DisplayName: "W state, (freebsd only)",
  75. Unit: monitor.METRIC_UNIT_COUNT,
  76. },
  77. {
  78. Name: "idle",
  79. DisplayName: "I state, (sleeping for longer than about 20 seconds, bsd and Linux 4+ only)",
  80. Unit: monitor.METRIC_UNIT_COUNT,
  81. },
  82. {
  83. Name: "paging",
  84. DisplayName: "W state (linux kernel < 2.6 only)",
  85. Unit: monitor.METRIC_UNIT_COUNT,
  86. },
  87. {
  88. Name: "parked",
  89. DisplayName: "(linux only)",
  90. Unit: monitor.METRIC_UNIT_COUNT,
  91. },
  92. },
  93. }
  94. /*
  95. Linux FreeBSD Darwin meaning
  96. R R R running
  97. S S S sleeping
  98. Z Z Z zombie
  99. X none none dead
  100. T T T stopped
  101. I I I idle (sleeping for longer than about 20 seconds)
  102. D D,L U blocked (waiting in uninterruptible sleep, or locked)
  103. W W none paging (linux kernel < 2.6 only), wait (freebsd)
  104. */