nut.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 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"
  42. },
  43. options = {
  44. percent_charge = { color = "00ff00", title = "Charge level" }
  45. }
  46. }
  47. }
  48. -- Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century.
  49. local temperature = {
  50. title = "%H: Battery temperature on UPS \"%pi\"",
  51. vlabel = "\176C",
  52. number_format = "%5.1lf\176C",
  53. data = {
  54. instances = {
  55. temperature = "battery"
  56. },
  57. options = {
  58. temperature_battery = { color = "ffb000", title = "Battery temperature" }
  59. }
  60. }
  61. }
  62. local timeleft = {
  63. title = "%H: Time left on UPS \"%pi\"",
  64. vlabel = "Minutes",
  65. number_format = "%.1lfm",
  66. data = {
  67. instances = {
  68. timeleft = { "battery" }
  69. },
  70. options = {
  71. timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/" }
  72. }
  73. }
  74. }
  75. return { voltages, currents, percentage, temperature, timeleft }
  76. end