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