diff options
author | onefang | 2019-12-10 15:47:45 +1000 |
---|---|---|
committer | onefang | 2019-12-10 15:47:45 +1000 |
commit | 86a89a372ec2c09894d5fa7bc1fff2421f484a88 (patch) | |
tree | d8ebbd381aeb5ebef1f2b22927bba98b3bdee79b | |
parent | Typo-- (diff) | |
download | apt-panopticon-86a89a372ec2c09894d5fa7bc1fff2421f484a88.zip apt-panopticon-86a89a372ec2c09894d5fa7bc1fff2421f484a88.tar.gz apt-panopticon-86a89a372ec2c09894d5fa7bc1fff2421f484a88.tar.bz2 apt-panopticon-86a89a372ec2c09894d5fa7bc1fff2421f484a88.tar.xz |
Add RRD data collection, and a speed graph.
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | apt-panopticon-report-RRD.lua | 16 | ||||
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 51 |
3 files changed, 68 insertions, 0 deletions
@@ -40,6 +40,7 @@ installed - | |||
40 | * luajit | 40 | * luajit |
41 | * LuaSocket, on Debian based systems it'll be in the lua-socket package. | 41 | * LuaSocket, on Debian based systems it'll be in the lua-socket package. |
42 | * md5sum and sha256, on Debian based systems they'll be in the coreutils package. | 42 | * md5sum and sha256, on Debian based systems they'll be in the coreutils package. |
43 | * rrdtool, may need to include lua-rrd. | ||
43 | * xz, on Debian based systems it'll be in the xz-utils package. | 44 | * xz, on Debian based systems it'll be in the xz-utils package. |
44 | 45 | ||
45 | Using it. | 46 | Using it. |
diff --git a/apt-panopticon-report-RRD.lua b/apt-panopticon-report-RRD.lua new file mode 100755 index 0000000..dfe21d2 --- /dev/null +++ b/apt-panopticon-report-RRD.lua | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/usr/bin/env luajit | ||
2 | |||
3 | local APT = require 'apt-panopticommon' | ||
4 | local D = APT.D | ||
5 | local I = APT.I | ||
6 | local W = APT.W | ||
7 | local E = APT.E | ||
8 | local C = APT.C | ||
9 | local arg, sendArgs = APT.parseArgs({...}) | ||
10 | |||
11 | |||
12 | APT.mirrors = loadfile("results/mirrors.lua")() | ||
13 | APT.html = false | ||
14 | for k, v in APT.orderedPairs(APT.mirrors) do | ||
15 | APT.doRRD('results', k, v) | ||
16 | end | ||
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index ef61183..7d4b0fc 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua | |||
@@ -231,6 +231,57 @@ if nil == email then C("opening mirrors file - " .. e) else | |||
231 | end | 231 | end |
232 | 232 | ||
233 | 233 | ||
234 | local colours = | ||
235 | { | ||
236 | 'f0000080', | ||
237 | '0f000080', | ||
238 | '00f00080', | ||
239 | '000f0080', | ||
240 | '0000f080', | ||
241 | '00000f80', | ||
242 | '80000080', | ||
243 | '08000080', | ||
244 | '00800080', | ||
245 | '00080080', | ||
246 | '00008080', | ||
247 | '00000880', | ||
248 | 'ff000080', | ||
249 | '0ff00080', | ||
250 | '00ff0080', | ||
251 | '000ff080', | ||
252 | '0000ff80', | ||
253 | '88000080', | ||
254 | '08800080', | ||
255 | '00880080', | ||
256 | '00088080', | ||
257 | '00008880', | ||
258 | } | ||
259 | local g = {} | ||
260 | local count = 0 | ||
261 | for k, v in APT.orderedPairs(mirrors) do | ||
262 | if 'pkgmaster.devuan.org' ~= k then count = count + 1 end | ||
263 | end | ||
264 | for i = 1, count do | ||
265 | end | ||
266 | |||
267 | count = 1 | ||
268 | for k, v in APT.orderedPairs(mirrors) do | ||
269 | if 'deb.devuan.org' ~= k then | ||
270 | local c = colours[count] | ||
271 | if 'pkgmaster.devuan.org' == k then c = 'ffffff' end | ||
272 | table.insert(g, 'DEF:speed' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:LAST') | ||
273 | table.insert(g, 'VDEF:vspeed' .. count .. '=speed' .. count .. ',AVERAGE') | ||
274 | table.insert(g, 'LINE2:speed' .. count .. '#' .. c .. ':' .. k .. '\t') | ||
275 | table.insert(g, 'GPRINT:vspeed' .. count .. ':%5.1lf%s\\l') | ||
276 | count = count + 1 | ||
277 | end | ||
278 | end | ||
279 | APT.rrd.graph('results/speed.png', '--start', 'now-1w', '--end', 'now', '-t', 'Speed', '-v', 'bytes per second', '-w', '900', '-h', '400', '-Z', | ||
280 | '-c', 'BACK#000000', '-c', 'CANVAS#000000', '-c', 'FONT#FFFFFF', '-c', 'AXIS#FFFFFF', '-c', 'FRAME#FFFFFF', '-c', 'ARROW#FFFFFF', | ||
281 | unpack(g)) | ||
282 | |||
283 | |||
284 | |||
234 | results = {} | 285 | results = {} |
235 | m = {} | 286 | m = {} |
236 | faulty = "" | 287 | faulty = "" |