diff options
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index f293a4e..91a0efc 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua | |||
@@ -228,6 +228,7 @@ local makeTable = function(web, hosts) | |||
228 | if nil == v.Active then active = 'nil' else active = v.Active end | 228 | if nil == v.Active then active = 'nil' else active = v.Active end |
229 | web:write(" <tr style='background-color:dimgrey'><th>" .. k .. "</th> ") | 229 | web:write(" <tr style='background-color:dimgrey'><th>" .. k .. "</th> ") |
230 | end | 230 | end |
231 | local inRR = "<font color='green'><b>✅</b></font>" | ||
231 | local ftp = "<font color='grey'><b>skip</b></font>" | 232 | local ftp = "<font color='grey'><b>skip</b></font>" |
232 | local http = status(hosts, k, results, "http") | 233 | local http = status(hosts, k, results, "http") |
233 | local https = status(hosts, k, results, "https") | 234 | local https = status(hosts, k, results, "https") |
@@ -246,6 +247,14 @@ local makeTable = function(web, hosts) | |||
246 | if nil == rate then rate = '' end | 247 | if nil == rate then rate = '' end |
247 | 248 | ||
248 | -- DNS-RR test. | 249 | -- DNS-RR test. |
250 | -- if nil == http: find('OK') then inRR = "<font color='red'>❌</font>" end | ||
251 | -- if nil == https: find('OK') then inRR = "<font color='red'>❌</font>" end | ||
252 | -- if nil == protocol: find('OK') then inRR = "<font color='red'>❌</font>" end | ||
253 | -- if nil == redirects: find('OK') then inRR = "<font color='red'>❌</font>" end | ||
254 | -- if nil == sanity: find('OK') then inRR = "<font color='red'>❌</font>" end | ||
255 | -- if nil == integrity: find('OK') then inRR = "<font color='red'>❌</font>" end | ||
256 | -- if nil == updated: find('OK') then inRR = "<font color='red'>❌</font>" end | ||
257 | |||
249 | if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) then | 258 | if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) then |
250 | if 0 == max then | 259 | if 0 == max then |
251 | spd = '<td></td><td></td>' | 260 | spd = '<td></td><td></td>' |
@@ -294,6 +303,7 @@ local makeTable = function(web, hosts) | |||
294 | -- TODO - try to account for this better, this is just a quick hack. | 303 | -- TODO - try to account for this better, this is just a quick hack. |
295 | end | 304 | end |
296 | week = '<td> ' .. percentUp .. '% up</td><td> ' .. percentUpdated .. '% updated</td>' | 305 | week = '<td> ' .. percentUp .. '% up</td><td> ' .. percentUpdated .. '% updated</td>' |
306 | -- if ('100.00' ~= percentUp) or ('100.00' ~= percentUpdated) then inRR = "<font color='red'>❌</font>" end | ||
297 | end | 307 | end |
298 | 308 | ||
299 | web:write("<td>" .. ftp .. " </td><td>" .. http .. " </td><td>" .. https .. " </td><td>" .. rsync .. " </td><td>" .. dns .. | 309 | web:write("<td>" .. ftp .. " </td><td>" .. http .. " </td><td>" .. https .. " </td><td>" .. rsync .. " </td><td>" .. dns .. |
@@ -338,44 +348,48 @@ local makeIPlist = function(hosts) | |||
338 | if type(w) == "table" then | 348 | if type(w) == "table" then |
339 | n[l] = {} | 349 | n[l] = {} |
340 | for i, u in pairs(w) do | 350 | for i, u in pairs(w) do |
341 | local inRR = "" | 351 | if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then |
342 | local lc = logCount(k, i) | 352 | local inRR = "" |
353 | local lc = logCount(k, i) | ||
354 | if checkRR then | ||
355 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. | ||
356 | inRR = "<font color='green'><b>✅</b></font>" | ||
357 | if nil ~= lc:find("<font color='") then | ||
358 | inRR = "<font color='red'>❌</font>" | ||
359 | if nil ~= RRbfile then | ||
360 | local f, e = RRbfile:write(i, '\n') | ||
361 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end | ||
362 | end | ||
363 | elseif nil ~= RRgfile then | ||
364 | local f, e = RRgfile:write(i, '\n') | ||
365 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end | ||
366 | end | ||
367 | end | ||
368 | local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] ' | ||
369 | if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end | ||
370 | end | ||
371 | end | ||
372 | else | ||
373 | if (APT.testing("IPv6") and ("AAAA" == w)) or ("A" == w) then | ||
374 | local inRR = "" | ||
375 | local lc = logCount(k, l) | ||
343 | if checkRR then | 376 | if checkRR then |
344 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. | 377 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. |
345 | inRR = "<font color='green'><b>✅</b></font>" | 378 | inRR = "<font color='green'><b>✅</b></font>" |
346 | if nil ~= lc:find("<font color='") then | 379 | if nil ~= lc:find("<font color='") then |
347 | inRR = "<font color='red'>❌</font>" | 380 | inRR = "<font color='red'>❌</font>" |
348 | if nil ~= RRbfile then | 381 | if nil ~= RRbfile then |
349 | local f, e = RRbfile:write(i, '\n') | 382 | local f, e = RRbfile:write(l, '\n') |
350 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end | 383 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end |
351 | end | 384 | end |
352 | elseif nil ~= RRgfile then | 385 | elseif nil ~= RRgfile then |
353 | local f, e = RRgfile:write(i, '\n') | 386 | local f, e = RRgfile:write(l, '\n') |
354 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end | 387 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end |
355 | end | 388 | end |
356 | end | 389 | end |
357 | local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] ' | 390 | local log = '[<a href="' .. adr .. k .. '_' .. l .. '">graphs</a>] ' |
358 | 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] = w else n[log .. inRR .. ' ' .. revDNS(hosts, k, l) .. ' ' .. lc] = w end |
359 | end | ||
360 | else | ||
361 | local inRR = "" | ||
362 | local lc = logCount(k, l) | ||
363 | if checkRR then | ||
364 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. | ||
365 | inRR = "<font color='green'><b>✅</b></font>" | ||
366 | if nil ~= lc:find("<font color='") then | ||
367 | inRR = "<font color='red'>❌</font>" | ||
368 | if nil ~= RRbfile then | ||
369 | local f, e = RRbfile:write(l, '\n') | ||
370 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end | ||
371 | end | ||
372 | elseif nil ~= RRgfile then | ||
373 | local f, e = RRgfile:write(l, '\n') | ||
374 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end | ||
375 | end | ||
376 | end | 392 | end |
377 | local log = '[<a href="' .. adr .. k .. '_' .. l .. '">graphs</a>] ' | ||
378 | if "" == log then n[l] = w else n[log .. inRR .. ' ' .. revDNS(hosts, k, l) .. ' ' .. lc] = w end | ||
379 | end | 393 | end |
380 | end | 394 | end |
381 | end | 395 | end |