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