interface.js 2.7 KB

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