1
0

apcups.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. -- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. module("luci.statistics.rrdtool.definitions.apcups",package.seeall)
  4. function rrdargs( graph, plugin, plugin_instance, dtype )
  5. local voltagesdc = {
  6. title = "%H: Voltages on APC UPS - Battery",
  7. vlabel = "Volts DC",
  8. alt_autoscale = true,
  9. number_format = "%5.1lfV",
  10. data = {
  11. instances = {
  12. voltage = { "battery" }
  13. },
  14. options = {
  15. voltage = { title = "Battery voltage", noarea=true }
  16. }
  17. }
  18. }
  19. local voltages = {
  20. title = "%H: Voltages on APC UPS - AC",
  21. vlabel = "Volts AC",
  22. alt_autoscale = true,
  23. number_format = "%5.1lfV",
  24. data = {
  25. instances = {
  26. voltage = { "input", "output" }
  27. },
  28. options = {
  29. voltage_output = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
  30. voltage_input = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
  31. }
  32. }
  33. }
  34. local percentload = {
  35. title = "%H: Load on APC UPS ",
  36. vlabel = "Percent",
  37. y_min = "0",
  38. y_max = "100",
  39. number_format = "%5.1lf%%",
  40. data = {
  41. sources = {
  42. percent_load = { "value" }
  43. },
  44. instances = {
  45. percent = "load"
  46. },
  47. options = {
  48. percent_load = { color = "00ff00", title = "Load level" }
  49. }
  50. }
  51. }
  52. local charge_percent = {
  53. title = "%H: Battery charge on APC UPS ",
  54. vlabel = "Percent",
  55. y_min = "0",
  56. y_max = "100",
  57. number_format = "%5.1lf%%",
  58. data = {
  59. types = { "charge" },
  60. options = {
  61. charge = { color = "00ff0b", title = "Charge level" }
  62. }
  63. }
  64. }
  65. local temperature = {
  66. title = "%H: Battery temperature on APC UPS ",
  67. vlabel = "\176C",
  68. number_format = "%5.1lf\176C",
  69. data = {
  70. types = { "temperature" },
  71. options = {
  72. temperature = { color = "ffb000", title = "Battery temperature" } }
  73. }
  74. }
  75. local timeleft = {
  76. title = "%H: Time left on APC UPS ",
  77. vlabel = "Minutes",
  78. number_format = "%.1lfm",
  79. data = {
  80. sources = {
  81. timeleft = { "value" }
  82. },
  83. options = {
  84. timeleft = { color = "0000ff", title = "Time left" }
  85. }
  86. }
  87. }
  88. local frequency = {
  89. title = "%H: Incoming line frequency on APC UPS ",
  90. vlabel = "Hz",
  91. number_format = "%5.0lfhz",
  92. data = {
  93. sources = {
  94. frequency_input = { "value" }
  95. },
  96. instances = {
  97. frequency = "frequency"
  98. },
  99. options = {
  100. frequency_frequency = { color = "000fff", title = "Line frequency" }
  101. }
  102. }
  103. }
  104. return { voltages, voltagesdc, percentload, charge_percent, temperature, timeleft, frequency }
  105. end