1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
module("luci.statistics.rrdtool.definitions.netlink", package.seeall)
function rrdargs( graph, host, plugin, plugin_instance )
local diagram_list = { }
-- diagram names
local dtypes_names = {
"Pakete",
"Paketkollisionen",
"Paketfehler",
"Verkehr",
"RX-Fehler",
"TX-Fehler"
}
-- diagram units
local dtypes_units = {
"Pakete/s",
"Kollisionen/s",
"Fehler/s", -- (?)
"Bytes/s",
"Fehler/s",
"Fehler/s"
}
-- data source overrides
local dtypes_sources = {
if_errors = { "rx", "tx" }, -- if_errors has rx and tx
if_octets = { "rx", "tx" } -- if_octets has rx and tx
}
-- diagram data types
local dtypes_list = {
-- diagram 1: combined interface packet statistics
{
if_dropped = { "" }, -- packets/s
if_multicast = { "" }, -- packets/s
if_packets = { "" } -- packets/s
},
-- diagram 2: interface collision statistics
{
if_collisions = { "" } -- collisions/s
},
-- diagram 3: interface error statistics
{
if_errors = { "" } -- errors/s (?)
},
-- diagram 4: interface traffic statistics
{
if_octets = { "" } -- bytes/s
},
-- diagram 5: interface rx error statistics
{
if_rx_errors = { -- errors/s
"length", "missed", "over", "crc", "fifo", "frame"
}
},
-- diagram 6: interface tx error statistics
{
if_tx_errors = { -- errors/s
"aborted", "carrier", "fifo", "heartbeat", "window"
}
}
}
-- diagram colors
local dtypes_colors = {
-- diagram 1
{
if_dropped = "ff0000",
if_multicast = "0000ff",
if_packets = "00ff00"
},
-- diagram 2
{
if_collisions = "ff0000"
},
-- diagram 3
{
if_errors__tx_ = "ff0000",
if_errors__rx_ = "ff5500"
},
-- diagram 4
{
if_octets__tx_ = "00ff00",
if_octets__rx_ = "0000ff"
},
-- diagram 5
{
length = "0000ff",
missed = "ff5500",
over = "ff0066",
crc = "ff0000",
fifo = "00ff00",
frame = "ffff00"
},
-- diagram 6
{
aborted = "ff0000",
carrier = "ffff00",
fifo = "00ff00",
heartbeat = "0000ff",
window = "8800ff"
}
}
for i, name in ipairs(dtypes_names) do
local dtypes = dtypes_list[i]
local opts = { }
opts.sources = { }
opts.image = graph:mkpngpath( host, plugin, plugin_instance, "netlink" .. i )
opts.title = host .. ": Netlink Statistiken - " .. name .. " auf " .. plugin_instance
opts.rrd = { "-v", dtypes_units[i] }
opts.colors = dtypes_colors[i]
for dtype, dinstances in pairs(dtypes) do
for i, inst in ipairs(dinstances) do
local name = inst
if name:len() == 0 then name = dtype end
-- check for data source override
if dtypes_sources[dtype] then
-- has override
for i, ds in ipairs(dtypes_sources[dtype]) do
table.insert( opts.sources, {
ds = ds, -- override
name = name .. " (" .. ds .. ")",
rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst )
} )
end
else
-- no override, assume single "value" data source
table.insert( opts.sources, {
name = name,
rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst )
} )
end
end
end
table.insert( diagram_list, opts )
end
return diagram_list
end
|