aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-12-10 15:47:45 +1000
committeronefang2019-12-10 15:47:45 +1000
commit86a89a372ec2c09894d5fa7bc1fff2421f484a88 (patch)
treed8ebbd381aeb5ebef1f2b22927bba98b3bdee79b
parentTypo-- (diff)
downloadapt-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.md1
-rwxr-xr-xapt-panopticon-report-RRD.lua16
-rwxr-xr-xapt-panopticon-report-email-web.lua51
3 files changed, 68 insertions, 0 deletions
diff --git a/README.md b/README.md
index 992b6ee..fd7849e 100644
--- a/README.md
+++ b/README.md
@@ -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
45Using it. 46Using 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
3local APT = require 'apt-panopticommon'
4local D = APT.D
5local I = APT.I
6local W = APT.W
7local E = APT.E
8local C = APT.C
9local arg, sendArgs = APT.parseArgs({...})
10
11
12APT.mirrors = loadfile("results/mirrors.lua")()
13APT.html = false
14for k, v in APT.orderedPairs(APT.mirrors) do
15 APT.doRRD('results', k, v)
16end
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
231end 231end
232 232
233 233
234local 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}
259local g = {}
260local count = 0
261for k, v in APT.orderedPairs(mirrors) do
262 if 'pkgmaster.devuan.org' ~= k then count = count + 1 end
263end
264for i = 1, count do
265end
266
267count = 1
268for 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
278end
279APT.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',
281unpack(g))
282
283
284
234results = {} 285results = {}
235m = {} 286m = {}
236faulty = "" 287faulty = ""