Update my email addresses in the license headers
[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                                         total = true,           -- report total amount of bytes
26                                         color = "00ff00"        -- tx is green
27                                 },
28
29                                 if_octets__rx = {
30                                         flip  = true,           -- flip rx line
31                                         total = true,           -- report total amount of bytes
32                                         color = "0000ff"        -- rx is blue
33                                 }
34                         }
35                 }
36         }
37
38
39         --
40         -- packet diagram
41         --
42         local packets = {
43                 title = "%H: Netlink - Packets on %pi",
44                 vlabel = "Packets/s", detail = true,
45
46                 -- diagram data description
47                 data = {
48                         -- data type order
49                         types = { "if_packets", "if_dropped", "if_errors" },
50
51                         -- defined sources for data types
52                         sources = {
53                                 if_packets = { "tx", "rx" },
54                                 if_dropped = { "tx", "rx" },
55                                 if_errors  = { "tx", "rx" }
56                         },
57
58                         -- special options for single data lines
59                         options = {
60                                 -- processed packets (tx DS)
61                                 if_packets__tx = {
62                                         overlay = true,         -- don't summarize
63                                         total   = true,         -- report total amount of bytes
64                                         color   = "00ff00"      -- processed tx is green
65                                 },
66
67                                 -- processed packets (rx DS)
68                                 if_packets__rx = {
69                                         overlay = true,         -- don't summarize
70                                         flip    = true,         -- flip rx line
71                                         total   = true,         -- report total amount of bytes
72                                         color   = "0000ff"      -- processed rx is blue
73                                 },
74
75                                 -- dropped packets (tx DS)
76                                 if_dropped__tx = {
77                                         overlay = true,         -- don't summarize
78                                         total   = true,         -- report total amount of bytes
79                                         color   = "660055"      -- dropped tx is ... dunno ;)
80                                 },
81
82                                 -- dropped packets (rx DS)
83                                 if_dropped__rx = {
84                                         overlay = true,         -- don't summarize
85                                         flip    = true,         -- flip rx line
86                                         total   = true,         -- report total amount of bytes
87                                         color   = "440066"      -- dropped rx is violett
88                                 },
89
90                                 -- packet errors (tx DS)
91                                 if_errors__tx = {
92                                         overlay = true,         -- don't summarize
93                                         total   = true,         -- report total amount of packets
94                                         color   = "ff5500"      -- tx errors are orange
95                                 },
96
97                                 -- packet errors (rx DS)
98                                 if_errors__rx = {
99                                         overlay = true,         -- don't summarize
100                                         flip    = true,         -- flip rx line
101                                         total   = true,         -- report total amount of packets
102                                         color   = "ff0000"      -- rx errors are red
103                                 }
104                         }
105                 }
106         }
107
108
109         --
110         -- multicast diagram
111         --
112         local multicast = {
113                 title = "%H: Netlink - Multicast on %pi",
114                 vlabel = "Packets/s", detail = true,
115
116                 -- diagram data description
117                 data = {
118                         -- data type order
119                         types = { "if_multicast" },
120
121                         -- special options for single data lines
122                         options = {
123                                 -- multicast packets
124                                 if_multicast = {
125                                         total = true,           -- report total amount of packets
126                                         color = "0000ff"        -- multicast is blue
127                                 }
128                         }
129                 }
130         }
131
132
133         --
134         -- collision diagram
135         --
136         local collisions = {
137                 title = "%H: Netlink - Collisions on %pi",
138                 vlabel = "Collisions/s", detail = true,
139
140                 -- diagram data description
141                 data = {
142                         -- data type order
143                         types = { "if_collisions" },
144
145                         -- special options for single data lines
146                         options = {
147                                 -- collision rate
148                                 if_collisions = {
149                                         total = true,           -- report total amount of packets
150                                         color = "ff0000"        -- collsions are red
151                                 }
152                         }
153                 }
154         }
155
156
157         --
158         -- error diagram
159         --
160         local errors = {
161                 title = "%H: Netlink - Errors on %pi",
162                 vlabel = "Errors/s", detail = true,
163
164                 -- diagram data description
165                 data = {
166                         -- data type order
167                         types = { "if_tx_errors", "if_rx_errors" },
168
169                         -- data type instances
170                         instances = {
171                                 if_tx_errors = { "aborted", "carrier", "fifo", "heartbeat", "window" },
172                                 if_rx_errors = { "length", "missed", "over", "crc", "fifo", "frame" }
173                         },
174
175                         -- special options for single data lines
176                         options = {     -- XXX: fixme (define colors...)
177                                 if_tx_errors = {
178                                         total = true
179                                 },
180
181                                 if_rx_errors = {
182                                         flip  = true,
183                                         total = true
184                                 }
185                         }
186                 }
187         }
188
189
190         return { traffic, packets, multicast, collisions, errors }
191 end