08951018f45287763b5a980160536aff7d6cdeb9
[oweals/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: _('OpenVPN'),
7
8         rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
9                 var inst = plugin_instance.replace(/^openvpn\.(.+)\.status$/, '$1');
10
11                 return [
12                         {
13                                 title: "%%H: OpenVPN \"%s\" - Traffic".format(inst),
14                                 vlabel: "Bytes/s",
15                                 data: {
16                                         instances: {
17                                                 if_octets: [ "traffic", "overhead" ]
18                                         },
19                                         sources: {
20                                                 if_octets: [ "tx", "rx" ]
21                                         },
22                                         options: {
23                                                 if_octets_traffic_tx : { weight: 0, title: "Bytes    (TX)", total: true, color: "00ff00" },
24                                                 if_octets_overhead_tx: { weight: 1, title: "Overhead (TX)", total: true, color: "ff9900" },
25                                                 if_octets_overhead_rx: { weight: 2, title: "Overhead (RX)", total: true, flip: true, color: "ff00ff" },
26                                                 if_octets_traffic_rx : { weight: 3, title: "Bytes    (RX)", total: true, flip: true, color: "0000ff" }
27                                         }
28                                 }
29                         },
30
31                         {
32                                 title: "%%H: OpenVPN \"%s\" - Compression".format(inst),
33                                 vlabel: "Bytes/s",
34                                 data: {
35                                         instances: {
36                                                 compression: [ "data_out", "data_in" ]
37                                         },
38                                         sources: {
39                                                 compression: [ "uncompressed", "compressed" ]
40                                         },
41                                         options: {
42                                                 compression_data_out_uncompressed: { weight: 0, title: "Uncompressed (TX)", total: true, color: "00ff00" },
43                                                 compression_data_out_compressed  : { weight: 1, title: "Compressed   (TX)", total: true, color: "008800" },
44                                                 compression_data_in_compressed   : { weight: 2, title: "Compressed   (RX)", total: true, flip: true, color: "000088" },
45                                                 compression_data_in_uncompressed : { weight: 3, title: "Uncompressed (RX)", total: true, flip: true, color: "0000ff" }
46                                         }
47                                 }
48                         }
49                 ];
50         }
51 });