* luci/statistics: implement a more advanced diagram generator in rrdtool.lua, simpli...
[project/luci.git] / applications / luci-statistics / luasrc / statistics / rrdtool / definitions / netlink.lua
1 module("luci.statistics.rrdtool.definitions.netlink", package.seeall)
2
3 function rrdargs( graph, 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 -- diagram data description
17 data = {
18 -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
19 sources = {
20 if_octets = { "tx", "rx" }
21 },
22
23 -- special options for single data lines
24 options = {
25 if_octets__tx = {
26 total = true, -- report total amount of bytes
27 color = "00ff00" -- tx is green
28 },
29
30 if_octets__rx = {
31 flip = true, -- flip rx line
32 total = true, -- report total amount of bytes
33 color = "0000ff" -- rx is blue
34 }
35 }
36 }
37 }
38
39
40 --
41 -- packet diagram
42 --
43 local packets = {
44
45 -- diagram title
46 title = "Pakete",
47
48 -- vertical label
49 vlabel = "Pakete/s",
50
51 -- diagram data description
52 data = {
53 -- data type order
54 types = { "if_packets", "if_dropped", "if_errors" },
55
56 -- defined sources for data types
57 sources = {
58 if_packets = { "tx", "rx" },
59 if_dropped = { "tx", "rx" },
60 if_errors = { "tx", "rx" }
61 },
62
63 -- special options for single data lines
64 options = {
65 -- processed packets (tx DS)
66 if_packets__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 overlay = true, -- don't summarize
75 flip = true, -- flip rx line
76 total = true, -- report total amount of bytes
77 color = "0000ff" -- processed rx is blue
78 },
79
80 -- dropped packets (tx DS)
81 if_dropped__tx = {
82 overlay = true, -- don't summarize
83 total = true, -- report total amount of bytes
84 color = "660055" -- dropped tx is ... dunno ;)
85 },
86
87 -- dropped packets (rx DS)
88 if_dropped__rx = {
89 overlay = true, -- don't summarize
90 flip = true, -- flip rx line
91 total = true, -- report total amount of bytes
92 color = "440066" -- dropped rx is violett
93 },
94
95 -- packet errors (tx DS)
96 if_errors__tx = {
97 overlay = true, -- don't summarize
98 total = true, -- report total amount of packets
99 color = "ff5500" -- tx errors are orange
100 },
101
102 -- packet errors (rx DS)
103 if_errors__rx = {
104 overlay = true, -- don't summarize
105 flip = true, -- flip rx line
106 total = true, -- report total amount of packets
107 color = "ff0000" -- rx errors are red
108 }
109 }
110 }
111 }
112
113
114 --
115 -- multicast diagram
116 --
117 local multicast = {
118
119 -- diagram title
120 title = "Multicast-Pakete",
121
122 -- vertical label
123 vlabel = "Pakete/s",
124
125 -- diagram data description
126 data = {
127 -- data type order
128 types = { "if_multicast" },
129
130 -- special options for single data lines
131 options = {
132 -- multicast packets
133 if_multicast = {
134 total = true, -- report total amount of packets
135 color = "0000ff" -- multicast is blue
136 }
137 }
138 }
139 }
140
141
142 --
143 -- collision diagram
144 --
145 local collisions = {
146
147 -- diagram title
148 title = "Paketkollisionen",
149
150 -- vertical label
151 vlabel = "Kollisionen/s",
152
153 -- diagram data description
154 data = {
155 -- data type order
156 types = { "if_collisions" },
157
158 -- special options for single data lines
159 options = {
160 -- collision rate
161 if_collisions = {
162 total = true, -- report total amount of packets
163 color = "ff0000" -- collsions are red
164 }
165 }
166 }
167 }
168
169
170 --
171 -- error diagram
172 --
173 local errors = {
174
175 -- diagram title
176 title = "TX/RX-Fehler",
177
178 -- vertical label
179 vlabel = "Kollisionen/s",
180
181 -- diagram data description
182 data = {
183 -- data type order
184 types = { "if_tx_errors", "if_rx_errors" },
185
186 -- data type instances
187 instances = {
188 if_tx_errors = { "aborted", "carrier", "fifo", "heartbeat", "window" },
189 if_rx_errors = { "length", "missed", "over", "crc", "fifo", "frame" }
190 },
191
192 -- special options for single data lines
193 options = { -- XXX: fixme (define colors...)
194 if_tx_errors = {
195 total = true
196 },
197
198 if_rx_errors = {
199 flip = true,
200 total = true
201 }
202 }
203 }
204 }
205
206
207 return { traffic, packets, multicast, collisions, errors }
208 end