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