netlink.js 5.8 KB

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