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