Merge pull request #488 from hnyman/black-flash
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / netlink.lua
1 -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 module("luci.statistics.rrdtool.definitions.netlink", package.seeall)
5
6 function rrdargs( graph, plugin, plugin_instance )
7
8 --
9 -- traffic diagram
10 --
11 local traffic = {
12 title = "%H: Netlink - Transfer on %pi",
13 vlabel = "Bytes/s",
14
15 -- diagram data description
16 data = {
17 -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
18 sources = {
19 if_octets = { "tx", "rx" }
20 },
21
22 -- special options for single data lines
23 options = {
24 if_octets__tx = {
25 title = "Bytes (TX)",
26 total = true, -- report total amount of bytes
27 color = "00ff00" -- tx is green
28 },
29
30 if_octets__rx = {
31 title = "Bytes (RX)",
32 flip = true, -- flip rx line
33 total = true, -- report total amount of bytes
34 color = "0000ff" -- rx is blue
35 }
36 }
37 }
38 }
39
40
41 --
42 -- packet diagram
43 --
44 local packets = {
45 title = "%H: Netlink - Packets on %pi",
46 vlabel = "Packets/s", detail = true,
47
48 -- diagram data description
49 data = {
50 -- data type order
51 types = { "if_packets", "if_dropped", "if_errors" },
52
53 -- defined sources for data types
54 sources = {
55 if_packets = { "tx", "rx" },
56 if_dropped = { "tx", "rx" },
57 if_errors = { "tx", "rx" }
58 },
59
60 -- special options for single data lines
61 options = {
62 -- processed packets (tx DS)
63 if_packets__tx = {
64 title = "Total (TX)",
65 overlay = true, -- don't summarize
66 total = true, -- report total amount of bytes
67 color = "00ff00" -- processed tx is green
68 },
69
70 -- processed packets (rx DS)
71 if_packets__rx = {
72 title = "Total (RX)",
73 overlay = true, -- don't summarize
74 flip = true, -- flip rx line
75 total = true, -- report total amount of bytes
76 color = "0000ff" -- processed rx is blue
77 },
78
79 -- dropped packets (tx DS)
80 if_dropped__tx = {
81 title = "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 title = "Dropped (RX)",
90 overlay = true, -- don't summarize
91 flip = true, -- flip rx line
92 total = true, -- report total amount of bytes
93 color = "ff00ff" -- dropped rx is violett
94 },
95
96 -- packet errors (tx DS)
97 if_errors__tx = {
98 title = "Errors (TX)",
99 overlay = true, -- don't summarize
100 total = true, -- report total amount of packets
101 color = "ff5500" -- tx errors are orange
102 },
103
104 -- packet errors (rx DS)
105 if_errors__rx = {
106 title = "Errors (RX)",
107 overlay = true, -- don't summarize
108 flip = true, -- flip rx line
109 total = true, -- report total amount of packets
110 color = "ff0000" -- rx errors are red
111 }
112 }
113 }
114 }
115
116
117 --
118 -- multicast diagram
119 --
120 local multicast = {
121 title = "%H: Netlink - Multicast on %pi",
122 vlabel = "Packets/s", detail = true,
123
124 -- diagram data description
125 data = {
126 -- data type order
127 types = { "if_multicast" },
128
129 -- special options for single data lines
130 options = {
131 -- multicast packets
132 if_multicast = {
133 title = "Packets",
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 title = "%H: Netlink - Collisions on %pi",
147 vlabel = "Collisions/s", detail = true,
148
149 -- diagram data description
150 data = {
151 -- data type order
152 types = { "if_collisions" },
153
154 -- special options for single data lines
155 options = {
156 -- collision rate
157 if_collisions = {
158 title = "Collisions",
159 total = true, -- report total amount of packets
160 color = "ff0000" -- collsions are red
161 }
162 }
163 }
164 }
165
166
167 --
168 -- error diagram
169 --
170 local errors = {
171 title = "%H: Netlink - Errors on %pi",
172 vlabel = "Errors/s", detail = true,
173
174 -- diagram data description
175 data = {
176 -- data type order
177 types = { "if_tx_errors", "if_rx_errors" },
178
179 -- data type instances
180 instances = {
181 if_tx_errors = { "aborted", "carrier", "fifo", "heartbeat", "window" },
182 if_rx_errors = { "length", "missed", "over", "crc", "fifo", "frame" }
183 },
184
185 -- special options for single data lines
186 options = {
187 if_tx_errors_aborted_value = { total = true, color = "ffff00", title = "Aborted (TX)" },
188 if_tx_errors_carrier_value = { total = true, color = "ffcc00", title = "Carrier (TX)" },
189 if_tx_errors_fifo_value = { total = true, color = "ff9900", title = "Fifo (TX)" },
190 if_tx_errors_heartbeat_value = { total = true, color = "ff6600", title = "Heartbeat (TX)" },
191 if_tx_errors_window_value = { total = true, color = "ff3300", title = "Window (TX)" },
192
193 if_rx_errors_length_value = { flip = true, total = true, color = "ff0000", title = "Length (RX)" },
194 if_rx_errors_missed_value = { flip = true, total = true, color = "ff0033", title = "Missed (RX)" },
195 if_rx_errors_over_value = { flip = true, total = true, color = "ff0066", title = "Over (RX)" },
196 if_rx_errors_crc_value = { flip = true, total = true, color = "ff0099", title = "CRC (RX)" },
197 if_rx_errors_fifo_value = { flip = true, total = true, color = "ff00cc", title = "Fifo (RX)" },
198 if_rx_errors_frame_value = { flip = true, total = true, color = "ff00ff", title = "Frame (RX)" }
199 }
200 }
201 }
202
203
204 return { traffic, packets, multicast, collisions, errors }
205 end