aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon-report-email-web.lua
diff options
context:
space:
mode:
authoronefang2019-12-27 15:34:14 +1000
committeronefang2019-12-27 15:34:14 +1000
commitce500339a5445b30effe21e80a4ebe197bd1d89f (patch)
treebf9d8aa45265b21fd807988f090947c3253c86fd /apt-panopticon-report-email-web.lua
parentAdd timeouts tracking. (diff)
downloadapt-panopticon-ce500339a5445b30effe21e80a4ebe197bd1d89f.zip
apt-panopticon-ce500339a5445b30effe21e80a4ebe197bd1d89f.tar.gz
apt-panopticon-ce500339a5445b30effe21e80a4ebe197bd1d89f.tar.bz2
apt-panopticon-ce500339a5445b30effe21e80a4ebe197bd1d89f.tar.xz
Calculate and display weekly stats.
Diffstat (limited to 'apt-panopticon-report-email-web.lua')
-rwxr-xr-xapt-panopticon-report-email-web.lua48
1 files changed, 45 insertions, 3 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index abc376c..2570c6c 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -363,7 +363,7 @@ if nil == web then C("opening mirrors file - " .. e) else
363 "<table>\n<tr><th></th><th>" .. lnk('FTP') .. "</th><th>" .. lnk('HTTP') .. "</th><th>" .. lnk('HTTPS') .. "</th><th>" .. lnk('RSYNC') .. "</th>" .. 363 "<table>\n<tr><th></th><th>" .. lnk('FTP') .. "</th><th>" .. lnk('HTTP') .. "</th><th>" .. lnk('HTTPS') .. "</th><th>" .. lnk('RSYNC') .. "</th>" ..
364 "<th>" .. lnk('DNS round robin', 'DNS-RR') .. "</th><th>" .. lnk('Protocol') .. "</th><th>" .. lnk('URL sanity', 'URL-Sanity') .. "</th><th>" .. lnk('Integrity') .. "</th>" .. 364 "<th>" .. lnk('DNS round robin', 'DNS-RR') .. "</th><th>" .. lnk('Protocol') .. "</th><th>" .. lnk('URL sanity', 'URL-Sanity') .. "</th><th>" .. lnk('Integrity') .. "</th>" ..
365 "<th>" .. lnk('Updated') .. "</th><th colspan='2'>" .. lnk('Speed range', 'Speed') .. "</th>" .. 365 "<th>" .. lnk('Updated') .. "</th><th colspan='2'>" .. lnk('Speed range', 'Speed') .. "</th>" ..
366 "<th colspan='2'>" .. lnk('Weekly averages', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n" 366 "<th colspan='2'>" .. lnk('Weekly statistics', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n"
367 ) 367 )
368 368
369 local bg = '' 369 local bg = ''
@@ -391,7 +391,7 @@ if nil == web then C("opening mirrors file - " .. e) else
391 local min = tonumber(results.speed.min) 391 local min = tonumber(results.speed.min)
392 local max = tonumber(results.speed.max) 392 local max = tonumber(results.speed.max)
393 local spd = '<td></td><td></td>' 393 local spd = '<td></td><td></td>'
394 local week = '<td>xxx% up</td><td>xxx% updated</td>' 394 local week = '<td></td><td></td>'
395 local graph = '<a href="../apt-panopticon_cgp/host.php?h=' .. k .. '">graphs</a>' 395 local graph = '<a href="../apt-panopticon_cgp/host.php?h=' .. k .. '">graphs</a>'
396 396
397 -- DNS-RR test. 397 -- DNS-RR test.
@@ -432,6 +432,48 @@ if nil == web then C("opening mirrors file - " .. e) else
432 end 432 end
433 end 433 end
434 434
435 if ("deb.devuan.org" ~= k) then
436 local percentUp = '???'
437 local percentUpdated = '???'
438 if APT.checkFile('rrd/' .. k .. '/Speed/Speed.rrd') then
439 local start, step, names, data = APT.rrd.fetch('rrd/' .. k .. '/Speed/Speed.rrd', 'LAST', '-a', '-r', '10m', '-s', '-1w')
440 local count, up, down, unknown = 0, 0, 0, 0
441 for i,dp in ipairs(data) do
442 for j,v in ipairs(dp) do
443 if 'max' == names[j] then
444 if 'nan' == tostring(v) then
445 unknown = unknown + 1
446 else
447 count = count + 1
448 if 0 == v then down = down + 1 else up = up + 1 end
449 end
450 end
451 end
452 end
453 percentUp = string.format('%d', up / count * 100)
454 end
455 if APT.checkFile('rrd/' .. k .. '/HTTP/Tests.rrd') then
456 local start, step, names, data = APT.rrd.fetch('rrd/' .. k .. '/HTTP/Tests.rrd', 'LAST', '-a', '-r', '10m', '-s', '-1w')
457 local count, up, down, unknown = 0, 0, 0, 0
458 for i,dp in ipairs(data) do
459 for j,v in ipairs(dp) do
460 if 'UpdatedErrors' == names[j] then
461 if 'nan' == tostring(v) then
462 unknown = unknown + 1
463 else
464 count = count + 1
465 if 0 == v then down = down + 1 else up = up + 1 end
466 end
467 end
468 end
469 end
470 percentUpdated = string.format('%d', (down / count * 100))
471 if '0' == percentUp then percentUpdated = '??' end -- We are counting errors, and you can't get an error if you can't check anything.
472 -- TODO - try to account for this better, this is just a quick hack.
473 end
474 week = '<td>' .. percentUp .. '% up</td><td>' .. percentUpdated .. '% updated</td>'
475 end
476
435 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns .. 477 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns ..
436 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity .. "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated .. 478 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity .. "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated ..
437 "&nbsp;" .. spd .. "&nbsp;" .. week .."&nbsp;<td>" .. graph .. "</td></tr>\n") 479 "&nbsp;" .. spd .. "&nbsp;" .. week .."&nbsp;<td>" .. graph .. "</td></tr>\n")
@@ -491,7 +533,7 @@ if nil == web then C("opening mirrors file - " .. e) else
491 "<table>\n<tr><th></th><th>" .. lnk('FTP') .. "</a></th><th>" .. lnk('HTTP') .. "</th><th>" .. lnk('HTTPS') .. "</th><th>" .. lnk('RSYNC') .. "</th>" .. 533 "<table>\n<tr><th></th><th>" .. lnk('FTP') .. "</a></th><th>" .. lnk('HTTP') .. "</th><th>" .. lnk('HTTPS') .. "</th><th>" .. lnk('RSYNC') .. "</th>" ..
492 "<th>" .. lnk('DNS round robin', 'DNS-RR') .. "</th><th>" .. lnk('Protocol') .. "</th><th>" .. lnk('URL sanity', 'URL-Sanity') .. "</th><th>" .. lnk('Integrity') .. "</th>" .. 534 "<th>" .. lnk('DNS round robin', 'DNS-RR') .. "</th><th>" .. lnk('Protocol') .. "</th><th>" .. lnk('URL sanity', 'URL-Sanity') .. "</th><th>" .. lnk('Integrity') .. "</th>" ..
493 "<th>" .. lnk('Updated') .. "</th><th colspan='2'>" .. lnk('Speed range', 'Speed') .. "</th>" .. 535 "<th>" .. lnk('Updated') .. "</th><th colspan='2'>" .. lnk('Speed range', 'Speed') .. "</th>" ..
494 "<th colspan='2'>" .. lnk('Weekly averages', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n" 536 "<th colspan='2'>" .. lnk('Weekly statistics', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n"
495 ) 537 )
496 for k, v in APT.orderedPairs(APT.debians) do 538 for k, v in APT.orderedPairs(APT.debians) do
497 if '' == bg then bg = " style='background-color:#111111'" else bg = '' end 539 if '' == bg then bg = " style='background-color:#111111'" else bg = '' end