processes.lua 2.5 KB

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