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