Browse Source

Speed RRD is now it's own thing, not aseparate one per protocol.

master
onefang 3 years ago
parent
commit
51f13c53b4
  1. 34
      apt-panopticommon.lua
  2. 8
      apt-panopticon-report-email-web.lua

34
apt-panopticommon.lua

@ -440,7 +440,7 @@ APT.padResults = function(results)
results[v] = tests
end
if nil == results.timeout then results.timeout = false end
if nil == results.speed then results.speed = {min = 0; max = 0} end
if nil == results.speed then results.speed = {min = 999999999999; max = 0} end
return results
end
@ -551,32 +551,31 @@ local RRAl2 = 'RRA:LAST:0.9:50:1210'
local RRAl3 = 'RRA:LAST:0.9:223:1202'
local RRAl4 = 'RRA:LAST:0.9:2635:1201'
APT.createRRD = function(host, ip)
APT.createRRD = function(host, ip, o)
if nil ~= o then start = o end
if nil ~= ip then host = host .. '_' .. ip end
for i, p in pairs(APT.protocols) do
os.execute( 'mkdir -p rrd/' .. host .. '/' .. p:upper())
if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd') then
D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd')
APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd', '--start', start, '--step', step, DSx, DSn,
RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4)
end
if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') then
D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd')
APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', '--start', start, '--step', step, DSIe, DSIw, DSPe, DSPw, DSUe, DSUw, DSSe, DSSw,
RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4)
-- Start them at 0 so the average has something to work on.
APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd', (APT.now - 600) .. ':0:0')
APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', (APT.now - 600) .. ':0:0:0:0:0:0:0:0')
end
end
os.execute( 'mkdir -p rrd/' .. host .. '/Speed')
if not APT.checkFile('rrd/' .. host .. '/Speed/Speed.rrd') then
D('Creating ' .. 'rrd/' .. host .. '/Speed/Speed.rrd')
APT.rrd.create( 'rrd/' .. host .. '/Speed/Speed.rrd', '--start', start, '--step', step, DSx, DSn,
RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4)
APT.rrd.update( 'rrd/' .. host .. '/Speed/Speed.rrd', (APT.now - 600) .. ':0:0')
end
end
APT.updateRRD = function(results, host, ip)
if nil ~= ip then host = host .. '_' .. ip end
for i, p in pairs(APT.protocols) do
if nil ~= results.speed then
APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Speed.rrd', APT.now .. ':' .. results.speed.max .. ':' .. results.speed.min)
end
if nil ~= results[p] then
APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':' ..
results[p]['Integrity'].errors .. ':' .. results[p]['Integrity'].warnings .. ':' ..
@ -587,12 +586,21 @@ APT.updateRRD = function(results, host, ip)
APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':U:U:U:U:U:U:U:U')
end
end
if nil ~= results.speed then
if 0 ~= results.speed.max then
APT.rrd.update('rrd/' .. host .. '/Speed/Speed.rrd', APT.now .. ':' .. results.speed.max .. ':' .. results.speed.min)
else
APT.rrd.update('rrd/' .. host .. '/Speed/Speed.rrd', APT.now .. ':U:U')
end
else
APT.rrd.update( 'rrd/' .. host .. '/Speed/Speed.rrd', APT.now .. ':U:U')
end
end
APT.doRRD = function(l, k, v)
APT.doRRD = function(l, k, v, o)
APT.collateAll(l, k,
function(results, ip)
APT.createRRD(k, ip)
APT.createRRD(k, ip, o)
APT.updateRRD(results, k, ip)
end)
end

8
apt-panopticon-report-email-web.lua

@ -282,10 +282,10 @@ for k, v in APT.orderedPairs(mirrors) do
local c = colours[count]
local name = string.format('%32s', k)
if 'pkgmaster.devuan.org' == k then c = 'ffffff' end
table.insert(g, 'DEF:speedn' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:MIN')
table.insert(g, 'DEF:speedx' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:MAX')
table.insert(g, 'DEF:speeda' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:AVERAGE')
table.insert(g, 'DEF:speedl' .. count .. '=rrd/' .. k .. '/HTTP/Speed.rrd:max:LAST')
table.insert(g, 'DEF:speedn' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MIN')
table.insert(g, 'DEF:speedx' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MAX')
table.insert(g, 'DEF:speeda' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:AVERAGE')
table.insert(g, 'DEF:speedl' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:LAST')
table.insert(g, 'VDEF:vspeedn' .. count .. '=speedn' .. count .. ',AVERAGE')
table.insert(g, 'VDEF:vspeedx' .. count .. '=speedx' .. count .. ',AVERAGE')
table.insert(g, 'VDEF:vspeeda' .. count .. '=speeda' .. count .. ',AVERAGE')

Loading…
Cancel
Save