diff options
author | onefang | 2019-12-27 15:34:14 +1000 |
---|---|---|
committer | onefang | 2019-12-27 15:34:14 +1000 |
commit | ce500339a5445b30effe21e80a4ebe197bd1d89f (patch) | |
tree | bf9d8aa45265b21fd807988f090947c3253c86fd | |
parent | Add timeouts tracking. (diff) | |
download | apt-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 '')
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 48 | ||||
-rw-r--r-- | explanations.html | 4 |
2 files changed, 48 insertions, 4 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 .. " </td><td>" .. http .. " </td><td>" .. https .. " </td><td>" .. rsync .. " </td><td>" .. dns .. | 477 | web:write("<td>" .. ftp .. " </td><td>" .. http .. " </td><td>" .. https .. " </td><td>" .. rsync .. " </td><td>" .. dns .. |
436 | " </td><td>" .. protocol .. " </td><td>" .. sanity .. " </td><td>" .. integrity .. " </td><td>" .. updated .. | 478 | " </td><td>" .. protocol .. " </td><td>" .. sanity .. " </td><td>" .. integrity .. " </td><td>" .. updated .. |
437 | " " .. spd .. " " .. week .." <td>" .. graph .. "</td></tr>\n") | 479 | " " .. spd .. " " .. week .." <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 |
diff --git a/explanations.html b/explanations.html index ae1299a..f4d11fa 100644 --- a/explanations.html +++ b/explanations.html | |||
@@ -78,7 +78,9 @@ So take this speed measurement with a grain of salt, it's more of an indication, | |||
78 | </p> | 78 | </p> |
79 | 79 | ||
80 | <hr><h1 id="Weekly">Weekly averages</h1> | 80 | <hr><h1 id="Weekly">Weekly averages</h1> |
81 | <p>This is the percentage of time the mirror was up, and the mirror was up to date.</p> | 81 | <p>This is the percentage of time the mirror was up, and the percentage of time the mirror was up to date. |
82 | Note that if the mirror has a low uptime, then there wasn't much chance to check if it was up to date. | ||
83 | </p> | ||
82 | 84 | ||
83 | <hr><h1 id="Graphs">Graphs</h1> | 85 | <hr><h1 id="Graphs">Graphs</h1> |
84 | <p>A link to the graphs for this mirror.</p> | 86 | <p>A link to the graphs for this mirror.</p> |