aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon-report-email-web.lua
diff options
context:
space:
mode:
authoronefang2020-02-06 14:13:24 +1000
committeronefang2020-02-06 14:13:24 +1000
commitc3b5b574bfd81f2093c4d795a929e27ed34708f1 (patch)
tree597036729f246154212bc554498e28017a5ecd45 /apt-panopticon-report-email-web.lua
parentBetter wait for command startup. (diff)
downloadapt-panopticon-c3b5b574bfd81f2093c4d795a929e27ed34708f1.zip
apt-panopticon-c3b5b574bfd81f2093c4d795a929e27ed34708f1.tar.gz
apt-panopticon-c3b5b574bfd81f2093c4d795a929e27ed34708f1.tar.bz2
apt-panopticon-c3b5b574bfd81f2093c4d795a929e27ed34708f1.tar.xz
Rewrite some of the output.
Move explanations into tooltips. Invent a crappy HTML template "system". General clean up of text.
Diffstat (limited to 'apt-panopticon-report-email-web.lua')
-rwxr-xr-xapt-panopticon-report-email-web.lua97
1 files changed, 39 insertions, 58 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index e59f543..1cb74fd 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -15,11 +15,6 @@ APT.mirrors = loadfile("results/mirrors.lua")()
15APT.debians = loadfile("results/debians.lua")() 15APT.debians = loadfile("results/debians.lua")()
16 16
17 17
18local lnk = function(name, link)
19 if nil == link then link = name end
20 return name .. " <a href='explanations.html#" .. link .. "'>*</a>"
21end
22
23local revDNS = function(hosts, dom, IP) 18local revDNS = function(hosts, dom, IP)
24 if APT.options.roundRobin.value ~= dom then 19 if APT.options.roundRobin.value ~= dom then
25 if nil ~= hosts[APT.options.roundRobin.value] then 20 if nil ~= hosts[APT.options.roundRobin.value] then
@@ -210,12 +205,18 @@ local DNSrrTest = function(hosts, k)
210 return dns 205 return dns
211end 206end
212 207
208
209local copyHTMLbit = function(web, file)
210 local rfile, e = io.open(file, "r")
211 if nil == rfile then W("opening " .. file .. " file - " .. e) else
212 for line in rfile:lines("*l") do
213 web:write(line .. '\n')
214 end
215 end
216end
217
213local makeTable = function(web, hosts) 218local makeTable = function(web, hosts)
214 web:write("<table>\n<tr><th></th><th>" .. lnk('FTP') .. "</th><th>" .. lnk('HTTP') .. "</th><th>" .. lnk('HTTPS') .. "</th><th>" .. lnk('RSYNC') .. "</th>" .. 219 copyHTMLbit(web, "Report-web_TABLE.html")
215 "<th>" .. lnk('DNS round robin', 'DNS-RR') .. "</th><th>" .. lnk('Protocol') .. "</th><th>" .. lnk('Redirects') ..
216 "</th><th>" .. lnk('URL sanity', 'URL-Sanity') .. "</th><th>" .. lnk('Integrity') .. "</th>" ..
217 "<th colspan='2'>" .. lnk('Updated') .. "</th><th colspan='2'>" .. lnk('Speed range', 'Speed') .. "</th>" ..
218 "<th colspan='2'>" .. lnk('Weekly statistics', 'Weekly') .. "</th></tr>\n")
219 local bg = '' 220 local bg = ''
220 for k, v in APT.orderedPairs(hosts) do 221 for k, v in APT.orderedPairs(hosts) do
221 if '' == bg then bg = " style='background-color:#111111'" else bg = '' end 222 if '' == bg then bg = " style='background-color:#111111'" else bg = '' end
@@ -344,20 +345,21 @@ APT.html = false
344local email, e = io.open("results/Report-email.txt", "w+") 345local email, e = io.open("results/Report-email.txt", "w+")
345if nil == email then C("opening mirrors file - " .. e) else 346if nil == email then C("opening mirrors file - " .. e) else
346 email:write( "Dear Mirror Admins,\n\n" .. 347 email:write( "Dear Mirror Admins,\n\n" ..
347 "This is the status of the mirror servers in the Devuan package mirror network.\n\n" .. 348 "This is a summary of the status of the mirror servers in the \nDevuan package mirror network.\n\n" ..
348 "EXPERIMENTAL CODE - double check all results you see here, and read the logs if it's important." .. 349 "EXPERIMENTAL CODE - double check all results you see here, \nand read the logs if it's important.\n\n" ..
349 "The full list of Devuan package mirrors is available at the URL:\n\n" .. 350 "The full list of Devuan package mirrors is available at the URL:\n\n" ..
350 " https://pkgmaster.devuan.org/mirror_list.txt\n\n" .. 351 " https://pkgmaster.devuan.org/mirror_list.txt\n\n" ..
351 'Please contact "mirrors@devuan.org" if any of the information \nin the file above needs to be amended. \n\n' .. 352 'Please contact "mirrors@devuan.org" if any of the information \nin the file above needs to be amended.\n\n' ..
352 "The full results of the mirror checking is available at the URL:\n\n" .. 353 "The full results of the mirror checking is available at the URLs:\n\n" ..
353 " https://sledjhamr.org/apt-panopticon/results/Report-web.html\n\n" .. 354 " https://borta.devuan.dev/apt-panopticon/results/Report-web.html\n (updated once every hour)\n" ..
355 " https://sledjhamr.org/apt-panopticon/results/Report-web.html\n (updated once every ten minutes)\n\n" ..
354 "Due to the nature of the tests, some errors or warnings will be \ncounted several times. " .. 356 "Due to the nature of the tests, some errors or warnings will be \ncounted several times. " ..
355 "Refer to the logs on the web page for details.\n\n" .. 357 "Refer to the logs on the web page for details.\n\n" ..
356 "Please see below the current status of the Devuan Package Mirror \nnetwork:\n\n" .. 358 "Please see below the current status of the Devuan Package Mirror \nnetwork:\n\n" ..
357 "==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====\n" .. 359 "==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====\n" ..
358 "[skip] means that the test hasn't been written yet.\n\n") 360 "[skip] means that the test hasn't been written yet.\n\n")
359 for k, v in APT.orderedPairs(APT.mirrors) do 361 for k, v in APT.orderedPairs(APT.mirrors) do
360 email:write(k .. "....\n") 362 email:write(k .. "..\n")
361 local results = APT.collateAll(APT.mirrors, 'results', k) 363 local results = APT.collateAll(APT.mirrors, 'results', k)
362 local ftp = "[skip]" 364 local ftp = "[skip]"
363 local http = status(APT.mirrors, k, results, "http") 365 local http = status(APT.mirrors, k, results, "http")
@@ -372,13 +374,19 @@ if nil == email then C("opening mirrors file - " .. e) else
372 374
373 -- DNS-RR test. 375 -- DNS-RR test.
374 if (APT.options.roundRobin.value ~= k) and (nil ~= APT.mirrors[APT.options.roundRobin.value]) then 376 if (APT.options.roundRobin.value ~= k) and (nil ~= APT.mirrors[APT.options.roundRobin.value]) then
375 dns = " DNS-RR: " .. dns 377 dns = " DNS-RR: " .. dns .. "\n"
376 end 378 end
377 379
378 email:write( " ftp: " .. ftp .. " http: " .. http .. " https: " .. https .." rsync: " .. rsync .. "\n" .. 380 email:write( " ftp: " .. ftp .. "\n" ..
379 " " .. dns .. "\n" .. 381 " http: " .. http .. "\n" ..
380 " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Integrity: " .. integrity .. "\n" .. 382 " https: " .. https .. "\n" ..
381 " Updated: " .. updated .. "\n") 383 " rsync: " .. rsync .. "\n" ..
384 dns ..
385 " Protocol: " .. protocol .. "\n" ..
386 " Redirects: " .. redirects .. "\n" ..
387 " URL-sanity: " .. sanity .. "\n" ..
388 " Integrity: " .. integrity .. "\n" ..
389 " Updated: " .. updated .. "\n")
382 end 390 end
383 email:write( "\n==== faulty mirrors: ====\n" .. faulty) 391 email:write( "\n==== faulty mirrors: ====\n" .. faulty)
384 email:write( "\n-------------------------\n\n" .. 392 email:write( "\n-------------------------\n\n" ..
@@ -387,7 +395,7 @@ if nil == email then C("opening mirrors file - " .. e) else
387 "You can get the source code from https://sledjhamr.org/cgit/apt-panopticon/about/ (main repo)\n" .. 395 "You can get the source code from https://sledjhamr.org/cgit/apt-panopticon/about/ (main repo)\n" ..
388 "and from https://git.devuan.org/onefang/apt-panopticon' (Devuan repo).\n" .. 396 "and from https://git.devuan.org/onefang/apt-panopticon' (Devuan repo).\n" ..
389 "You can get the cgp graphing source code from https://sledjhamr.org/cgit/apt-panopticon_cgp/about/ (main repo)\n" .. 397 "You can get the cgp graphing source code from https://sledjhamr.org/cgit/apt-panopticon_cgp/about/ (main repo)\n" ..
390 "and https://git.devuan.org/onefang/apt-panopticon_cgp (Devuan repo)\n" .. 398 "and https://git.devuan.org/onefang/apt-panopticon_cgp (Devuan repo)\n\n" ..
391 "Love\n\n" .. 399 "Love\n\n" ..
392 "The Dev1Devs\n\n") 400 "The Dev1Devs\n\n")
393 email:close() 401 email:close()
@@ -454,60 +462,33 @@ APT.rrd.graph('results/speed.png', '--start', 'now-2w', '--end', 'now', '-t', 'S
454unpack(g)) 462unpack(g))
455 463
456 464
457
458results = {} 465results = {}
459m = {} 466m = {}
460faulty = "" 467faulty = ""
461APT.html = true 468APT.html = true
462local web, e = io.open("results/Report-web.html", "w+") 469local web, e = io.open("results/Report-web.html", "w+")
463if nil == web then C("opening mirrors file - " .. e) else 470if nil == web then C("opening mirrors file - " .. e) else
464 web:write( "<html><head><title>apt-panopticon results</title>\n") 471 copyHTMLbit(web, "Report-web_0.html")
465 if 0 < tonumber(APT.options.refresh.value) then 472 if 0 < tonumber(APT.options.refresh.value) then
466 web:write('<meta http-equiv="refresh" content="' .. APT.options.refresh.value .. '">\n') 473 web:write('<meta http-equiv="refresh" content="' .. APT.options.refresh.value .. '">\n')
467 end 474 end
468 web:write( '</head><body bgcolor="black" text="white" alink="red" link="aqua" vlink="fuchsia">' .. 475 copyHTMLbit(web, "Report-web_1.html")
469 "<h1>Welcome to the apt-panopticon results page.</h1>\n" ..
470 "<p>Here the apt-panopticon system probes into every nook and cranny of the Devuan apt package mirror system, trying to live up to it's name.</p>" ..
471 "<p>This is the status of the mirror servers in the Devuan package mirror network.</p>\n")
472 if 0 < tonumber(APT.options.refresh.value) then 476 if 0 < tonumber(APT.options.refresh.value) then
473 web:write( '<p>This page will refresh every ' .. (APT.options.refresh.value / 60) .. ' minutes.</p>') 477 web:write( '<p>This page will refresh every ' .. (APT.options.refresh.value / 60) .. ' minutes.</p>')
474 end 478 end
475 web:write( "<p><font style='background-color:red; color:black'>EXPERIMENTAL CODE - double check all results you see here, and read the logs if it's important.</font></p>" .. 479 copyHTMLbit(web, "Report-web_2.html")
476 "<p>The full list of Devuan package mirrors is available at the URL: " .. 480 web:write("\n<h2>==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====</h2>\n")
477 "<a href='https://pkgmaster.devuan.org/mirror_list.txt'>https://pkgmaster.devuan.org/mirror_list.txt</a></p>\n" .. 481 copyHTMLbit(web, "Report-web_3.html")
478 "<p>Due to the nature of the tests, some errors or warnings will be counted several times. &nbsp; " ..
479 "The links in the table and DNS list go to the detailed testing logs.</p>\n\n" ..
480 "<hr>\n<h2>==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====</h2>\n" ..
481
482 "<p><font color='red'><b>FAILED</b></font> or <font color='lime'><b>OK</b></font>" ..
483 " means the tested thing is supported for that mirror.</p>\n" ..
484 "<p><font color='darkred'><b>FAILED*</b></font> or <font color='darkgreen'><b>OK*</b></font>" ..
485 " means the tested thing is unsupported for that mirror, but might have been tested anyway.</p>\n" ..
486 "<p><font color='aqua'><b>timeout</b></font> or <font color='blue'><b>timeout</b></font>" ..
487 " means the mirror had some timeouts, and tests where not yet aborted. The darker colour means unsupported by the mirror, but tested anyway.</p>" ..
488 "<p><font color='aqua'><b>TIMEOUT</b></font> or <font color='blue'><b>TIMEOUT</b></font>" ..
489 " means the mirror had too many timeouts, and tests where aborted, so there is no result for this test.</p>" ..
490 "<p>NOTE: timeouts may be due to a problem on the testing computer, it might be busy with other things, or be having it's own network problems..</p>" ..
491 "<p>NOTE: the speed of the server this checking script is running on might be wildly exaggerated, it doesn't have to go through the Internet to download from itself.</p>" ..
492 "<p>The DNS round robin (DNS-RR) column shows the IPs for that mirror, or <font color='grey'><b>no</b></font> if it isn't part of the DNS-RR. &nbsp; " ..
493 "The IPs link to the testing log for that IP accessed via the DNS-RR. &nbsp; " ..
494 APT.options.roundRobin.value .. " is the DNS-RR itself, so it doesn't get tested directly.</p>\n" ..
495 "<p>The time in the Updated column is how often the mirror updates itself.</p>" ..
496 "<p>Mirrors with a <font style='background-color:dimgrey'>grey background</font> are not active (though may be usable as part of the DNS-RR).</p>\n" ..
497 "<p><font color='grey'><b>skip</b></font> means that the test hasn't been written yet.</p>\n"
498 )
499
500 makeTable(web, APT.mirrors) 482 makeTable(web, APT.mirrors)
501 web:write( "<h2>==== faulty mirrors: ====</h2>\n" .. faulty) 483 web:write( "<h2>==== faulty mirrors: ====</h2>\n" .. faulty)
502 web:write( "<br>\n<br>\n<h2>==== DNS, graphs <a href='explanations.html#Graphs'>*</a>, and logs: ====</h2>\n") 484 web:write( "<br>\n<br>\n<h2>==== DNS, links to graphs, and links to logs: ====</h2>\n")
503
504 m = makeIPlist(APT.mirrors) 485 m = makeIPlist(APT.mirrors)
505 web:write( "<p>This lists each mirror, and the DNS entries for that mirror. &nbsp; " .. 486 web:write( "<p>This lists each mirror, and the DNS entries for that mirror. &nbsp; " ..
506 "The links point to the testing log files (" .. logCount("apt-panopticon") .. ") for each domain name / IP combination that was tested. &nbsp; " .. 487 "The IP links point to the testing log files (the overall log is " .. logCount("apt-panopticon") .. ") for each domain name / IP combination that was tested. &nbsp; " ..
507 "If a mirror has a CNAME, that CNAME is listed along with that CNAMEs DNS entries. &nbsp; " .. 488 "If a mirror has a CNAME, that CNAME is listed along with that CNAMEs DNS entries. &nbsp; " ..
508 APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR. &nbsp; " .. 489 APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR. &nbsp; " ..
509 "If an IP is part of the DNS-RR, it is marked with '<font color='purple'><b>DNS-RR</b></font>' &nbsp; " .. 490 "If an IP is part of the DNS-RR, it is marked with '<font color='purple'><b>DNS-RR</b></font>' &nbsp; " ..
510 APT.options.referenceSite.value .. " is the master mirror, all the others sync to it. &nbsp; " .. 491 APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it. &nbsp; " ..
511 "</p>\n" 492 "</p>\n"
512 ) 493 )
513 web:write(APT.dumpTableHTML(m, "")) 494 web:write(APT.dumpTableHTML(m, ""))
@@ -524,7 +505,7 @@ if nil == web then C("opening mirrors file - " .. e) else
524 ) 505 )
525 506
526 makeTable(web, APT.debians) 507 makeTable(web, APT.debians)
527 web:write( "<br>\n<br>\n<h2>==== Debian DNS, graphs <a href='explanations.html#Graphs'>*</a>, and logs: ====</h2>\n") 508 web:write( "<br>\n<br>\n<h2>==== Debian DNS, links to graphs, and links to logs: ====</h2>\n")
528 509
529 m = makeIPlist(APT.debians) 510 m = makeIPlist(APT.debians)
530 web:write(APT.dumpTableHTML(m, "")) 511 web:write(APT.dumpTableHTML(m, ""))