* luci/statistics: added diagram model for interface plugin
[project/luci.git] / applications / luci-statistics / luasrc / statistics / rrdtool / definitions / interface.lua
1 module("luci.statistics.rrdtool.definitions.interface", package.seeall)
2
3 function rrdargs( graph, host, plugin, plugin_instance )
4
5         --
6         -- traffic diagram
7         --
8         local traffic = {
9
10                 -- diagram title
11                 title   = "Verkehr",
12
13                 -- vertical label
14                 vlabel  = "Bytes/s",
15
16                 -- draw this diagram for each data instance
17                 per_instance = true,
18
19                 -- diagram data description
20                 data = {
21                         -- defined sources for data types, if ommitted 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                                 },
32
33                                 if_octets__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         --
44         -- packet diagram
45         --
46         local packets = {
47
48                 -- diagram title
49                 title   = "Pakete",
50
51                 -- vertical label
52                 vlabel  = "Pakete/s",
53
54                 -- draw this diagram for each data instance
55                 per_instance = true,
56
57                 -- diagram data description
58                 data = {
59                         -- data type order
60                         types = { "if_packets", "if_errors" },
61
62                         -- defined sources for data types
63                         sources = {
64                                 if_packets = { "tx", "rx" },
65                                 if_errors  = { "tx", "rx" }
66                         },
67
68                         -- special options for single data lines
69                         options = {
70                                 -- processed packets (tx DS)
71                                 if_packets__tx = {
72                                         overlay = true,         -- don't summarize
73                                         total   = true,         -- report total amount of bytes
74                                         color   = "00ff00"      -- processed tx is green
75                                 },
76
77                                 -- processed packets (rx DS)
78                                 if_packets__rx = {
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                                 },
84
85                                 -- packet errors (tx DS)
86                                 if_errors__tx = {
87                                         overlay = true,         -- don't summarize
88                                         total   = true,         -- report total amount of packets
89                                         color   = "ff5500"      -- tx errors are orange
90                                 },
91
92                                 -- packet errors (rx DS)
93                                 if_errors__rx = {
94                                         overlay = true,         -- don't summarize
95                                         flip    = true,         -- flip rx line
96                                         total   = true,         -- report total amount of packets
97                                         color   = "ff0000"      -- rx errors are red
98                                 }
99                         }
100                 }
101         }
102
103         return { traffic, packets }
104 end