aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticommon.lua
diff options
context:
space:
mode:
authoronefang2019-12-27 13:53:50 +1000
committeronefang2019-12-27 13:53:50 +1000
commit73808f2d16a80c350ba420a5d88823e0be509b1b (patch)
tree783e36eac4fbaf9ef2be36a68ae2b6efa64695bf /apt-panopticommon.lua
parentOptimise updater a tiny bit. (diff)
downloadapt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.zip
apt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.tar.gz
apt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.tar.bz2
apt-panopticon-73808f2d16a80c350ba420a5d88823e0be509b1b.tar.xz
Add timeouts tracking.
Diffstat (limited to 'apt-panopticommon.lua')
-rw-r--r--apt-panopticommon.lua40
1 files changed, 27 insertions, 13 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index 71e9a9c..e35201d 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -491,17 +491,27 @@ APT.plurals = function(e, w, t)
491 return result 491 return result
492end 492end
493 493
494local typs = {'errors', 'warnings', 'timeouts'}
494APT.padResults = function(results) 495APT.padResults = function(results)
495 local c = 0 496 local c = 0
496 if nil == results then results = {}; c = 999 end 497 if nil == results then results = {}; c = 999 end
497 for k, v in pairs(APT.protocols) do 498 for k, v in pairs(APT.protocols) do
498 tests = results[v] 499 tests = results[v]
499 if nil == tests then tests = {errors = c; warnings = c; timeouts = c} end 500 if nil == tests then tests = {} end
500 if nil == tests.Integrity then tests.Integrity = {errors = c; warnings = c; timeouts = c} end 501 for m, x in pairs(typs) do
501 if nil == tests.Protocol then tests.Protocol = {errors = c; warnings = c; timeouts = c} end 502 if nil == tests[x] then tests[x] = c end
502 if nil == tests.Updated then tests.Updated = {errors = c; warnings = c; timeouts = c} end 503 end
503 if nil == tests.redirects then tests.redirects = {} end 504 for l, w in pairs(APT.tests) do
504 if nil == tests.URLSanity then tests.URLSanity = {errors = c; warnings = c; timeouts = c} end 505 if ('raw' ~= w) and ('Speed' ~= w) then
506 if nil == tests[w] then tests[w] = {} end
507 for m, x in pairs(typs) do
508 if nil == tests[w][x] then tests[w][x] = c end
509 end
510 end
511 end
512 if nil == tests.redirects then
513 tests.redirects = {}
514 end
505 results[v] = tests 515 results[v] = tests
506 end 516 end
507 if nil == results.timeout then results.timeout = false end 517 if nil == results.timeout then results.timeout = false end
@@ -589,12 +599,16 @@ local step = '10min'
589local hb = '150min' 599local hb = '150min'
590local DSIe = 'DS:IntegrityErrors:GAUGE:' .. hb .. ':0:U' 600local DSIe = 'DS:IntegrityErrors:GAUGE:' .. hb .. ':0:U'
591local DSIw = 'DS:IntegrityWarnings:GAUGE:' .. hb .. ':0:U' 601local DSIw = 'DS:IntegrityWarnings:GAUGE:' .. hb .. ':0:U'
602local DSIt = 'DS:IntegrityTimeouts:GAUGE:' .. hb .. ':0:U'
592local DSPe = 'DS:ProtocolErrors:GAUGE:' .. hb .. ':0:U' 603local DSPe = 'DS:ProtocolErrors:GAUGE:' .. hb .. ':0:U'
593local DSPw = 'DS:ProtocolWarnings:GAUGE:' .. hb .. ':0:U' 604local DSPw = 'DS:ProtocolWarnings:GAUGE:' .. hb .. ':0:U'
605local DSPt = 'DS:ProtocolTimeouts:GAUGE:' .. hb .. ':0:U'
594local DSUe = 'DS:UpdatedErrors:GAUGE:' .. hb .. ':0:U' 606local DSUe = 'DS:UpdatedErrors:GAUGE:' .. hb .. ':0:U'
595local DSUw = 'DS:UpdatedWarnings:GAUGE:' .. hb .. ':0:U' 607local DSUw = 'DS:UpdatedWarnings:GAUGE:' .. hb .. ':0:U'
608local DSUt = 'DS:UpdatedTimeouts:GAUGE:' .. hb .. ':0:U'
596local DSSe = 'DS:URLSanityErrors:GAUGE:' .. hb .. ':0:U' 609local DSSe = 'DS:URLSanityErrors:GAUGE:' .. hb .. ':0:U'
597local DSSw = 'DS:URLSanityWarnings:GAUGE:' .. hb .. ':0:U' 610local DSSw = 'DS:URLSanityWarnings:GAUGE:' .. hb .. ':0:U'
611local DSSt = 'DS:URLSanityTimeouts:GAUGE:' .. hb .. ':0:U'
598local DSx = 'DS:max:GAUGE:' .. hb .. ':0:U' 612local DSx = 'DS:max:GAUGE:' .. hb .. ':0:U'
599local DSn = 'DS:min:GAUGE:' .. hb .. ':0:U' 613local DSn = 'DS:min:GAUGE:' .. hb .. ':0:U'
600-- What Collectd uses. 614-- What Collectd uses.
@@ -627,10 +641,10 @@ APT.createRRD = function(host, ip, o)
627 os.execute( 'mkdir -p rrd/' .. host .. '/' .. p:upper()) 641 os.execute( 'mkdir -p rrd/' .. host .. '/' .. p:upper())
628 if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') then 642 if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') then
629 D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') 643 D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd')
630 APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', '--start', start, '--step', step, DSIe, DSIw, DSPe, DSPw, DSUe, DSUw, DSSe, DSSw, 644 APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', '--start', start, '--step', step, DSIe, DSIw, DSIt, DSPe, DSPw, DSPt, DSUe, DSUw, DSUt, DSSe, DSSw, DSSt,
631 RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4) 645 RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4)
632 -- Start them at 0 so the average has something to work on. 646 -- Start them at 0 so the average has something to work on.
633 APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', (APT.now - 600) .. ':0:0:0:0:0:0:0:0') 647 APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', (APT.now - 600) .. ':0:0:0:0:0:0:0:0:0:0:0:0')
634 end 648 end
635 end 649 end
636 os.execute( 'mkdir -p rrd/' .. host .. '/Speed') 650 os.execute( 'mkdir -p rrd/' .. host .. '/Speed')
@@ -647,12 +661,12 @@ APT.updateRRD = function(results, host, ip)
647 for i, p in pairs(APT.protocols) do 661 for i, p in pairs(APT.protocols) do
648 if nil ~= results[p] then 662 if nil ~= results[p] then
649 APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':' .. 663 APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':' ..
650 results[p]['Integrity'].errors .. ':' .. results[p]['Integrity'].warnings .. ':' .. 664 results[p]['Integrity'].errors .. ':' .. results[p]['Integrity'].warnings .. ':' .. results[p]['Integrity'].timeouts .. ':' ..
651 results[p]['Protocol'].errors .. ':' .. results[p]['Protocol'].warnings .. ':' .. 665 results[p]['Protocol'].errors .. ':' .. results[p]['Protocol'].warnings .. ':' .. results[p]['Protocol'].timeouts .. ':' ..
652 results[p]['Updated'].errors .. ':' .. results[p]['Updated'].warnings .. ':' .. 666 results[p]['Updated'].errors .. ':' .. results[p]['Updated'].warnings .. ':' .. results[p]['Updated'].timeouts .. ':' ..
653 results[p]['URLSanity'].errors .. ':' .. results[p]['URLSanity'].warnings) 667 results[p]['URLSanity'].errors .. ':' .. results[p]['URLSanity'].warnings .. ':' .. results[p]['URLSanity'].timeouts)
654 else 668 else
655 APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':U:U:U:U:U:U:U:U') 669 APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':U:U:U:U:U:U:U:U:U:U:U:U')
656 end 670 end
657 end 671 end
658 if nil ~= results.speed then 672 if nil ~= results.speed then