Merge pull request #396 from fanthos/master
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / openvpn.lua
1 -- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 module("luci.statistics.rrdtool.definitions.openvpn", package.seeall)
5
6 function rrdargs( graph, plugin, plugin_instance )
7         local inst = plugin_instance:gsub("^openvpn%.(.+)%.status$", "%1")
8
9         return {
10                 {
11                         title = "%%H: OpenVPN \"%s\" - Traffic" % inst,
12                         vlabel = "Bytes/s",
13                         data = {
14                                 instances = {
15                                         if_octets = { "traffic", "overhead" }
16                                 },
17                                 sources = {
18                                         if_octets = { "tx", "rx" }
19                                 },
20                                 options = {
21                                         if_octets_traffic_tx  = { weight = 0, title = "Bytes    (TX)", total = true, color = "00ff00" },
22                                         if_octets_overhead_tx = { weight = 1, title = "Overhead (TX)", total = true, color = "ff9900" },
23                                         if_octets_overhead_rx = { weight = 2, title = "Overhead (RX)", total = true, flip = true, color = "ff00ff" },
24                                         if_octets_traffic_rx  = { weight = 3, title = "Bytes    (RX)", total = true, flip = true, color = "0000ff" }
25                                 }
26                         }
27                 },
28
29                 {
30                         title = "%%H: OpenVPN \"%s\" - Compression" % inst,
31                         vlabel = "Bytes/s",
32                         data = {
33                                 instances = {
34                                         compression = { "data_out", "data_in" }
35                                 },
36                                 sources = {
37                                         compression = { "uncompressed", "compressed" }
38                                 },
39                                 options = {
40                                         compression_data_out_uncompressed = { weight = 0, title = "Uncompressed (TX)", total = true, color = "00ff00" },
41                                         compression_data_out_compressed   = { weight = 1, title = "Compressed   (TX)", total = true, color = "008800" },
42                                         compression_data_in_compressed    = { weight = 2, title = "Compressed   (RX)", total = true, flip = true, color = "000088" },
43                                         compression_data_in_uncompressed  = { weight = 3, title = "Uncompressed (RX)", total = true, flip = true, color = "0000ff" }
44                                 }
45                         }
46                 }
47         }
48 end