Browse Source

Calculate and display weekly stats.

master
onefang 3 years ago
parent
commit
ce500339a5
  1. 48
      apt-panopticon-report-email-web.lua
  2. 4
      explanations.html

48
apt-panopticon-report-email-web.lua

@ -363,7 +363,7 @@ if nil == web then C("opening mirrors file - " .. e) else
"<table>\n<tr><th></th><th>" .. lnk('FTP') .. "</th><th>" .. lnk('HTTP') .. "</th><th>" .. lnk('HTTPS') .. "</th><th>" .. lnk('RSYNC') .. "</th>" ..
"<th>" .. lnk('DNS round robin', 'DNS-RR') .. "</th><th>" .. lnk('Protocol') .. "</th><th>" .. lnk('URL sanity', 'URL-Sanity') .. "</th><th>" .. lnk('Integrity') .. "</th>" ..
"<th>" .. lnk('Updated') .. "</th><th colspan='2'>" .. lnk('Speed range', 'Speed') .. "</th>" ..
"<th colspan='2'>" .. lnk('Weekly averages', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n"
"<th colspan='2'>" .. lnk('Weekly statistics', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n"
)
local bg = ''
@ -391,7 +391,7 @@ if nil == web then C("opening mirrors file - " .. e) else
local min = tonumber(results.speed.min)
local max = tonumber(results.speed.max)
local spd = '<td></td><td></td>'
local week = '<td>xxx% up</td><td>xxx% updated</td>'
local week = '<td></td><td></td>'
local graph = '<a href="../apt-panopticon_cgp/host.php?h=' .. k .. '">graphs</a>'
-- DNS-RR test.
@ -432,6 +432,48 @@ if nil == web then C("opening mirrors file - " .. e) else
end
end
if ("deb.devuan.org" ~= k) then
local percentUp = '???'
local percentUpdated = '???'
if APT.checkFile('rrd/' .. k .. '/Speed/Speed.rrd') then
local start, step, names, data = APT.rrd.fetch('rrd/' .. k .. '/Speed/Speed.rrd', 'LAST', '-a', '-r', '10m', '-s', '-1w')
local count, up, down, unknown = 0, 0, 0, 0
for i,dp in ipairs(data) do
for j,v in ipairs(dp) do
if 'max' == names[j] then
if 'nan' == tostring(v) then
unknown = unknown + 1
else
count = count + 1
if 0 == v then down = down + 1 else up = up + 1 end
end
end
end
end
percentUp = string.format('%d', up / count * 100)
end
if APT.checkFile('rrd/' .. k .. '/HTTP/Tests.rrd') then
local start, step, names, data = APT.rrd.fetch('rrd/' .. k .. '/HTTP/Tests.rrd', 'LAST', '-a', '-r', '10m', '-s', '-1w')
local count, up, down, unknown = 0, 0, 0, 0
for i,dp in ipairs(data) do
for j,v in ipairs(dp) do
if 'UpdatedErrors' == names[j] then
if 'nan' == tostring(v) then
unknown = unknown + 1
else
count = count + 1
if 0 == v then down = down + 1 else up = up + 1 end
end
end
end
end
percentUpdated = string.format('%d', (down / count * 100))
if '0' == percentUp then percentUpdated = '??' end -- We are counting errors, and you can't get an error if you can't check anything.
-- TODO - try to account for this better, this is just a quick hack.
end
week = '<td>' .. percentUp .. '% up</td><td>' .. percentUpdated .. '% updated</td>'
end
web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns ..
"&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity .. "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated ..
"&nbsp;" .. spd .. "&nbsp;" .. week .."&nbsp;<td>" .. graph .. "</td></tr>\n")
@ -491,7 +533,7 @@ if nil == web then C("opening mirrors file - " .. e) else
"<table>\n<tr><th></th><th>" .. lnk('FTP') .. "</a></th><th>" .. lnk('HTTP') .. "</th><th>" .. lnk('HTTPS') .. "</th><th>" .. lnk('RSYNC') .. "</th>" ..
"<th>" .. lnk('DNS round robin', 'DNS-RR') .. "</th><th>" .. lnk('Protocol') .. "</th><th>" .. lnk('URL sanity', 'URL-Sanity') .. "</th><th>" .. lnk('Integrity') .. "</th>" ..
"<th>" .. lnk('Updated') .. "</th><th colspan='2'>" .. lnk('Speed range', 'Speed') .. "</th>" ..
"<th colspan='2'>" .. lnk('Weekly averages', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n"
"<th colspan='2'>" .. lnk('Weekly statistics', 'Weekly') .. "</th><th>" .. lnk('Graphs') .. "</th></tr>\n"
)
for k, v in APT.orderedPairs(APT.debians) do
if '' == bg then bg = " style='background-color:#111111'" else bg = '' end

4
explanations.html

@ -78,7 +78,9 @@ So take this speed measurement with a grain of salt, it's more of an indication,
</p>
<hr><h1 id="Weekly">Weekly averages</h1>
<p>This is the percentage of time the mirror was up, and the mirror was up to date.</p>
<p>This is the percentage of time the mirror was up, and the percentage of time the mirror was up to date. &nbsp;
Note that if the mirror has a low uptime, then there wasn't much chance to check if it was up to date.
</p>
<hr><h1 id="Graphs">Graphs</h1>
<p>A link to the graphs for this mirror.</p>

Loading…
Cancel
Save