From c3b5b574bfd81f2093c4d795a929e27ed34708f1 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 6 Feb 2020 14:13:24 +1000 Subject: Rewrite some of the output. Move explanations into tooltips. Invent a crappy HTML template "system". General clean up of text. --- apt-panopticon-report-email-web.lua | 97 +++++++++++++++---------------------- 1 file changed, 39 insertions(+), 58 deletions(-) (limited to 'apt-panopticon-report-email-web.lua') 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")() APT.debians = loadfile("results/debians.lua")() -local lnk = function(name, link) - if nil == link then link = name end - return name .. " *" -end - local revDNS = function(hosts, dom, IP) if APT.options.roundRobin.value ~= dom then if nil ~= hosts[APT.options.roundRobin.value] then @@ -210,12 +205,18 @@ local DNSrrTest = function(hosts, k) return dns end + +local copyHTMLbit = function(web, file) + local rfile, e = io.open(file, "r") + if nil == rfile then W("opening " .. file .. " file - " .. e) else + for line in rfile:lines("*l") do + web:write(line .. '\n') + end + end +end + local makeTable = function(web, hosts) - web:write("\n" .. - "" .. - "" .. - "\n") + copyHTMLbit(web, "Report-web_TABLE.html") local bg = '' for k, v in APT.orderedPairs(hosts) do if '' == bg then bg = " style='background-color:#111111'" else bg = '' end @@ -344,20 +345,21 @@ APT.html = false local email, e = io.open("results/Report-email.txt", "w+") if nil == email then C("opening mirrors file - " .. e) else email:write( "Dear Mirror Admins,\n\n" .. - "This is the status of the mirror servers in the Devuan package mirror network.\n\n" .. - "EXPERIMENTAL CODE - double check all results you see here, and read the logs if it's important." .. + "This is a summary of the status of the mirror servers in the \nDevuan package mirror network.\n\n" .. + "EXPERIMENTAL CODE - double check all results you see here, \nand read the logs if it's important.\n\n" .. "The full list of Devuan package mirrors is available at the URL:\n\n" .. " https://pkgmaster.devuan.org/mirror_list.txt\n\n" .. - 'Please contact "mirrors@devuan.org" if any of the information \nin the file above needs to be amended. \n\n' .. - "The full results of the mirror checking is available at the URL:\n\n" .. - " https://sledjhamr.org/apt-panopticon/results/Report-web.html\n\n" .. + 'Please contact "mirrors@devuan.org" if any of the information \nin the file above needs to be amended.\n\n' .. + "The full results of the mirror checking is available at the URLs:\n\n" .. + " https://borta.devuan.dev/apt-panopticon/results/Report-web.html\n (updated once every hour)\n" .. + " https://sledjhamr.org/apt-panopticon/results/Report-web.html\n (updated once every ten minutes)\n\n" .. "Due to the nature of the tests, some errors or warnings will be \ncounted several times. " .. "Refer to the logs on the web page for details.\n\n" .. "Please see below the current status of the Devuan Package Mirror \nnetwork:\n\n" .. "==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====\n" .. "[skip] means that the test hasn't been written yet.\n\n") for k, v in APT.orderedPairs(APT.mirrors) do - email:write(k .. "....\n") + email:write(k .. "..\n") local results = APT.collateAll(APT.mirrors, 'results', k) local ftp = "[skip]" local http = status(APT.mirrors, k, results, "http") @@ -372,13 +374,19 @@ if nil == email then C("opening mirrors file - " .. e) else -- DNS-RR test. if (APT.options.roundRobin.value ~= k) and (nil ~= APT.mirrors[APT.options.roundRobin.value]) then - dns = " DNS-RR: " .. dns + dns = " DNS-RR: " .. dns .. "\n" end - email:write( " ftp: " .. ftp .. " http: " .. http .. " https: " .. https .." rsync: " .. rsync .. "\n" .. - " " .. dns .. "\n" .. - " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Integrity: " .. integrity .. "\n" .. - " Updated: " .. updated .. "\n") + email:write( " ftp: " .. ftp .. "\n" .. + " http: " .. http .. "\n" .. + " https: " .. https .. "\n" .. + " rsync: " .. rsync .. "\n" .. + dns .. + " Protocol: " .. protocol .. "\n" .. + " Redirects: " .. redirects .. "\n" .. + " URL-sanity: " .. sanity .. "\n" .. + " Integrity: " .. integrity .. "\n" .. + " Updated: " .. updated .. "\n") end email:write( "\n==== faulty mirrors: ====\n" .. faulty) email:write( "\n-------------------------\n\n" .. @@ -387,7 +395,7 @@ if nil == email then C("opening mirrors file - " .. e) else "You can get the source code from https://sledjhamr.org/cgit/apt-panopticon/about/ (main repo)\n" .. "and from https://git.devuan.org/onefang/apt-panopticon' (Devuan repo).\n" .. "You can get the cgp graphing source code from https://sledjhamr.org/cgit/apt-panopticon_cgp/about/ (main repo)\n" .. - "and https://git.devuan.org/onefang/apt-panopticon_cgp (Devuan repo)\n" .. + "and https://git.devuan.org/onefang/apt-panopticon_cgp (Devuan repo)\n\n" .. "Love\n\n" .. "The Dev1Devs\n\n") email:close() @@ -454,60 +462,33 @@ APT.rrd.graph('results/speed.png', '--start', 'now-2w', '--end', 'now', '-t', 'S unpack(g)) - results = {} m = {} faulty = "" APT.html = true local web, e = io.open("results/Report-web.html", "w+") if nil == web then C("opening mirrors file - " .. e) else - web:write( "apt-panopticon results\n") + copyHTMLbit(web, "Report-web_0.html") if 0 < tonumber(APT.options.refresh.value) then web:write('\n') end - web:write( '' .. - "

