1
0

nut.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. -- Licensed to the public under the Apache License 2.0.
  2. module("luci.statistics.rrdtool.definitions.nut",package.seeall)
  3. function rrdargs( graph, plugin, plugin_instance, dtype )
  4. local voltages = {
  5. title = "%H: Voltages on UPS \"%pi\"",
  6. vlabel = "V",
  7. number_format = "%5.1lfV",
  8. data = {
  9. instances = {
  10. voltage = { "battery", "input", "output" }
  11. },
  12. options = {
  13. voltage_output = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
  14. voltage_battery = { color = "0000ff", title = "Battery voltage", noarea=true, overlay=true },
  15. voltage_input = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
  16. }
  17. }
  18. }
  19. local currents = {
  20. title = "%H: Current on UPS \"%pi\"",
  21. vlabel = "A",
  22. number_format = "%5.3lfA",
  23. data = {
  24. instances = {
  25. current = { "battery", "output" }
  26. },
  27. options = {
  28. current_output = { color = "00e000", title = "Output current", noarea=true, overlay=true },
  29. current_battery = { color = "0000ff", title = "Battery current", noarea=true, overlay=true }
  30. }
  31. }
  32. }
  33. local percentage = {
  34. title = "%H: Battery charge/load on UPS \"%pi\"",
  35. vlabel = "Percent",
  36. y_min = "0",
  37. y_max = "100",
  38. number_format = "%5.1lf%%",
  39. data = {
  40. instances = {
  41. percent = { "charge", "load" }
  42. },
  43. options = {
  44. percent_charge = { color = "00ff00", title = "Charge level" },
  45. percent_load = { color = "ff0000", title = "Load" }
  46. }
  47. }
  48. }
  49. -- Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century.
  50. local temperature = {
  51. title = "%H: Battery temperature on UPS \"%pi\"",
  52. vlabel = "\176C",
  53. number_format = "%5.1lf\176C",
  54. data = {
  55. instances = {
  56. temperature = "battery"
  57. },
  58. options = {
  59. temperature_battery = { color = "ffb000", title = "Battery temperature" }
  60. }
  61. }
  62. }
  63. local timeleft = {
  64. title = "%H: Time left on UPS \"%pi\"",
  65. vlabel = "Minutes",
  66. number_format = "%.1lfm",
  67. data = {
  68. instances = {
  69. timeleft = { "battery" }
  70. },
  71. options = {
  72. timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/", noarea=true }
  73. }
  74. }
  75. }
  76. local power = {
  77. title = "%H: Power on UPS \"%pi\"",
  78. vlabel = "Power",
  79. number_format = "%5.1lf%%",
  80. data = {
  81. instances = {
  82. power = { "ups" }
  83. },
  84. options = {
  85. power_ups = { color = "00ff00", title = "Power level" }
  86. }
  87. }
  88. }
  89. local frequencies = {
  90. title = "%H: Frequencies on UPS \"%pi\"",
  91. vlabel = "Hz",
  92. number_format = "%5.1lfHz",
  93. data = {
  94. instances = {
  95. frequency = { "input", "output" }
  96. },
  97. options = {
  98. frequency_output = { color = "00e000", title = "Output frequency", noarea=true, overlay=true },
  99. frequency_input = { color = "ffb000", title = "Input frequency", noarea=true, overlay=true }
  100. }
  101. }
  102. }
  103. return { voltages, currents, percentage, temperature, timeleft, power, frequencies }
  104. end