* luc/statistics: add file/license headers
[project/luci.git] / applications / luci-statistics / luasrc / statistics / rrdtool / definitions / netlink.lua
1 --[[
2
3 Luci statistics - netlink plugin diagram definition
4 (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 ]]--
15
16 module("luci.statistics.rrdtool.definitions.netlink", package.seeall)
17
18 function rrdargs( graph, plugin, plugin_instance )
19
20 --
21 -- traffic diagram
22 --
23 local traffic = {
24
25 -- diagram data description
26 data = {
27 -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
28 sources = {
29 if_octets = { "tx", "rx" }
30 },
31
32 -- special options for single data lines
33 options = {
34 if_octets__tx = {
35 total = true, -- report total amount of bytes
36 color = "00ff00" -- tx is green
37 },
38
39 if_octets__rx = {
40 flip = true, -- flip rx line
41 total = true, -- report total amount of bytes
42 color = "0000ff" -- rx is blue
43 }
44 }
45 }
46 }
47
48
49 --
50 -- packet diagram
51 --
52 local packets = {
53
54 -- diagram data description
55 data = {
56 -- data type order
57 types = { "if_packets", "if_dropped", "if_errors" },
58
59 -- defined sources for data types
60 sources = {
61 if_packets = { "tx", "rx" },
62 if_dropped = { "tx", "rx" },
63 if_errors = { "tx", "rx" }
64 },
65
66 -- special options for single data lines
67 options = {
68 -- processed packets (tx DS)
69 if_packets__tx = {
70 overlay = true, -- don't summarize
71 total = true, -- report total amount of bytes
72 color = "00ff00" -- processed tx is green
73 },
74
75 -- processed packets (rx DS)
76 if_packets__rx = {
77 overlay = true, -- don't summarize
78 flip = true, -- flip rx line
79 total = true, -- report total amount of bytes
80 color = "0000ff" -- processed rx is blue
81 },
82
83 -- dropped packets (tx DS)
84 if_dropped__tx = {
85 overlay = true, -- don't summarize
86 total = true, -- report total amount of bytes
87 color = "660055" -- dropped tx is ... dunno ;)
88 },
89
90 -- dropped packets (rx DS)
91 if_dropped__rx = {
92 overlay = true, -- don't summarize
93 flip = true, -- flip rx line
94 total = true, -- report total amount of bytes
95 color = "440066" -- dropped rx is violett
96 },
97
98 -- packet errors (tx DS)
99 if_errors__tx = {
100 overlay = true, -- don't summarize
101 total = true, -- report total amount of packets
102 color = "ff5500" -- tx errors are orange
103 },
104
105 -- packet errors (rx DS)
106 if_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
122 -- diagram data description
123 data = {
124 -- data type order
125 types = { "if_multicast" },
126
127 -- special options for single data lines
128 options = {
129 -- multicast packets
130 if_multicast = {
131 total = true, -- report total amount of packets
132 color = "0000ff" -- multicast is blue
133 }
134 }
135 }
136 }
137
138
139 --
140 -- collision diagram
141 --
142 local collisions = {
143
144 -- diagram data description
145 data = {
146 -- data type order
147 types = { "if_collisions" },
148
149 -- special options for single data lines
150 options = {
151 -- collision rate
152 if_collisions = {
153 total = true, -- report total amount of packets
154 color = "ff0000" -- collsions are red
155 }
156 }
157 }
158 }
159
160
161 --
162 -- error diagram
163 --
164 local errors = {
165
166 -- diagram data description
167 data = {
168 -- data type order
169 types = { "if_tx_errors", "if_rx_errors" },
170
171 -- data type instances
172 instances = {
173 if_tx_errors = { "aborted", "carrier", "fifo", "heartbeat", "window" },
174 if_rx_errors = { "length", "missed", "over", "crc", "fifo", "frame" }
175 },
176
177 -- special options for single data lines
178 options = { -- XXX: fixme (define colors...)
179 if_tx_errors = {
180 total = true
181 },
182
183 if_rx_errors = {
184 flip = true,
185 total = true
186 }
187 }
188 }
189 }
190
191
192 return { traffic, packets, multicast, collisions, errors }
193 end