aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon-report-email-web.lua
diff options
context:
space:
mode:
Diffstat (limited to 'apt-panopticon-report-email-web.lua')
-rwxr-xr-xapt-panopticon-report-email-web.lua88
1 files changed, 53 insertions, 35 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index b21ba8a..2a13975 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -18,11 +18,13 @@ APT.debians = loadfile("results/debians.lua")()
18local revDNS = function(hosts, dom, IP) 18local revDNS = function(hosts, dom, IP)
19 if APT.options.roundRobin.value ~= dom then 19 if APT.options.roundRobin.value ~= dom then
20 if nil ~= hosts[APT.options.roundRobin.value] then 20 if nil ~= hosts[APT.options.roundRobin.value] then
21 if nil ~= hosts[APT.options.roundRobin.value].IPs["deb.roundr.devuan.org"][IP] then 21 if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname.value] then
22 if APT.html then 22 if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname.value][IP] then
23 return "<font color='purple'><b>DNS-RR</b></font>" 23 if APT.html then
24 else 24 return "<font color='purple'><b>DNS-RR</b></font>"
25 return "DNS-RR" 25 else
26 return "DNS-RR"
27 end
26 end 28 end
27 end 29 end
28 end 30 end
@@ -87,6 +89,7 @@ local status = function(hosts, host, results, typ)
87 89
88 if to then 90 if to then
89 result = "TIMEOUT" 91 result = "TIMEOUT"
92 hosts[host].passed = false;
90 if not s then result = result .. "*" end 93 if not s then result = result .. "*" end
91 if APT.html then 94 if APT.html then
92 if s then 95 if s then
@@ -102,6 +105,7 @@ local status = function(hosts, host, results, typ)
102 end 105 end
103 elseif 0 < e then 106 elseif 0 < e then
104 result = "FAILED" 107 result = "FAILED"
108 hosts[host].passed = false;
105 if not s then result = result .. "*" end 109 if not s then result = result .. "*" end
106 if APT.html then 110 if APT.html then
107 if s then 111 if s then
@@ -198,24 +202,28 @@ local DNSrrTest = function(hosts, k)
198 space = ' &nbsp; ' 202 space = ' &nbsp; '
199 no = "<font color='grey'><b>no</b></font>" 203 no = "<font color='grey'><b>no</b></font>"
200 end 204 end
201 if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) and (nil ~= hosts[k].IPs) then 205 if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) and (nil ~= hosts[k].IPs) and ("no" ~= hosts[k].DNSRR) then
202 APT.allpairs(hosts[k].IPs, 206 APT.allpairs(hosts[k].IPs,
203 function(i, w, k, v) 207 function(i, w, k, v)
204 if nil ~= hosts[APT.options.roundRobin.value].IPs["deb.roundr.devuan.org"][i] then 208-- if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname.value] then
205 local log = logCount(APT.options.roundRobin.value, i) 209-- if nil ~= hosts[APT.options.roundRobin.value].IPs[APT.options.roundRobinCname.value][i] then
206 if "" ~= log then 210 local log = logCount(APT.options.roundRobin.value, i)
207 if "" == dns then dns = " " else dns = dns .. space end 211 local inRR = "<font color='green'><b>&#x2705;</b></font>"
208 dns = dns .. logCount(APT.options.roundRobin.value, i) 212 if nil ~= log:find("<font color='") then inRR = "<font color='red'>&#x274c;</font>" end
209 else 213 if "" ~= log then
210 if "" == dns then dns = " " else dns = dns .. space end 214 if "" == dns then dns = " " else dns = dns .. space end
211 if APT.html then i = "<font color='maroon'><b>" .. i .. "</b></font>" end 215 dns = dns .. inRR .. logCount(APT.options.roundRobin.value, i)
212 dns = dns .. i 216 else
213 end 217 if "" == dns then dns = " " else dns = dns .. space end
214 end 218 if APT.html then i = "<font color='maroon'><b>" .. i .. "</b></font>" end
219 dns = dns .. inRR .. i
220 end
221-- end
222-- end
215 end 223 end
216 ) 224 )
217 if "" == dns then dns = no end
218 end 225 end
226 if "" == dns then dns = no end
219 return dns 227 return dns
220end 228end
221 229
@@ -242,6 +250,7 @@ local makeTable = function(web, hosts)
242 if nil == v.Active then active = 'nil' else active = v.Active end 250 if nil == v.Active then active = 'nil' else active = v.Active end
243 web:write(" <tr style='background-color:dimgrey'><th>" .. k .. "</th> ") 251 web:write(" <tr style='background-color:dimgrey'><th>" .. k .. "</th> ")
244 end 252 end
253 hosts[k].passed = true;
245 local inRR = "<font color='green'><b>&#x2705;</b></font>" 254 local inRR = "<font color='green'><b>&#x2705;</b></font>"
246 local ftp = "<font color='grey'><b>skip</b></font>" 255 local ftp = "<font color='grey'><b>skip</b></font>"
247 local http = status(hosts, k, results, "http") 256 local http = status(hosts, k, results, "http")
@@ -260,14 +269,7 @@ local makeTable = function(web, hosts)
260 local week = '<td>&nbsp;</td><td>&nbsp;</td>' 269 local week = '<td>&nbsp;</td><td>&nbsp;</td>'
261 if nil == rate then rate = '' end 270 if nil == rate then rate = '' end
262 271
263 -- DNS-RR test. 272 if not hosts[k].passed then inRR = "<font color='red'>&#x274c;</font>" end
264-- if nil == http: find('OK') then inRR = "<font color='red'>&#x274c;</font>" end
265-- if nil == https: find('OK') then inRR = "<font color='red'>&#x274c;</font>" end
266-- if nil == protocol: find('OK') then inRR = "<font color='red'>&#x274c;</font>" end
267-- if nil == redirects: find('OK') then inRR = "<font color='red'>&#x274c;</font>" end
268-- if nil == sanity: find('OK') then inRR = "<font color='red'>&#x274c;</font>" end
269-- if nil == integrity: find('OK') then inRR = "<font color='red'>&#x274c;</font>" end
270-- if nil == updated: find('OK') then inRR = "<font color='red'>&#x274c;</font>" end
271 273
272 if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) then 274 if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) then
273 if 0 == max then 275 if 0 == max then
@@ -319,8 +321,10 @@ local makeTable = function(web, hosts)
319 week = '<td>&nbsp;' .. percentUp .. '% up</td><td>&nbsp;' .. percentUpdated .. '% updated</td>' 321 week = '<td>&nbsp;' .. percentUp .. '% up</td><td>&nbsp;' .. percentUpdated .. '% updated</td>'
320-- if ('100.00' ~= percentUp) or ('100.00' ~= percentUpdated) then inRR = "<font color='red'>&#x274c;</font>" end 322-- if ('100.00' ~= percentUp) or ('100.00' ~= percentUpdated) then inRR = "<font color='red'>&#x274c;</font>" end
321 end 323 end
324 if "yes" ~= hosts[k].DNSRR then inRR = " &nbsp; &nbsp; " end
325 if "maybe" == hosts[k].DNSRR then inRR = "<font color='red'>&#x2753;</font>" end
322 326
323 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns .. 327 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. inRR .. " " .. dns ..
324 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. redirects .. "&nbsp;</td><td>" .. sanity .. "&nbsp;</td><td>" .. integrity .. "&nbsp;</td>" .. '<td>' .. rate .. 328 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. redirects .. "&nbsp;</td><td>" .. sanity .. "&nbsp;</td><td>" .. integrity .. "&nbsp;</td>" .. '<td>' .. rate ..
325 '</td><td>' .. updated .. '</td>&nbsp;' .. spd .. "&nbsp;" .. week .."&nbsp;</tr>\n") 329 '</td><td>' .. updated .. '</td>&nbsp;' .. spd .. "&nbsp;" .. week .."&nbsp;</tr>\n")
326 if "" ~= active then 330 if "" ~= active then
@@ -360,15 +364,14 @@ local makeIPlist = function(hosts)
360 if nil ~= hosts[k].IPs then 364 if nil ~= hosts[k].IPs then
361 for l, w in pairs(hosts[k].IPs) do 365 for l, w in pairs(hosts[k].IPs) do
362 if type(w) == "table" then 366 if type(w) == "table" then
363-- TODO - don't hard code deb.roundr.devuan.org.
364 -- Don't output the extra DNS-RR entries that are for admin reasons. 367 -- Don't output the extra DNS-RR entries that are for admin reasons.
365 if ((APT.options.roundRobin.value == k) and ("deb.roundr.devuan.org" == l)) or (APT.options.roundRobin.value ~= k) then 368 if ((APT.options.roundRobin.value == k) and (APT.options.roundRobinCname.value == l)) or (APT.options.roundRobin.value ~= k) then
366 n[l] = {} 369 n[l] = {}
367 for i, u in pairs(w) do 370 for i, u in pairs(w) do
368 if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then 371 if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then
369 local inRR = "" 372 local inRR = ""
370 local lc = logCount(k, i) 373 local lc = logCount(k, i)
371 if checkRR then 374 if checkRR and ('no' ~= hosts[k].DNSRR) then
372 -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. 375 -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags.
373 inRR = "<font color='green'><b>&#x2705;</b></font>" 376 inRR = "<font color='green'><b>&#x2705;</b></font>"
374 if nil ~= lc:find("<font color='") then 377 if nil ~= lc:find("<font color='") then
@@ -382,7 +385,8 @@ local makeIPlist = function(hosts)
382 if f == nil then C("writing DNS-RR_good.txt file - " .. e) end 385 if f == nil then C("writing DNS-RR_good.txt file - " .. e) end
383 end 386 end
384 end 387 end
385 if "yes" ~= hosts[k].DNSRR then inRR = "" end 388 if "maybe" == hosts[k].DNSRR then inRR = "<font color='red'>&#x2753;</font>" end
389 if "no" == hosts[k].DNSRR then inRR = "" end
386 local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] &nbsp; ' 390 local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] &nbsp; '
387 if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end 391 if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end
388 end 392 end
@@ -392,7 +396,7 @@ local makeIPlist = function(hosts)
392 if (APT.testing("IPv6") and ("AAAA" == w)) or ("A" == w) then 396 if (APT.testing("IPv6") and ("AAAA" == w)) or ("A" == w) then
393 local inRR = "" 397 local inRR = ""
394 local lc = logCount(k, l) 398 local lc = logCount(k, l)
395 if checkRR then 399 if checkRR and ('no' ~= hosts[k].DNSRR) then
396 -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. 400 -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags.
397 inRR = "<font color='green'><b>&#x2705;</b></font>" 401 inRR = "<font color='green'><b>&#x2705;</b></font>"
398 if nil ~= lc:find("<font color='") then 402 if nil ~= lc:find("<font color='") then
@@ -406,7 +410,8 @@ local makeIPlist = function(hosts)
406 if f == nil then C("writing DNS-RR_good.txt file - " .. e) end 410 if f == nil then C("writing DNS-RR_good.txt file - " .. e) end
407 end 411 end
408 end 412 end
409 if "yes" ~= hosts[k].DNSRR then inRR = "" end 413 if "maybe" == hosts[k].DNSRR then inRR = "<font color='red'>&#x2753;</font>" end
414 if "no" == hosts[k].DNSRR then inRR = "" end
410 local log = '[<a href="' .. adr .. k .. '_' .. l .. '">graphs</a>] &nbsp; ' 415 local log = '[<a href="' .. adr .. k .. '_' .. l .. '">graphs</a>] &nbsp; '
411 if "" == log then n[l] = w else n[log .. inRR .. ' ' .. revDNS(hosts, k, l) .. ' ' .. lc] = w end 416 if "" == log then n[l] = w else n[log .. inRR .. ' ' .. revDNS(hosts, k, l) .. ' ' .. lc] = w end
412 end 417 end
@@ -512,6 +517,17 @@ local colours =
512 '00880080', 517 '00880080',
513 '00088080', 518 '00088080',
514 '00008880', 519 '00008880',
520 '80000080',
521 '08000080',
522 '00800080',
523 '00080080',
524 '00008080',
525 '00000880',
526 'fff00080',
527 '0fff0080',
528 '00fff080',
529 '000fff80',
530 '0000fff0',
515} 531}
516local g = {} 532local g = {}
517local count = 0 533local count = 0
@@ -526,6 +542,7 @@ for k, v in APT.orderedPairs(mirrors) do
526 if APT.options.roundRobin.value ~= k then 542 if APT.options.roundRobin.value ~= k then
527 local c = colours[count] 543 local c = colours[count]
528 local name = string.format('%32s', k) 544 local name = string.format('%32s', k)
545 if c == nil then c = 'ffffff' end
529 if APT.options.referenceSite.value == k then c = 'ffffff' end 546 if APT.options.referenceSite.value == k then c = 'ffffff' end
530 table.insert(g, 'DEF:speedn' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MIN') 547 table.insert(g, 'DEF:speedn' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MIN')
531 table.insert(g, 'DEF:speedx' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MAX') 548 table.insert(g, 'DEF:speedx' .. count .. '=rrd/' .. k .. '/Speed/Speed.rrd:max:MAX')
@@ -576,7 +593,8 @@ if nil == web then C("opening mirrors file - " .. e) else
576 APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR. &nbsp; " .. 593 APT.options.roundRobin.value .. " is the DNS round robin, which points to the mirrors that are part of the DNS-RR. &nbsp; " ..
577 "If an IP is part of the DNS-RR, it is marked with '<font color='purple'><b>DNS-RR</b></font>'," .. 594 "If an IP is part of the DNS-RR, it is marked with '<font color='purple'><b>DNS-RR</b></font>'," ..
578 " if it <a href='DNS-RR_good.txt'>should be</a> it is marked with '<font color='green'><b>&#x2705;</b></font>'," .. 595 " if it <a href='DNS-RR_good.txt'>should be</a> it is marked with '<font color='green'><b>&#x2705;</b></font>'," ..
579 " if it <a href='DNS-RR_bad.txt'>should not be</a> it is marked with '<font color='red'>&#x274c;</font>'. &nbsp; " .. 596 " if it <a href='DNS-RR_bad.txt'>should not be</a> it is marked with '<font color='red'>&#x274c;</font>'," ..
597 " if it might be but still pending full testing, it is marked with '<font color='red'>&#x2753;</font>'. &nbsp; " ..
580 "<br>" .. 598 "<br>" ..
581 APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it. &nbsp; " .. 599 APT.options.referenceSite.value .. " is the master mirror, all the others copy files from it. &nbsp; " ..
582 "</p>\n" 600 "</p>\n"
@@ -608,7 +626,7 @@ if nil == web then C("opening mirrors file - " .. e) else
608 "and <a href='https://git.devuan.dev/onefang/apt-panopticon_cgp'>here (Devuan repo)</a>.</p>\n" 626 "and <a href='https://git.devuan.dev/onefang/apt-panopticon_cgp'>here (Devuan repo)</a>.</p>\n"
609 ) 627 )
610 local whn = APT.exe('TZ="GMT" ls -dl1 --time-style="+%s" results/stamp | cut -d " " -f 6-6'):Do().result:sub(2, -2) 628 local whn = APT.exe('TZ="GMT" ls -dl1 --time-style="+%s" results/stamp | cut -d " " -f 6-6'):Do().result:sub(2, -2)
611 web:write( "<p>This run took " .. (os.time() - tonumber("0" .. whn)) .. " seconds.</p>" .. 629 web:write( "<p>This run took " .. (os.time() - tonumber("0" .. whn)) .. " seconds. &nbsp &nbsp apt-panopticon version " .. APT.version .. " </p>" ..
612 "\n</body></html>\n") 630 "\n</body></html>\n")
613 web:close() 631 web:close()
614end 632end