processes.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* Licensed to the public under the Apache License 2.0. */
  2. 'use strict';
  3. 'require baseclass';
  4. return baseclass.extend({
  5. title: _('Processes'),
  6. rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
  7. if (plugin_instance == "") {
  8. return {
  9. title: "%H: Processes",
  10. vlabel: "Processes/s",
  11. data: {
  12. instances: {
  13. ps_state: [
  14. "sleeping", "running", "paging",
  15. "blocked", "stopped", "zombies"
  16. ]
  17. },
  18. options: {
  19. ps_state_sleeping: { color: "0000ff", title: "Sleeping" },
  20. ps_state_running : { color: "008000", title: "Running" },
  21. ps_state_paging : { color: "ffff00", title: "Paging" },
  22. ps_state_blocked : { color: "ff5000", title: "Blocked" },
  23. ps_state_stopped : { color: "555555", title: "Stopped" },
  24. ps_state_zombies : { color: "ff0000", title: "Zombies" }
  25. }
  26. }
  27. };
  28. }
  29. else {
  30. return [
  31. {
  32. title: "%H: CPU time used by %pi",
  33. vlabel: "Jiffies",
  34. data: {
  35. sources: {
  36. ps_cputime: [ "syst", "user" ]
  37. },
  38. options: {
  39. ps_cputime__user: {
  40. color : "0000ff",
  41. title : "User",
  42. overlay: true
  43. },
  44. ps_cputime__syst: {
  45. color : "ff0000",
  46. title : "System",
  47. overlay: true
  48. }
  49. }
  50. }
  51. },
  52. {
  53. title: "%H: Threads and processes belonging to %pi",
  54. vlabel: "Count",
  55. detail: true,
  56. data: {
  57. sources: {
  58. ps_count: [ "threads", "processes" ]
  59. },
  60. options: {
  61. ps_count__threads : { color: "00ff00", title: "Threads" },
  62. ps_count__processes: { color: "0000bb", title: "Processes" }
  63. }
  64. }
  65. },
  66. {
  67. title: "%H: Page faults in %pi",
  68. vlabel: "Page faults",
  69. detail: true,
  70. data: {
  71. sources: {
  72. ps_pagefaults: [ "minflt", "majflt" ]
  73. },
  74. options: {
  75. ps_pagefaults__minflt: { color: "0000ff", title: "Minor" },
  76. ps_pagefaults__majflt: { color: "ff0000", title: "Major" }
  77. }
  78. }
  79. },
  80. {
  81. title: "%H: Resident segment size (RSS) of %pi",
  82. vlabel: "Bytes",
  83. detail: true,
  84. number_format: "%5.1lf%sB",
  85. data: {
  86. types: [ "ps_rss" ],
  87. options: {
  88. ps_rss: { color: "0000ff", title: "Resident segment" }
  89. }
  90. }
  91. },
  92. {
  93. title: "%H: Virtual memory size (VSZ) of %pi",
  94. vlabel: "Bytes",
  95. detail: true,
  96. number_format: "%5.1lf%sB",
  97. data: {
  98. types: [ "ps_vm" ],
  99. options: {
  100. ps_vm: { color: "0000ff", title: "Virtual memory" }
  101. }
  102. }
  103. }
  104. ];
  105. }
  106. }
  107. });