Welcome to the apt-panopticon results page.

\n" .. - "

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.

" .. - "

This is the status of the mirror servers in the Devuan package mirror network.

\n") + copyHTMLbit(web, "Report-web_1.html") if 0 < tonumber(APT.options.refresh.value) then web:write( '

This page will refresh every ' .. (APT.options.refresh.value / 60) .. ' minutes.

') end - web:write( "

EXPERIMENTAL CODE - double check all results you see here, and read the logs if it's important.

" .. - "

The full list of Devuan package mirrors is available at the URL: " .. - "https://pkgmaster.devuan.org/mirror_list.txt

\n" .. - "

Due to the nature of the tests, some errors or warnings will be counted several times.   " .. - "The links in the table and DNS list go to the detailed testing logs.

\n\n" .. - "
\n

==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====

\n" .. - - "

FAILED or OK" .. - " means the tested thing is supported for that mirror.

\n" .. - "

FAILED* or OK*" .. - " means the tested thing is unsupported for that mirror, but might have been tested anyway.

\n" .. - "

timeout or timeout" .. - " means the mirror had some timeouts, and tests where not yet aborted. The darker colour means unsupported by the mirror, but tested anyway.

" .. - "

TIMEOUT or TIMEOUT" .. - " means the mirror had too many timeouts, and tests where aborted, so there is no result for this test.

" .. - "

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..

" .. - "

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.

" .. - "

The DNS round robin (DNS-RR) column shows the IPs for that mirror, or no if it isn't part of the DNS-RR.   " .. - "The IPs link to the testing log for that IP accessed via the DNS-RR.   " .. - APT.options.roundRobin.value .. " is the DNS-RR itself, so it doesn't get tested directly.

\n" .. - "

The time in the Updated column is how often the mirror updates itself.

" .. - "

Mirrors with a grey background are not active (though may be usable as part of the DNS-RR).

\n" .. - "

skip means that the test hasn't been written yet.

\n" - ) - + copyHTMLbit(web, "Report-web_2.html") + web:write("\n

==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====

\n") + copyHTMLbit(web, "Report-web_3.html") makeTable(web, APT.mirrors) web:write( "

==== faulty mirrors: ====

\n" .. faulty) - web:write( "
\n
\n

==== DNS, graphs *, and logs: ====

\n") - + web:write( "
\n
\n

==== DNS, links to graphs, and links to logs: ====

\n") m = makeIPlist(APT.mirrors) web:write( "

This lists each mirror, and the DNS entries for that mirror.   " .. - "The links point to the testing log files (" .. logCount("apt-panopticon") .. ") for each domain name / IP combination that was tested.   " .. + "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.   " .. "If a mirror has a CNAME, that CNAME is listed along with that CNAMEs DNS entries.   " .. APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR.   " .. "If an IP is part of the DNS-RR, it is marked with 'DNS-RR'   " .. - APT.options.referenceSite.value .. " is the master mirror, all the others sync to it.   " .. + APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it.   " .. "

\n" ) web:write(APT.dumpTableHTML(m, "")) @@ -524,7 +505,7 @@ if nil == web then C("opening mirrors file - " .. e) else ) makeTable(web, APT.debians) - web:write( "
\n
\n

==== Debian DNS, graphs *, and logs: ====

\n") + web:write( "
\n
\n

==== Debian DNS, links to graphs, and links to logs: ====

\n") m = makeIPlist(APT.debians) web:write(APT.dumpTableHTML(m, "")) -- cgit v1.1
" .. lnk('FTP') .. "" .. lnk('HTTP') .. "" .. lnk('HTTPS') .. "" .. lnk('RSYNC') .. "" .. lnk('DNS round robin', 'DNS-RR') .. "" .. lnk('Protocol') .. "" .. lnk('Redirects') .. - "" .. lnk('URL sanity', 'URL-Sanity') .. "" .. lnk('Integrity') .. "" .. lnk('Updated') .. "" .. lnk('Speed range', 'Speed') .. "" .. lnk('Weekly statistics', 'Weekly') .. "