1
0

interface.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.interface", package.seeall)
  4. function rrdargs( graph, plugin, plugin_instance )
  5. --
  6. -- traffic diagram
  7. --
  8. local traffic = {
  9. -- draw this diagram for each plugin instance
  10. per_instance = true,
  11. title = "%H: Transfer on %pi",
  12. vlabel = "Bytes/s",
  13. -- diagram data description
  14. data = {
  15. -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
  16. sources = {
  17. if_octets = { "tx", "rx" }
  18. },
  19. -- special options for single data lines
  20. options = {
  21. if_octets__tx = {
  22. total = true, -- report total amount of bytes
  23. color = "00ff00", -- tx is green
  24. title = "Bytes (TX)"
  25. },
  26. if_octets__rx = {
  27. flip = true, -- flip rx line
  28. total = true, -- report total amount of bytes
  29. color = "0000ff", -- rx is blue
  30. title = "Bytes (RX)"
  31. }
  32. }
  33. }
  34. }
  35. --
  36. -- packet diagram
  37. --
  38. local packets = {
  39. -- draw this diagram for each plugin instance
  40. per_instance = true,
  41. title = "%H: Packets on %pi",
  42. vlabel = "Packets/s",
  43. -- diagram data description
  44. data = {
  45. -- data type order
  46. types = { "if_packets", "if_errors" },
  47. -- defined sources for data types
  48. sources = {
  49. if_packets = { "tx", "rx" },
  50. if_errors = { "tx", "rx" }
  51. },
  52. -- special options for single data lines
  53. options = {
  54. -- processed packets (tx DS)
  55. if_packets__tx = {
  56. weight = 1,
  57. overlay = true, -- don't summarize
  58. total = true, -- report total amount of bytes
  59. color = "00ff00", -- processed tx is green
  60. title = "Processed (TX)"
  61. },
  62. -- processed packets (rx DS)
  63. if_packets__rx = {
  64. weight = 2,
  65. overlay = true, -- don't summarize
  66. flip = true, -- flip rx line
  67. total = true, -- report total amount of bytes
  68. color = "0000ff", -- processed rx is blue
  69. title = "Processed (RX)"
  70. },
  71. -- packet errors (tx DS)
  72. if_errors__tx = {
  73. weight = 0,
  74. overlay = true, -- don't summarize
  75. total = true, -- report total amount of packets
  76. color = "ff5500", -- tx errors are orange
  77. title = "Errors (TX)"
  78. },
  79. -- packet errors (rx DS)
  80. if_errors__rx = {
  81. weight = 3,
  82. overlay = true, -- don't summarize
  83. flip = true, -- flip rx line
  84. total = true, -- report total amount of packets
  85. color = "ff0000", -- rx errors are red
  86. title = "Errors (RX)"
  87. }
  88. }
  89. }
  90. }
  91. return { traffic, packets }
  92. end