diff options
Diffstat (limited to '')
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 48 |
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 .. " </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 |