Browse Source

Add RRD data collection, and a speed graph.

master
onefang 1 year ago
parent
commit
86a89a372e
3 changed files with 68 additions and 0 deletions
  1. +1
    -0
      README.md
  2. +16
    -0
      apt-panopticon-report-RRD.lua
  3. +51
    -0
      apt-panopticon-report-email-web.lua

+ 1
- 0
README.md View File

@@ -40,6 +40,7 @@ installed -
* luajit
* LuaSocket, on Debian based systems it'll be in the lua-socket package.
* md5sum and sha256, on Debian based systems they'll be in the coreutils package.
* rrdtool, may need to include lua-rrd.
* xz, on Debian based systems it'll be in the xz-utils package.

Using it.


+ 16
- 0
apt-panopticon-report-RRD.lua View File

@@ -0,0 +1,16 @@
#!/usr/bin/env luajit

local APT = require 'apt-panopticommon'
local D = APT.D
local I = APT.I
local W = APT.W
local E = APT.E
local C = APT.C
local arg, sendArgs = APT.parseArgs({...})


APT.mirrors = loadfile("results/mirrors.lua")()
APT.html = false
for k, v in APT.orderedPairs(APT.mirrors) do
APT.doRRD('results', k, v)
end

+ 51
- 0
apt-panopticon-report-email-web.lua View File

@@ -231,6 +231,57 @@ if nil == email then C("opening mirrors file - " .. e) else
end


local colours =
{
'f0000080',
'0f000080',
'00f00080',
'000f0080',
'0000f080',
'00000f80',
'80000080',
'08000080',
'00800080',
'00080080',
'00008080',
'00000880',
'ff000080',
'0ff00080',
'00ff0080',
'000ff080',
'0000ff80',
'88000080',
'08800080',
'00880080',
'00088080',
'00008880',
}
local g = {}
local count = 0
for k, v in APT.orderedPairs(mirrors) do
if 'pkgmaster.devuan.org' ~= k then count = count + 1 end
end
for i = 1, count do
end

count = 1
for k, v in APT.orderedPairs(mirrors) do
if 'deb.devuan.org' ~= k then
local c = colours[count]
if 'pkgmaster.devuan.org' == k then c = 'ffffff' end
table.insert(g, 'DEF:speed' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:LAST')
table.insert(g, 'VDEF:vspeed' .. count .. '=speed' .. count .. ',AVERAGE')
table.insert(g, 'LINE2:speed' .. count .. '#' .. c .. ':' .. k .. '\t')
table.insert(g, 'GPRINT:vspeed' .. count .. ':%5.1lf%s\\l')
count = count + 1
end
end
APT.rrd.graph('results/speed.png', '--start', 'now-1w', '--end', 'now', '-t', 'Speed', '-v', 'bytes per second', '-w', '900', '-h', '400', '-Z',
'-c', 'BACK#000000', '-c', 'CANVAS#000000', '-c', 'FONT#FFFFFF', '-c', 'AXIS#FFFFFF', '-c', 'FRAME#FFFFFF', '-c', 'ARROW#FFFFFF',
unpack(g))



results = {}
m = {}
faulty = ""


Loading…
Cancel
Save