1
0

netlink.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.netlink", package.seeall)
  4. function rrdargs( graph, plugin, plugin_instance )
  5. --
  6. -- traffic diagram
  7. --
  8. local traffic = {
  9. title = "%H: Netlink - Transfer on %pi",
  10. vlabel = "Bytes/s",
  11. -- diagram data description
  12. data = {
  13. -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
  14. sources = {
  15. if_octets = { "tx", "rx" }
  16. },
  17. -- special options for single data lines
  18. options = {
  19. if_octets__tx = {
  20. title = "Bytes (TX)",
  21. total = true, -- report total amount of bytes
  22. color = "00ff00" -- tx is green
  23. },
  24. if_octets__rx = {
  25. title = "Bytes (RX)",
  26. flip = true, -- flip rx line
  27. total = true, -- report total amount of bytes
  28. color = "0000ff" -- rx is blue
  29. }
  30. }
  31. }
  32. }
  33. --
  34. -- packet diagram
  35. --
  36. local packets = {
  37. title = "%H: Netlink - Packets on %pi",
  38. vlabel = "Packets/s", detail = true,
  39. -- diagram data description
  40. data = {
  41. -- data type order
  42. types = { "if_packets", "if_dropped", "if_errors" },
  43. -- defined sources for data types
  44. sources = {
  45. if_packets = { "tx", "rx" },
  46. if_dropped = { "tx", "rx" },
  47. if_errors = { "tx", "rx" }
  48. },
  49. -- special options for single data lines
  50. options = {
  51. -- processed packets (tx DS)
  52. if_packets__tx = {
  53. weight = 2,
  54. title = "Total (TX)",
  55. overlay = true, -- don't summarize
  56. total = true, -- report total amount of bytes
  57. color = "00ff00" -- processed tx is green
  58. },
  59. -- processed packets (rx DS)
  60. if_packets__rx = {
  61. weight = 3,
  62. title = "Total (RX)",
  63. overlay = true, -- don't summarize
  64. flip = true, -- flip rx line
  65. total = true, -- report total amount of bytes
  66. color = "0000ff" -- processed rx is blue
  67. },
  68. -- dropped packets (tx DS)
  69. if_dropped__tx = {
  70. weight = 1,
  71. title = "Dropped (TX)",
  72. overlay = true, -- don't summarize
  73. total = true, -- report total amount of bytes
  74. color = "660055" -- dropped tx is ... dunno ;)
  75. },
  76. -- dropped packets (rx DS)
  77. if_dropped__rx = {
  78. weight = 4,
  79. title = "Dropped (RX)",
  80. overlay = true, -- don't summarize
  81. flip = true, -- flip rx line
  82. total = true, -- report total amount of bytes
  83. color = "ff00ff" -- dropped rx is violett
  84. },
  85. -- packet errors (tx DS)
  86. if_errors__tx = {
  87. weight = 0,
  88. title = "Errors (TX)",
  89. overlay = true, -- don't summarize
  90. total = true, -- report total amount of packets
  91. color = "ff5500" -- tx errors are orange
  92. },
  93. -- packet errors (rx DS)
  94. if_errors__rx = {
  95. weight = 5,
  96. title = "Errors (RX)",
  97. overlay = true, -- don't summarize
  98. flip = true, -- flip rx line
  99. total = true, -- report total amount of packets
  100. color = "ff0000" -- rx errors are red
  101. }
  102. }
  103. }
  104. }
  105. --
  106. -- multicast diagram
  107. --
  108. local multicast = {
  109. title = "%H: Netlink - Multicast on %pi",
  110. vlabel = "Packets/s", detail = true,
  111. -- diagram data description
  112. data = {
  113. -- data type order
  114. types = { "if_multicast" },
  115. -- special options for single data lines
  116. options = {
  117. -- multicast packets
  118. if_multicast = {
  119. title = "Packets",
  120. total = true, -- report total amount of packets
  121. color = "0000ff" -- multicast is blue
  122. }
  123. }
  124. }
  125. }
  126. --
  127. -- collision diagram
  128. --
  129. local collisions = {
  130. title = "%H: Netlink - Collisions on %pi",
  131. vlabel = "Collisions/s", detail = true,
  132. -- diagram data description
  133. data = {
  134. -- data type order
  135. types = { "if_collisions" },
  136. -- special options for single data lines
  137. options = {
  138. -- collision rate
  139. if_collisions = {
  140. title = "Collisions",
  141. total = true, -- report total amount of packets
  142. color = "ff0000" -- collsions are red
  143. }
  144. }
  145. }
  146. }
  147. --
  148. -- error diagram
  149. --
  150. local errors = {
  151. title = "%H: Netlink - Errors on %pi",
  152. vlabel = "Errors/s", detail = true,
  153. -- diagram data description
  154. data = {
  155. -- data type order
  156. types = { "if_tx_errors", "if_rx_errors" },
  157. -- data type instances
  158. instances = {
  159. if_tx_errors = { "aborted", "carrier", "fifo", "heartbeat", "window" },
  160. if_rx_errors = { "length", "missed", "over", "crc", "fifo", "frame" }
  161. },
  162. -- special options for single data lines
  163. options = {
  164. if_tx_errors_aborted_value = { total = true, color = "ffff00", title = "Aborted (TX)" },
  165. if_tx_errors_carrier_value = { total = true, color = "ffcc00", title = "Carrier (TX)" },
  166. if_tx_errors_fifo_value = { total = true, color = "ff9900", title = "Fifo (TX)" },
  167. if_tx_errors_heartbeat_value = { total = true, color = "ff6600", title = "Heartbeat (TX)" },
  168. if_tx_errors_window_value = { total = true, color = "ff3300", title = "Window (TX)" },
  169. if_rx_errors_length_value = { flip = true, total = true, color = "ff0000", title = "Length (RX)" },
  170. if_rx_errors_missed_value = { flip = true, total = true, color = "ff0033", title = "Missed (RX)" },
  171. if_rx_errors_over_value = { flip = true, total = true, color = "ff0066", title = "Over (RX)" },
  172. if_rx_errors_crc_value = { flip = true, total = true, color = "ff0099", title = "CRC (RX)" },
  173. if_rx_errors_fifo_value = { flip = true, total = true, color = "ff00cc", title = "Fifo (RX)" },
  174. if_rx_errors_frame_value = { flip = true, total = true, color = "ff00ff", title = "Frame (RX)" }
  175. }
  176. }
  177. }
  178. return { traffic, packets, multicast, collisions, errors }
  179. end